]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Michal Ludvig <michal@logix.cz>
authorpaul <paul>
Fri, 13 Dec 2002 21:19:02 +0000 (21:19 +0000)
committerpaul <paul>
Fri, 13 Dec 2002 21:19:02 +0000 (21:19 +0000)
[zebra 16525] PATCH: Bugfixes for KAME systems

ChangeLog
zebra/if_ioctl.c

index 671561146f54972d0a481cea9d4f00660991ef5a..a9e081224f8b2b43ce100aa3356577617b17a753 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
index 46f530114cecb7aa15579ad19305393be5fa1f0d..c97979960ef51101bcddf6771a3b22e719eaca91 100644 (file)
@@ -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 */