Re: Issue with Kannel as a wap gateway

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Centrium GmbH
Message-ID <[email protected]>
Hi Paul,

I personally don't like strXX functions family if I can avoid this :)
Please check attached patch and if it ok then I will commit it to cvs...

Btw. would you care for userguide patch, due to config option change?

Thanks in advance.

On Thursday 06 May 2004 13:42, Paul P Komkoff Jr wrote:
> 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.

-- 
Best regards / Mit besten Grüßen aus Düsseldorf

Dipl.-Ing.
Alexander Malysh
___________________________________________

Centrium GmbH
Vogelsanger Weg 80
40470 Düsseldorf

Fon: +49 (0211) 74 84 51 80
Fax: +49 (0211) 277 49 109

email: a.malysh (at) centrium.de
web: www.centrium.de
msn: a.malysh (at) centrium.de
icq: 98063111
___________________________________________

Please avoid sending me Word, Excel or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
bb_udp.patch (text/x-diff, 3.7 KB)
Index: gw/bb_udp.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_udp.c,v
retrieving revision 1.32
diff -a -u -r1.32 bb_udp.c
--- gw/bb_udp.c	22 Jan 2004 14:08:24 -0000	1.32
+++ gw/bb_udp.c	13 May 2004 21:33:58 -0000
@@ -322,8 +322,9 @@
 
 int udp_start(Cfg *cfg)
 {
-    Octstr *interface_name;
     CfgGroup *grp;
+    Octstr *iface;
+    List *ifs;
     int allow_wtls;
     
     if (udp_running) return -1;
@@ -331,8 +332,8 @@
     debug("bb.udp", 0, "starting UDP sender/receiver module");
 
     grp = cfg_get_single_group(cfg, octstr_imm("core"));
-    interface_name = cfg_get(grp, octstr_imm("wdp-interface-name"));
-    if (interface_name == NULL) {
+    iface = cfg_get(grp, octstr_imm("wdp-interface-name"));
+    if (iface == NULL) {
         error(0, "Missing wdp-interface-name variable, cannot start UDP");
         return -1;
     }
@@ -346,23 +347,30 @@
 
     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	*/
+    ifs = octstr_split(iface, octstr_imm(";"));
+    octstr_destroy(iface);
+    while (list_len(ifs) > 0) {
+        iface = list_extract_first(ifs);
+	info(0, "Adding interface %s", octstr_get_cstr(iface));
+        add_service(9200, octstr_get_cstr(iface));   /* wsp 	*/
+        add_service(9201, octstr_get_cstr(iface));   /* 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, octstr_get_cstr(iface));   /* wsp/wtls	*/
+             add_service(9203, octstr_get_cstr(iface));   /* wsp/wtp/wtls */
+        }
 #else
-    if (allow_wtls)
-    	error(0, "These is a 'wtls' group in configuration, but no WTLS support compiled in!");
+        if (allow_wtls)
+    	     error(0, "These is a 'wtls' group in configuration, but no WTLS support compiled in!");
 #endif
     /* add_service(9204, octstr_get_cstr(interface_name));  * vcard	*/
     /* 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	*/
-    
-    octstr_destroy(interface_name);
+        octstr_destroy(iface);
+    }
+    list_destroy(ifs, NULL);
     
     list_add_producer(incoming_wdp);
     udp_running = 1;
@@ -377,8 +385,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 +398,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;
 }
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAo+sznX3e5W+uJ0ERAl8cAJ4ngAj9cLXlPXrS9J/yJWYO5vfdUACeOxme
HpJzP9PoLFMVl0sYK6SXp9E=
=xb+P
-----END PGP SIGNATURE-----
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.