summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c10
-rw-r--r--sysdep/linux/netlink/netlink.c6
-rw-r--r--sysdep/unix/krt-iface.c8
3 files changed, 20 insertions, 4 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 4817df3..12ebe6d 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -546,7 +546,17 @@ krt_read_addr(struct ks_msg *msg)
#endif
if (iface->flags & IF_MULTIACCESS)
+ {
ifa.prefix = ipa_and(ifa.ip, ipa_mkmask(masklen));
+
+ if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 1)
+ ifa.opposite = ipa_opposite_m1(ifa.ip);
+
+#ifndef IPV6
+ if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 2)
+ ifa.opposite = ipa_opposite_m2(ifa.ip);
+#endif
+ }
else /* PtP iface */
{
ifa.flags |= IA_UNNUMBERED;
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index aa0f2c4..72f06cc 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -390,9 +390,13 @@ nl_parse_addr(struct nlmsghdr *h)
ip_addr netmask = ipa_mkmask(ifa.pxlen);
ifa.prefix = ipa_and(ifa.ip, netmask);
ifa.brd = ipa_or(ifa.ip, ipa_not(netmask));
+ if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 1)
+ ifa.opposite = ipa_opposite_m1(ifa.ip);
+
#ifndef IPV6
if (i->ifa_prefixlen == BITS_PER_IP_ADDRESS - 2)
- ifa.opposite = ipa_opposite(ifa.ip, i->ifa_prefixlen);
+ ifa.opposite = ipa_opposite_m2(ifa.ip);
+
if ((ifi->flags & IF_BROADCAST) && a[IFA_BROADCAST])
{
ip_addr xbrd;
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;