summaryrefslogtreecommitdiff
path: root/sysdep/unix
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-02-29 23:19:52 +0000
committerMartin Mares <mj@ucw.cz>2000-02-29 23:19:52 +0000
commit6a636392d33627944df9d5a9573932cdc0bf6da5 (patch)
tree9e689378151af5a882085356ba7d3bb3ebabcbbb /sysdep/unix
parente69e4ed9349ee28262fe74f70e7e52c181d5d098 (diff)
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.
Diffstat (limited to 'sysdep/unix')
-rw-r--r--sysdep/unix/krt-iface.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c
index 8c82ffdf..2b774a13 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)));