summaryrefslogtreecommitdiffstats
path: root/sysdep/unix/krt-iface.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-12-16 14:23:32 +0100
committerMartin Mares <mj@ucw.cz>1999-12-16 14:23:32 +0100
commite693ddff874890a9e5c990f6ca75d2e2358d065a (patch)
tree395c4df617d629e307ee43982642639bca8b079f /sysdep/unix/krt-iface.c
parent3f996d46df3cf1bdbefe0b0b0f5245c76b12756b (diff)
downloadbird-e693ddff874890a9e5c990f6ca75d2e2358d065a.tar
bird-e693ddff874890a9e5c990f6ca75d2e2358d065a.zip
Handle cases when SIOCGIFINDEX is defined, but doesn't work (new glibc
with 2.0 kernels).
Diffstat (limited to 'sysdep/unix/krt-iface.c')
-rw-r--r--sysdep/unix/krt-iface.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sysdep/unix/krt-iface.c b/sysdep/unix/krt-iface.c
index 3a50e8b..e9df6e4 100644
--- a/sysdep/unix/krt-iface.c
+++ b/sysdep/unix/krt-iface.c
@@ -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)