From ba321706578de8402d50214a9e79a65835cdd821 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 28 Apr 2010 00:39:57 +0200 Subject: Better support for /31 networks. --- sysdep/unix/krt-iface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sysdep/unix/krt-iface.c') diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c index e0158b6..5fda0d1 100644 --- a/sysdep/unix/krt-iface.c +++ b/sysdep/unix/krt-iface.c @@ -89,7 +89,7 @@ scan_ifs(struct ifreq *r, int cnt) { err = "SIOCGIFNETMASK"; goto faulty; } get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &netmask, NULL, 0); l = ipa_mklen(netmask); - if (l < 0 || l == 31) + if (l < 0) { log(L_ERR "%s: Invalid netmask (%x)", i.name, netmask); goto bad; @@ -139,8 +139,10 @@ scan_ifs(struct ifreq *r, int cnt) i.flags |= IF_BROADCAST; if (a.pxlen < 30) i.flags |= IF_MULTIACCESS; - else - a.opposite = ipa_opposite(a.ip, a.pxlen); + if (a.pxlen == 30) + ifa.opposite = ipa_opposite_m2(ifa.ip); + if (a.pxlen == 31) + ifa.opposite = ipa_opposite_m1(ifa.ip); } else a.brd = a.opposite; -- cgit v1.2.3