It should return zero on success or -1 on failure, because it's an
operation which attempts to return a value, and so might fail -- as
opposed to a predicate asking a simple boolean question about the world.
No actual harm done, because the code was correct to begin with, but
potentially confusing later.
const struct rtattr *rta;
const struct rtmsg *rtm;
ssize_t n, nn;
const struct rtattr *rta;
const struct rtmsg *rtm;
ssize_t n, nn;
static unsigned long seq = 0x48b4aec4;
/* Open a netlink socket for interrogating the kernel. */
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));
if (rta->rta_type == RTA_GATEWAY) {
assert(RTA_PAYLOAD(rta) <= sizeof(*a));
memcpy(a, RTA_DATA(rta), RTA_PAYLOAD(rta));
* this may be a proxy connection from our NAT, so remember this, and don't
* inspect the remote addresses in the TCP tables.
*/
* 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;
q->ao->addreq(&s[0].addr, &q->s[R].addr))
gwp = 1;