diff options
author | Martin Mares <mj@ucw.cz> | 2000-06-01 12:58:41 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-06-01 12:58:41 +0000 |
commit | 4a91150175268d49a1c17131838e5afad925788b (patch) | |
tree | 12e90d13d1942006e02e8a1c97b2d49e84c901ab /sysdep/unix | |
parent | 0f32f2a65a086561fdfd31d4efdea839ec9ce573 (diff) |
Updated for new scope handling.
Also, provide proper address scopes in struct ifa.
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/krt-iface.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c index bd4a40a7..ddd70e99 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; } |