summaryrefslogtreecommitdiff
path: root/libc/inet/netlinkaccess.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-01-06 04:57:40 +0000
committerMike Frysinger <vapier@gentoo.org>2006-01-06 04:57:40 +0000
commitc47542925c44be2522adb442f268506dee9f34a7 (patch)
treebec955a1c15c5a41ca6c3a6fc3fc3c59f75e0f24 /libc/inet/netlinkaccess.h
parentd2d573391d1cb10aa4f9ac4125741810354dd740 (diff)
as weber notes in Bug 99:
if_nameindex doesnt list all of my interfaces! this is because we are still using the old style ioctl(SIOCGIFINDEX) for gathering interface names/indexes. while this code is pretty small, the kernel does not return all interfaces via this method. so we import the new style netlink code from glibc and make it optional so those people who need the full functionality can get it.
Diffstat (limited to 'libc/inet/netlinkaccess.h')
-rw-r--r--libc/inet/netlinkaccess.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/libc/inet/netlinkaccess.h b/libc/inet/netlinkaccess.h
new file mode 100644
index 000000000..12269bfcf
--- /dev/null
+++ b/libc/inet/netlinkaccess.h
@@ -0,0 +1,69 @@
+/* Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _NETLINKACCESS_H
+#define _NETLINKACCESS_H 1
+
+#include <features.h>
+#include <stdint.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+/* Should prob be a configure option or something */
+#ifdef __UCLIBC_USE_NETLINK__
+# define __ASSUME_NETLINK_SUPPORT 1
+#else
+# define __ASSUME_NETLINK_SUPPORT 0
+#endif
+
+
+struct netlink_res
+{
+ struct netlink_res *next;
+ struct nlmsghdr *nlh;
+ size_t size; /* Size of response. */
+ uint32_t seq; /* sequential number we used. */
+};
+
+
+struct netlink_handle
+{
+ int fd; /* Netlink file descriptor. */
+ pid_t pid; /* Process ID. */
+ uint32_t seq; /* The sequence number we use currently. */
+ struct netlink_res *nlm_list; /* Pointer to list of responses. */
+ struct netlink_res *end_ptr; /* For faster append of new entries. */
+};
+
+
+#if 0 /* unused code */
+#if __ASSUME_NETLINK_SUPPORT == 0
+extern int __no_netlink_support attribute_hidden;
+#else
+# define __no_netlink_support 0
+#endif
+#endif /* unused code */
+
+
+extern int __netlink_open (struct netlink_handle *h) attribute_hidden;
+extern void __netlink_close (struct netlink_handle *h) attribute_hidden;
+extern void __netlink_free_handle (struct netlink_handle *h) attribute_hidden;
+extern int __netlink_request (struct netlink_handle *h, int type) attribute_hidden;
+
+
+#endif /* netlinkaccess.h */