Open Source Telephony
 help / color / mirror / Atom feed
* [PATCH 0/3] Accept WAP push notifications with any origin port
@ 2015-09-07  9:58 Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 1/3] push-notification: Accept push from any origin Alfonso Sanchez-Beato
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-09-07  9:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

Accept WAP push notifications regardless of the origin port, as some
operators seem to use random ports. The destination port is enough to
route properly the message.

Alfonso Sanchez-Beato (3):
  push-notification: Accept push from any origin
  smsutil: Do not check the origin port
  sms: Add trace when datagram is not delivered

 plugins/push-notification.c | 25 +++++++------------------
 src/sms.c                   |  7 +++++++
 src/smsutil.c               |  3 ---
 3 files changed, 14 insertions(+), 21 deletions(-)

-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] push-notification: Accept push from any origin
  2015-09-07  9:58 [PATCH 0/3] Accept WAP push notifications with any origin port Alfonso Sanchez-Beato
@ 2015-09-07  9:58 ` Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 2/3] smsutil: Do not check the origin port Alfonso Sanchez-Beato
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-09-07  9:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]

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.
---
 plugins/push-notification.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index f6ca365..ff388d9 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);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] smsutil: Do not check the origin port
  2015-09-07  9:58 [PATCH 0/3] Accept WAP push notifications with any origin port Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 1/3] push-notification: Accept push from any origin Alfonso Sanchez-Beato
@ 2015-09-07  9:58 ` Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 3/3] sms: Add trace when datagram is not delivered Alfonso Sanchez-Beato
  2015-09-08 14:14 ` [PATCH 0/3] Accept WAP push notifications with any origin port Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-09-07  9:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

Do not check if the origin port is reserved, as some operators use that
range of values.
---
 src/smsutil.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/smsutil.c b/src/smsutil.c
index 9406a8a..19e2016 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -1946,9 +1946,6 @@ static gboolean extract_app_port_common(struct sms_udh_iter *iter, int *dst,
 			if (((addr_hdr[0] << 8) | addr_hdr[1]) > 49151)
 				break;
 
-			if (((addr_hdr[2] << 8) | addr_hdr[3]) > 49151)
-				break;
-
 			dstport = (addr_hdr[0] << 8) | addr_hdr[1];
 			srcport = (addr_hdr[2] << 8) | addr_hdr[3];
 			is_addr_8bit = FALSE;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] sms: Add trace when datagram is not delivered
  2015-09-07  9:58 [PATCH 0/3] Accept WAP push notifications with any origin port Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 1/3] push-notification: Accept push from any origin Alfonso Sanchez-Beato
  2015-09-07  9:58 ` [PATCH 2/3] smsutil: Do not check the origin port Alfonso Sanchez-Beato
@ 2015-09-07  9:58 ` Alfonso Sanchez-Beato
  2015-09-08 14:14 ` [PATCH 0/3] Accept WAP push notifications with any origin port Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-09-07  9:58 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

---
 src/sms.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/sms.c b/src/sms.c
index 0270029..72972b2 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -1184,6 +1184,7 @@ static void dispatch_app_datagram(struct ofono_sms *sms,
 	ofono_sms_datagram_notify_cb_t notify;
 	struct sms_handler *h;
 	GSList *l;
+	gboolean dispatched = FALSE;
 
 	ts = sms_scts_to_time(scts, &remote);
 	localtime_r(&ts, &local);
@@ -1195,9 +1196,15 @@ static void dispatch_app_datagram(struct ofono_sms *sms,
 		if (!port_equal(dst, h->dst) || !port_equal(src, h->src))
 			continue;
 
+		dispatched = TRUE;
+
 		notify(sender, &remote, &local, dst, src, buf, len,
 			h->item.notify_data);
 	}
+
+	if (!dispatched)
+		ofono_info("Datagram with ports [%d,%d] not delivered",
+								dst, src);
 }
 
 static void dispatch_text_message(struct ofono_sms *sms,
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Accept WAP push notifications with any origin port
  2015-09-07  9:58 [PATCH 0/3] Accept WAP push notifications with any origin port Alfonso Sanchez-Beato
                   ` (2 preceding siblings ...)
  2015-09-07  9:58 ` [PATCH 3/3] sms: Add trace when datagram is not delivered Alfonso Sanchez-Beato
@ 2015-09-08 14:14 ` Denis Kenzior
  3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2015-09-08 14:14 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Hi Alfonso,

On 09/07/2015 04:58 AM, Alfonso Sanchez-Beato wrote:
> Accept WAP push notifications regardless of the origin port, as some
> operators seem to use random ports. The destination port is enough to
> route properly the message.
>
> Alfonso Sanchez-Beato (3):
>    push-notification: Accept push from any origin
>    smsutil: Do not check the origin port
>    sms: Add trace when datagram is not delivered
>
>   plugins/push-notification.c | 25 +++++++------------------
>   src/sms.c                   |  7 +++++++
>   src/smsutil.c               |  3 ---
>   3 files changed, 14 insertions(+), 21 deletions(-)
>

All 3 patches have been applied.  Thanks!

Regards,
-Denis

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-08 14:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-07  9:58 [PATCH 0/3] Accept WAP push notifications with any origin port Alfonso Sanchez-Beato
2015-09-07  9:58 ` [PATCH 1/3] push-notification: Accept push from any origin Alfonso Sanchez-Beato
2015-09-07  9:58 ` [PATCH 2/3] smsutil: Do not check the origin port Alfonso Sanchez-Beato
2015-09-07  9:58 ` [PATCH 3/3] sms: Add trace when datagram is not delivered Alfonso Sanchez-Beato
2015-09-08 14:14 ` [PATCH 0/3] Accept WAP push notifications with any origin port Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox