Re: Issue with Kannel as a wap gateway

Paul P Komkoff Jr <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Department of Fish & Wildlife
Message-ID <[email protected]>
Replying to Stipe Tolj:
> have you posted the patch to the devel@ list?! If no, please do, so we
> can review and commit to cvs.

Stipe!

For a long time I'm only posting and posting patches to devel list,
and noone paying attention to it.

attached split-up of bb_udp only change, which should do multiple wdp
interfaces trick.

-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head
bb_udp-only.patch (text/plain, 2.7 KB)
--- ../gateway/gw/bb_udp.c	2004-01-22 17:08:24.000000000 +0300
+++ am3/gw/bb_udp.c	2004-05-06 13:42:36.608966019 +0400
@@ -324,6 +324,8 @@
 {
     Octstr *interface_name;
     CfgGroup *grp;
+    Octstr *Ifaces;
+    char* cIf;
     int allow_wtls;
     
     if (udp_running) return -1;
@@ -346,13 +348,18 @@
 
     udpc_list = list_create();	/* have a list of running systems */
 
-    add_service(9200, octstr_get_cstr(interface_name));	   /* wsp 	*/
-    add_service(9201, octstr_get_cstr(interface_name));	   /* wsp/wtp	*/
+    Ifaces = octstr_duplicate(interface_name);
+    cIf = strtok(octstr_get_cstr(Ifaces), " ,;");
+    while (cIf != NULL) {
+	info(0, "Adding interface %s", cIf);
+        add_service(9200, cIf);	   /* wsp 	*/
+        add_service(9201, cIf);	   /* wsp/wtp	*/
+    
 #ifdef HAVE_WTLS_OPENSSL
-    if (allow_wtls) {
-        add_service(9202, octstr_get_cstr(interface_name));    /* wsp/wtls	*/
-        add_service(9203, octstr_get_cstr(interface_name));    /* wsp/wtp/wtls */
-    }
+        if (allow_wtls) {
+             add_service(9202, cIf);    /* wsp/wtls	*/
+             add_service(9203, cIf);    /* wsp/wtp/wtls */
+        }
 #else
     if (allow_wtls)
     	error(0, "These is a 'wtls' group in configuration, but no WTLS support compiled in!");
@@ -361,6 +368,9 @@
     /* add_service(9205, octstr_get_cstr(interface_name));  * vcal	*/
     /* add_service(9206, octstr_get_cstr(interface_name));  * vcard/wtls */
     /* add_service(9207, octstr_get_cstr(interface_name));  * vcal/wtls	*/
+        cIf = strtok(NULL, " ,;");
+    }
+    octstr_destroy(Ifaces);
     
     octstr_destroy(interface_name);
     
@@ -377,8 +387,10 @@
 int udp_addwdp(Msg *msg)
 {
     int i;
-    Udpc *udpc;
+    Udpc *udpc, *def_udpc;
+    Octstr *ip;
     
+    def_udpc = NULL;
     if (!udp_running) return -1;
     assert(msg != NULL);
     assert(msg_type(msg) == wdp_datagram);
@@ -388,13 +400,26 @@
     for (i=0; i < list_len(udpc_list); i++) {
 		udpc = list_get(udpc_list, i);
 
-		if (msg->wdp_datagram.source_port == udp_get_port(udpc->addr))
-		{
-	    	list_produce(udpc->outgoing_list, msg);
-	    	list_unlock(udpc_list);
-	    	return 0;
+		if (msg->wdp_datagram.source_port == udp_get_port(udpc->addr)) {
+			def_udpc = udpc;
+                        ip = udp_get_ip(udpc->addr);
+			if (octstr_compare(msg->wdp_datagram.source_address, ip) == 0)
+			{
+                                octstr_destroy(ip);
+	    			list_produce(udpc->outgoing_list, msg);
+	    			list_unlock(udpc_list);
+	    			return 0;
+			}
+                        octstr_destroy(ip);
 		}
     }
+
+    if (NULL != def_udpc) {
+	list_produce(def_udpc->outgoing_list, msg);
+	list_unlock(udpc_list);
+	return 0;
+    }
+
     list_unlock(udpc_list);
     return -1;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.