[PATCH] Multiple wdp interfaces in config
Paul P Komkoff Jr <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Department of Fish & Wildlife |
| Message-ID | <[email protected]> |
We have lot of roaming subscribers which had set up their wap clients to pack of well-known IPs. So, to allow them to work I add all these IPs to loopback interface on bearerbox machine and enable direct routing to them at access server. The following patch doing the bearerbox part of work. -- Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key This message represents the official view of the voices in my head
multiple_wdp_interfaces.v2.patch
(text/plain, 3 KB)
# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/02/22 20:59:50+03:00 [email protected] # Add support for multiple wdp interfaces # # gw/bb_udp.c # 2004/02/22 20:59:49+03:00 [email protected] +37 -12 # Add support for multiple wdp interfaces # diff -Nru a/gw/bb_udp.c b/gw/bb_udp.c --- a/gw/bb_udp.c Sun Feb 22 21:49:25 2004 +++ b/gw/bb_udp.c Sun Feb 22 21:49:25 2004 @@ -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; }