summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorAlfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>2015-09-07 11:58:15 +0200
committerDenis Kenzior <denkenz@gmail.com>2015-09-08 09:14:03 -0500
commit665c053803c4553452ef2cafbbc1ed7d2f94e94f (patch)
tree20c2eea94334e39a4e5ec36844eb8fd941cfac01 /plugins
parent4e9cbcdb899963d55b6bdcf935f1c595e99c3a85 (diff)
downloadofono-665c053803c4553452ef2cafbbc1ed7d2f94e94f.tar.bz2
push-notification: Accept push from any origin
Accept push notifications regardless of the origin port, as some operators do not insert there the WAP connectionless session service port, and use random values instead.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/push-notification.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index f6ca365a..ff388d9e 100644
--- a/plugins/push-notification.c
+++ b/plugins/push-notification.c
@@ -41,7 +41,7 @@
#define PUSH_NOTIFICATION_INTERFACE "org.ofono.PushNotification"
#define AGENT_INTERFACE "org.ofono.PushNotificationAgent"
-#define WAP_PUSH_SRC_PORT 9200
+#define WAP_PUSH_SRC_PORT -1
#define WAP_PUSH_DST_PORT 2948
static unsigned int modemwatch_id;
@@ -50,21 +50,16 @@ struct push_notification {
struct ofono_modem *modem;
struct ofono_sms *sms;
struct sms_agent *agent;
- unsigned int push_watch[2];
+ unsigned int push_watch;
};
static void agent_exited(void *userdata)
{
struct push_notification *pn = userdata;
- if (pn->push_watch[0] > 0) {
- __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[0]);
- pn->push_watch[0] = 0;
- }
-
- if (pn->push_watch[1] > 0) {
- __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[1]);
- pn->push_watch[1] = 0;
+ if (pn->push_watch > 0) {
+ __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch);
+ pn->push_watch = 0;
}
pn->agent = NULL;
@@ -113,17 +108,12 @@ static DBusMessage *push_notification_register_agent(DBusConnection *conn,
sms_agent_set_removed_notify(pn->agent, agent_exited, pn);
- pn->push_watch[0] = __ofono_sms_datagram_watch_add(pn->sms,
+ pn->push_watch = __ofono_sms_datagram_watch_add(pn->sms,
push_received,
WAP_PUSH_DST_PORT,
WAP_PUSH_SRC_PORT,
pn, NULL);
- pn->push_watch[1] = __ofono_sms_datagram_watch_add(pn->sms,
- push_received,
- WAP_PUSH_DST_PORT,
- 0, pn, NULL);
-
return dbus_message_new_method_return(msg);
}
@@ -166,8 +156,7 @@ static void push_notification_cleanup(gpointer user)
DBG("%p", pn);
/* The push watch was already cleaned up */
- pn->push_watch[0] = 0;
- pn->push_watch[1] = 0;
+ pn->push_watch = 0;
pn->sms = NULL;
sms_agent_free(pn->agent);