This will add support for:
1. Specifying multiple IPs in wdp-interface-name
2. When doing so, wdp replies will be sent from correct source IP
(same that received original request) - this is really needed for some
phones
diff -urN kannel-snapshot/gw/bb_udp.c kannel-snapshot-stingr/gw/bb_udp.c
--- kannel-snapshot/gw/bb_udp.c 2002-04-17 14:58:09.000000000 +0400
+++ kannel-snapshot-stingr/gw/bb_udp.c 2003-11-14 16:36:22.573483000 +0300
@@ -268,6 +268,8 @@
{
Octstr *interface_name;
CfgGroup *grp;
+ char* cIfaces;
+ char* cIf;
int allow_wtls;
if (udp_running) return -1;
@@ -290,13 +292,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 */
+ cIfaces = strdup(octstr_get_cstr(interface_name));
+ cIf = strtok(cIfaces, " ,;");
+ 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!");
@@ -305,6 +312,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, " ,;");
+ }
+ gw_free(cIfaces);
octstr_destroy(interface_name);
@@ -321,8 +331,9 @@
int udp_addwdp(Msg *msg)
{
int i;
- Udpc *udpc;
+ Udpc *udpc, *def_udpc;
+ def_udpc = NULL;
if (!udp_running) return -1;
assert(msg != NULL);
assert(msg_type(msg) == wdp_datagram);
@@ -332,13 +343,23 @@
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;
+ if (octstr_compare(msg->wdp_datagram.source_address,
udp_get_ip(udpc->addr)) == 0)
+ {
+ list_produce(udpc->outgoing_list, msg);
+ list_unlock(udpc_list);
+ return 0;
+ }
}
}
+
+ if (NULL != def_udpc) {
+ list_produce(def_udpc->outgoing_list, msg);
+ list_unlock(udpc_list);
+ return 0;
+ }
+
list_unlock(udpc_list);
return -1;
}
--
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
This message represents the official view of the voices in my head