y = 0;
for (j = 0; j < 8; j++) {
if ('0' <= *p && *p <= '9') x = *p - '0';
- else if ('a' <= *p && *p <= 'f') x = *p - 'a'+ 10;
- else if ('A' <= *p && *p <= 'F') x = *p - 'A'+ 10;
+ else if ('a' <= *p && *p <= 'f') x = *p - 'a' + 10;
+ else if ('A' <= *p && *p <= 'F') x = *p - 'A' + 10;
else return (-1);
y = (y << 4) | x;
p++;
const struct rtattr *rta;
const struct rtmsg *rtm;
ssize_t n, nn;
- int rc = 0;
+ int rc = -1;
static unsigned long seq = 0x48b4aec4;
/* Open a netlink socket for interrogating the kernel. */
if (rta->rta_type == RTA_GATEWAY) {
assert(RTA_PAYLOAD(rta) <= sizeof(*a));
memcpy(a, RTA_DATA(rta), RTA_PAYLOAD(rta));
- rc = 1;
+ rc = 0;
}
}
}
* this may be a proxy connection from our NAT, so remember this, and don't
* inspect the remote addresses in the TCP tables.
*/
- if (get_default_gw(q->ao->af, &s[0].addr) &&
+ if (!get_default_gw(q->ao->af, &s[0].addr) &&
q->ao->addreq(&s[0].addr, &q->s[R].addr))
gwp = 1;
}
}
-#ifdef notdef
+#ifdef DEBUG
{
/* Print the record we found. */
dstr dd = DSTR_INIT;
/* Initialize the system-specific code. */
void init_sys(void)
{
+ /* Open the NAT connection map. */
if ((natfp = fopen("/proc/net/nf_conntrack", "r")) == 0 &&
errno != ENOENT) {
die(1, "failed to open `/proc/net/nf_conntrack' for reading: %s",