diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | zebra/if_ioctl.c | 35 |
2 files changed, 29 insertions, 14 deletions
@@ -2,10 +2,12 @@ * added support for vtysh 'write file' command to write either per-daamon and/or integrated file - * ospfd md5 buffer copying fix + * ospfd md5 buffer copying fix (Greg Troxel) * ospfd md5 sequence number derived from time() - * RIPv1 fixes and improvements - * link state detection (linux) + * RIPv1 fixes and improvements (John Hay) + * link state detection (linux) ([zebra 12269]) + * Generic PtP and RFC3021 interface addressing support + (Frank van Maarseveen) 2002-07-07 Kunihiro Ishiguro <kunihiro@ipinfusion.com> diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 46f53011..c9797996 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -130,14 +130,11 @@ interface_list_ioctl () int if_get_index (struct interface *ifp) { - static int if_fake_index = 1; - -#ifdef HAVE_BROKEN_ALIASES - /* Linux 2.2.X does not provide individual interface index for aliases. */ - ifp->ifindex = if_fake_index++; - return ifp->ifindex; -#else -#ifdef SIOCGIFINDEX +#if defined(HAVE_IF_NAMETOINDEX) + /* Modern systems should have if_nametoindex(3). */ + ifp->ifindex = if_nametoindex(ifp->name); +#elif defined(SIOCGIFINDEX) && !defined(HAVE_BROKEN_ALIASES) + /* Fall-back for older linuxes. */ int ret; struct ifreq ifreq; @@ -157,13 +154,20 @@ if_get_index (struct interface *ifp) #else ifp->ifindex = ifreq.ifr_index; #endif - return ifp->ifindex; #else +/* Linux 2.2.X does not provide individual interface index + for aliases and we know it. For others issue a warning. */ +#if !defined(HAVE_BROKEN_ALIASES) +#warning "Using if_fake_index. You may want to add appropriate" +#warning "mapping from ifname to ifindex for your system..." +#endif + /* This branch probably won't provide usable results, but anyway... */ + static int if_fake_index = 1; ifp->ifindex = if_fake_index++; +#endif + return ifp->ifindex; -#endif /* SIOCGIFINDEX */ -#endif /* HAVE_BROKEN_ALIASES */ } #ifdef SIOCGIFHWADDR @@ -287,6 +291,15 @@ if_getaddrs () } } +#if defined(KAME) + if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) + { + addr->sin6_scope_id = + ntohs(*(u_int16_t *)&addr->sin6_addr.s6_addr[2]); + addr->sin6_addr.s6_addr[2] = addr->sin6_addr.s6_addr[3] = 0; + } +#endif + connected_add_ipv6 (ifp, &addr->sin6_addr, prefixlen, dest_pnt); } #endif /* HAVE_IPV6 */ |