--- a/libpurple/nat-pmp.c Mon Aug 15 04:16:23 2011 +0000
+++ b/libpurple/nat-pmp.c Mon Aug 15 04:18:59 2011 +0000
@@ -177,43 +177,43 @@
- char *buf, *next, *lim;
+ char *buf, *next, *lim; struct sockaddr_in *sin = NULL;
- mib[1] = PF_ROUTE; /* entire routing table or a subset of it */
- mib[2] = 0; /* protocol number - always 0 */
- mib[3] = 0; /* address family - 0 for all addres families */
+ mib[1] = PF_ROUTE; /* entire routing table or a subset of it */ + mib[2] = 0; /* protocol number - always 0 */ + mib[3] = 0; /* address family - 0 for all addres families */ /* Determine the buffer side needed to get the full routing table */
- if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump estimate\n");
- if (!(buf = malloc(needed)))
+ if (!(buf = malloc(needed))) purple_debug_warning("nat-pmp", "Failed to malloc %" G_GSIZE_FORMAT "\n", needed);
/* Read the routing table into buf */
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)
+ if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump\n");
- for (next = buf; next < lim; next += rtm->rtm_msglen)
+ for (next = buf; next < lim; next += rtm->rtm_msglen) rtm = (struct rt_msghdr *)next;
sa = (struct sockaddr *)(rtm + 1);
@@ -226,7 +226,7 @@
&& cursin->sin_addr.s_addr == INADDR_ANY)
/* We found the default route. Now get the destination address and netmask. */
- struct sockaddr *rti_info[RTAX_MAX];
+ struct sockaddr *rti_info[RTAX_MAX]; struct sockaddr addr, mask;
get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
@@ -257,7 +257,7 @@