]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Handle cases when SIOCGIFINDEX is defined, but doesn't work (new glibc
authorMartin Mares <mj@ucw.cz>
Thu, 16 Dec 1999 13:23:32 +0000 (13:23 +0000)
committerMartin Mares <mj@ucw.cz>
Thu, 16 Dec 1999 13:23:32 +0000 (13:23 +0000)
with 2.0 kernels).

TODO
sysdep/unix/krt-iface.c

diff --git a/TODO b/TODO
index 2c0a02275e77ce463386a7b53b4131b8b74f31e7..475c545f4f85b158389387412899e366bf30aeff 100644 (file)
--- a/TODO
+++ b/TODO
@@ -17,8 +17,6 @@ Core
 
 - netlink: import Linux route attributes to our rta's, so that they can be filtered?
 
-- iface: SIOCGIFINDEX exists on glibc systems, but it doesn't work on 2.0.x kernels!
-
 - socket: Use IP_RECVERR for BGP TCP sockets?
 
 - config: executable config files
index 3a50e8b213837e411980342fe503a022f8f12823..e9df6e433d729a0a5c852221094032aab4b8bcd1 100644 (file)
@@ -36,11 +36,11 @@ scan_ifs(struct ifreq *r, int cnt)
   unsigned fl;
   ip_addr netmask;
   int l;
-  int sec = 0;
 
   if_start_update();
   for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++)
     {
+      int sec = 0;
       bzero(&i, sizeof(i));
       bzero(&a, sizeof(a));
       DBG("%s\n", r->ifr_name);
@@ -136,11 +136,12 @@ scan_ifs(struct ifreq *r, int cnt)
       i.mtu = r->ifr_mtu;
 
 #ifdef SIOCGIFINDEX
-      if (ioctl(if_scan_sock, SIOCGIFINDEX, r) < 0)
-       DBG("SIOCGIFINDEX failed: %m\n");
-      else
+      if (ioctl(if_scan_sock, SIOCGIFINDEX, r) >= 0)
        i.index = r->ifr_ifindex;
-#else
+      else if (errno != -EINVAL)
+       DBG("SIOCGIFINDEX failed: %m\n");
+      else     /* defined, but not supported by the kernel */
+#endif
       /*
        *  The kernel doesn't give us real ifindices, but we still need them
        *  at least for OSPF unnumbered links. So let's make them up ourselves.
@@ -152,7 +153,6 @@ scan_ifs(struct ifreq *r, int cnt)
          static int if_index_counter = 1;
          i.index = if_index_counter++;
        }
-#endif
 
       pi = NULL;
       if (sec)