summaryrefslogtreecommitdiffstats
path: root/sysdep/unix/krt-iface.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-06-01 14:58:41 +0200
committerMartin Mares <mj@ucw.cz>2000-06-01 14:58:41 +0200
commit4a91150175268d49a1c17131838e5afad925788b (patch)
tree12e90d13d1942006e02e8a1c97b2d49e84c901ab /sysdep/unix/krt-iface.c
parent0f32f2a65a086561fdfd31d4efdea839ec9ce573 (diff)
downloadbird-4a91150175268d49a1c17131838e5afad925788b.tar
bird-4a91150175268d49a1c17131838e5afad925788b.zip
Updated for new scope handling.
Also, provide proper address scopes in struct ifa.
Diffstat (limited to 'sysdep/unix/krt-iface.c')
-rw-r--r--sysdep/unix/krt-iface.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c
index bd4a40a..ddd70e9 100644
--- a/sysdep/unix/krt-iface.c
+++ b/sysdep/unix/krt-iface.c
@@ -35,7 +35,7 @@ scan_ifs(struct ifreq *r, int cnt)
char *err, *colon;
unsigned fl;
ip_addr netmask;
- int l;
+ int l, scope;
if_start_update();
for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++)
@@ -115,6 +115,14 @@ scan_ifs(struct ifreq *r, int cnt)
)
i.flags |= IF_MULTICAST;
+ scope = ipa_classify(a.ip);
+ if (scope < 0)
+ {
+ log(L_ERR "%s: Invalid address", i.name);
+ goto bad;
+ }
+ a.scope = scope & IADDR_SCOPE_MASK;
+
if (a.pxlen < 32)
{
a.brd = ipa_or(a.prefix, ipa_not(ipa_mkmask(a.pxlen)));
@@ -132,6 +140,7 @@ scan_ifs(struct ifreq *r, int cnt)
}
else
a.brd = a.opposite;
+ a.scope = SCOPE_UNIVERSE;
if (ioctl(if_scan_sock, SIOCGIFMTU, r) < 0)
{ err = "SIOCGIFMTU"; goto faulty; }