about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/if_index.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-07-25 21:19:13 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-07-25 21:19:13 +0000
commit89b4b02f421d2a6d24eb632d9c6977dbe786e6ee (patch)
treecfb4d8f06f24847cb5214a0bb2bc476085415706 /sysdeps/unix/sysv/linux/if_index.c
parent842a39cd1ad9391af7a63a19c87f66a730e027a9 (diff)
downloadglibc-89b4b02f421d2a6d24eb632d9c6977dbe786e6ee.tar.gz
glibc-89b4b02f421d2a6d24eb632d9c6977dbe786e6ee.tar.xz
glibc-89b4b02f421d2a6d24eb632d9c6977dbe786e6ee.zip
Remove pre-2.4.21 Linux kernel support.
Diffstat (limited to 'sysdeps/unix/sysv/linux/if_index.c')
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c83
1 files changed, 1 insertions, 82 deletions
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 3c86bb8654..cf33683925 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -74,90 +74,13 @@ if_freenameindex (struct if_nameindex *ifn)
 libc_hidden_def (if_freenameindex)
 
 
-#if __ASSUME_NETLINK_SUPPORT == 0
-static struct if_nameindex *
-if_nameindex_ioctl (void)
-{
-  int fd = __opensock ();
-  struct ifconf ifc;
-  unsigned int nifs, i;
-  int rq_len;
-  struct if_nameindex *idx = NULL;
-# define RQ_IFS	4
-
-  if (fd < 0)
-    return NULL;
-
-  ifc.ifc_buf = NULL;
-
-  /* We may be able to get the needed buffer size directly, rather than
-     guessing.  */
-  ifc.ifc_buf = NULL;
-  ifc.ifc_len = 0;
-  if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
-    rq_len = RQ_IFS * sizeof (struct ifreq);
-  else
-    rq_len = ifc.ifc_len;
-
-  /* Read all the interfaces out of the kernel.  */
-  ifc.ifc_buf = alloca (rq_len);
-  ifc.ifc_len = rq_len;
-  if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
-    {
-      close_not_cancel_no_status (fd);
-      return NULL;
-    }
-
-  nifs = ifc.ifc_len / sizeof (struct ifreq);
-
-  idx = malloc ((nifs + 1) * sizeof (struct if_nameindex));
-  if (idx == NULL)
-    {
-      close_not_cancel_no_status (fd);
-      __set_errno (ENOBUFS);
-      return NULL;
-    }
-
-  for (i = 0; i < nifs; ++i)
-    {
-      struct ifreq *ifr = &ifc.ifc_req[i];
-      idx[i].if_name = __strdup (ifr->ifr_name);
-      if (idx[i].if_name == NULL
-	  || __ioctl (fd, SIOCGIFINDEX, ifr) < 0)
-	{
-	  int saved_errno = errno;
-	  unsigned int j;
-
-	  for (j =  0; j < i; ++j)
-	    free (idx[j].if_name);
-	  free (idx);
-	  close_not_cancel_no_status (fd);
-	  if (saved_errno == EINVAL)
-	    saved_errno = ENOSYS;
-	  else if (saved_errno == ENOMEM)
-	    saved_errno = ENOBUFS;
-	  __set_errno (saved_errno);
-	  return NULL;
-	}
-      idx[i].if_index = ifr->ifr_ifindex;
-    }
-
-  idx[i].if_index = 0;
-  idx[i].if_name = NULL;
-
-  close_not_cancel_no_status (fd);
-  return idx;
-}
-#endif
-
-
 static struct if_nameindex *
 if_nameindex_netlink (void)
 {
   struct netlink_handle nh = { 0, 0, 0, NULL, NULL };
   struct if_nameindex *idx = NULL;
 
-  if (__no_netlink_support || __netlink_open (&nh) < 0)
+  if (__netlink_open (&nh) < 0)
     return NULL;
 
 
@@ -274,10 +197,6 @@ if_nameindex (void)
   return NULL;
 #else
   struct if_nameindex *result = if_nameindex_netlink ();
-# if __ASSUME_NETLINK_SUPPORT == 0
-  if (__no_netlink_support)
-    result = if_nameindex_ioctl ();
-# endif
   return result;
 #endif
 }