Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153434117
D9606.id26024.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9606.id26024.diff
View Options
Index: head/lib/libpcap/pcap-netmap.c
===================================================================
--- head/lib/libpcap/pcap-netmap.c
+++ head/lib/libpcap/pcap-netmap.c
@@ -22,6 +22,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#ifdef HAVE_CONFIG_H
@@ -42,24 +44,7 @@
#include "pcap-int.h"
-/*
- * $FreeBSD$
- *
- * This code is meant to build also on other versions of libpcap.
- *
- * older libpcap miss p->priv, use p->md.device instead (and allocate).
- * Also opt.timeout was in md.timeout before.
- * Use #define PCAP_IF_UP to discriminate
- */
-#ifdef PCAP_IF_UP
#define NM_PRIV(p) ((struct pcap_netmap *)(p->priv))
-#define the_timeout opt.timeout
-#else
-#define HAVE_NO_PRIV
-#define NM_PRIV(p) ((struct pcap_netmap *)(p->md.device))
-#define SET_PRIV(p, x) p->md.device = (void *)x
-#define the_timeout md.timeout
-#endif
#if defined (linux)
/* On FreeBSD we use IFF_PPROMISC which is in ifr_flagshigh.
@@ -124,7 +109,7 @@
if (ret != 0)
break;
errno = 0;
- ret = poll(&pfd, 1, p->the_timeout);
+ ret = poll(&pfd, 1, p->opt.timeout);
}
return ret;
}
@@ -197,10 +182,6 @@
}
}
nm_close(d);
-#ifdef HAVE_NO_PRIV
- free(pn);
- SET_PRIV(p, NULL); // unnecessary
-#endif
pcap_cleanup_live_common(p);
}
@@ -216,10 +197,6 @@
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"netmap open: cannot access %s: %s\n",
p->opt.device, pcap_strerror(errno));
-#ifdef HAVE_NO_PRIV
- free(pn);
- SET_PRIV(p, NULL); // unnecessary
-#endif
pcap_cleanup_live_common(p);
return (PCAP_ERROR);
}
@@ -261,23 +238,9 @@
*is_ours = (!strncmp(device, "netmap:", 7) || !strncmp(device, "vale", 4));
if (! *is_ours)
return NULL;
-#ifdef HAVE_NO_PRIV
- {
- void *pn = calloc(1, sizeof(struct pcap_netmap));
- if (pn == NULL)
- return NULL;
- p = pcap_create_common(device, ebuf);
- if (p == NULL) {
- free(pn);
- return NULL;
- }
- SET_PRIV(p, pn);
- }
-#else
p = pcap_create_common(ebuf, sizeof (struct pcap_netmap));
if (p == NULL)
return (NULL);
-#endif
p->activate_op = pcap_netmap_activate;
return (p);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 3:47 AM (13 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31951504
Default Alt Text
D9606.id26024.diff (2 KB)
Attached To
Mode
D9606: Remove compatibility with old libpcap.
Attached
Detach File
Event Timeline
Log In to Comment