summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcap-linux.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pcap-linux.c b/pcap-linux.c
index 9b126a3a..0444d574 100644
--- a/pcap-linux.c
+++ b/pcap-linux.c
@@ -1412,8 +1412,7 @@ get_if_ioctl_socket(void)
* kernels without IPv4 support.
*
* AF_INET6 will work *if* you have IPv6 configured into the
- * kernel, but if you don't have AF_INET, you might not have
- * AF_INET6, either.
+ * kernel.
*
* AF_PACKET would work, except that some of these calls should
* work even if you *don't* have capture permission (you should be
@@ -1440,6 +1439,8 @@ get_if_ioctl_socket(void)
* likely to be configured out on a networking-capable system
* than is IP;
*
+ * if that fails, we try an AF_INET6 socket;
+ *
* if that fails, we try an AF_INET socket.
*/
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
@@ -1482,6 +1483,14 @@ get_if_ioctl_socket(void)
}
/*
+ * Now try an AF_INET6 socket.
+ */
+ fd = socket(AF_INET6, SOCK_DGRAM, 0);
+ if (fd != -1) {
+ return (fd);
+ }
+
+ /*
* Now try an AF_INET socket.
*
* XXX - if that fails, is there anything else we should try?