PERFORCE change 114188 for review
Christian S.J. Peron
csjp at FreeBSD.org
Wed Feb 7 17:23:11 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=114188
Change 114188 by csjp at csjp_rnd01 on 2007/02/07 17:22:19
Dont try to free a pointer which references packets within
mmaped pages. This explains why things seemed to randomly
segfault on SIGINT
Affected files ...
.. //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#7 edit
Differences ...
==== //depot/projects/zcopybpf/src/contrib/libpcap/pcap-bpf.c#7 (text+ko) ====
@@ -1245,9 +1245,17 @@
munmap(p->zbuf1, v);
if (p->zbuf2 != NULL)
munmap(p->zbuf2, v);
-#endif
+ /*
+ * If we are using zerocopy, the packet buffer will be referencing
+ * an address in one of the shared pages, if any. In which case
+ * we will not free it.
+ */
+ if (getenv("BPF_ZERO_COPY") == NULL && p->buffer != NULL)
+ free(p->buffer);
+#else
if (p->buffer != NULL)
free(p->buffer);
+#endif
if (p->dlt_list != NULL)
free(p->dlt_list);
free(p);
More information about the p4-projects
mailing list