[23372] trunk/dports/net/libpcap
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 29 22:04:53 PDT 2007
Revision: 23372
http://trac.macosforge.org/projects/macports/changeset/23372
Author: ricci at macports.org
Date: 2007-03-29 22:04:52 -0700 (Thu, 29 Mar 2007)
Log Message:
-----------
Add patch for inet.c to not open 'wlt' devices, thus preventing wireless network
disassociation for some wireless interfaces.
Ticket is #11649, this should resolve it but I don't have a way to test.
Patch idea from matt (at) ucc.asn.au, actual patch derived from nightly libpcap sources.
Modified Paths:
--------------
trunk/dports/net/libpcap/Portfile
Added Paths:
-----------
trunk/dports/net/libpcap/files/patch-inet.c
Modified: trunk/dports/net/libpcap/Portfile
===================================================================
--- trunk/dports/net/libpcap/Portfile 2007-03-30 04:53:38 UTC (rev 23371)
+++ trunk/dports/net/libpcap/Portfile 2007-03-30 05:04:52 UTC (rev 23372)
@@ -3,7 +3,7 @@
PortSystem 1.0
name libpcap
version 0.9.5
-revision 0
+revision 1
categories net
maintainers opendarwin.org at darkart.com
description Packet Capture library
@@ -18,7 +18,8 @@
configure.args --mandir=${prefix}/share/man
configure.env CFLAGS="-I. -dynamic -fno-common -DHAVE_CONFIG_H"
-patchfiles patch-Makefile.in
+patchfiles patch-Makefile.in \
+ patch-inet.c
pre-configure {
reinplace "s/COMPAT_INFO/-compatibility_version $version -current_version $version/" \
Added: trunk/dports/net/libpcap/files/patch-inet.c
===================================================================
--- trunk/dports/net/libpcap/files/patch-inet.c (rev 0)
+++ trunk/dports/net/libpcap/files/patch-inet.c 2007-03-30 05:04:52 UTC (rev 23372)
@@ -0,0 +1,60 @@
+diff -ru work/libpcap-0.9.5/inet.c work.newpatch/libpcap-0.9.5/inet.c
+--- inet.c 2006-01-21 02:46:13.000000000 -0800
++++ inet.c 2007-03-29 21:59:38.000000000 -0700
+@@ -144,7 +144,55 @@
+ * on Solaris; we don't just omit loopback interfaces
+ * becaue you *can* capture on loopback interfaces on some
+ * OSes.
+- */
++ *
++ * We do this check so that interfaces that are
++ * supplied by the interface enumeration mechanism
++ * we're using but that don't support packet capture
++ * aren't included in the list. Loopback interfaces
++ * on Solaris are an example of this; we don't just
++ * omit loopback interfaces on all platforms because
++ * you *can* capture on loopback interfaces on some
++ * OSes.
++ *
++ * On OS X, we don't do this check if the device
++ * name begins with "wlt"; at least some versions
++ * of OS X offer monitor mode capturing by having
++ * a separate "monitor mode" device for each wireless
++ * adapter, rather than by implementing the ioctls
++ * that {Free,Net,Open,DragonFly}BSD provide.
++ * Opening that device puts the adapter into monitor
++ * mode, which, at least for some adapters, causes
++ * them to deassociate from the network with which
++ * they're associated.
++ *
++ * Instead, we try to open the corresponding "en"
++ * device (so that we don't end up with, for users
++ * without sufficient privilege to open capture
++ * devices, a list of adapters that only includes
++ * the wlt devices).
++ */
++#ifdef __APPLE__
++ if (strncmp(name, "wlt", 3) == 0) {
++ char *en_name;
++ size_t en_name_len;
++
++ /*
++ * Try to allocate a buffer for the "en"
++ * device's name.
++ */
++ en_name_len = strlen(name) - 1;
++ en_name = malloc(en_name_len + 1);
++ if (en_name == NULL) {
++ (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
++ "malloc: %s", pcap_strerror(errno));
++ return (-1);
++ }
++ strlcpy(en_name, "en", (en_name_len + 1));
++ strlcat(en_name, (name + 3), (en_name_len + 1));
++ p = pcap_open_live(en_name, 68, 0, 0, errbuf);
++ free(en_name);
++ } else
++#endif /* __APPLE */
+ p = pcap_open_live(name, 68, 0, 0, errbuf);
+ if (p == NULL) {
+ /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070329/8be02f78/attachment.html
More information about the macports-changes
mailing list