From 6a636392d33627944df9d5a9573932cdc0bf6da5 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 29 Feb 2000 23:19:52 +0000 Subject: Rewrote interface type detection logic. The `unnumbered' flag is now per address, not per interface (hence it's ifa->flags & IA_UNNUMBERED) and should be set reliably. IF_MULTIACCESS should be fixed now, but it isn't wise to rely on it on interfaces configured with /30 prefix. --- sysdep/unix/krt-iface.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sysdep/unix') diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c index 8c82ffd..2b774a1 100644 --- a/sysdep/unix/krt-iface.c +++ b/sysdep/unix/krt-iface.c @@ -94,12 +94,15 @@ scan_ifs(struct ifreq *r, int cnt) if (fl & IFF_POINTOPOINT) { - i.flags |= IF_UNNUMBERED; - a.pxlen = BITS_PER_IP_ADDRESS; + a.flags |= IA_UNNUMBERED; if (ioctl(if_scan_sock, SIOCGIFDSTADDR, r) < 0) { err = "SIOCGIFDSTADDR"; goto faulty; } get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &a.opposite, NULL); + a.prefix = a.opposite; + a.pxlen = BITS_PER_IP_ADDRESS; } + else + a.prefix = ipa_and(a.ip, ipa_mkmask(a.pxlen)); if (fl & IFF_LOOPBACK) i.flags |= IF_LOOPBACK | IF_IGNORE; if (1 @@ -107,12 +110,11 @@ scan_ifs(struct ifreq *r, int cnt) && (fl & IFF_MULTICAST) #endif #ifndef CONFIG_UNNUM_MULTICAST - && !(i.flags & IF_UNNUMBERED) + && !(a.flags & IA_UNNUMBERED) #endif ) i.flags |= IF_MULTICAST; - a.prefix = ipa_and(a.ip, ipa_mkmask(a.pxlen)); if (a.pxlen < 32) { a.brd = ipa_or(a.prefix, ipa_not(ipa_mkmask(a.pxlen))); -- cgit v1.2.3