mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-19 00:13:33 +00:00
net/trafshow: unbreak for FreeBSD 14
Modern libpcap got its own pcap_init() function, so rename trafshow's private one to ts_pcap_init().
This commit is contained in:
parent
824f0617e7
commit
2cda71d98a
@ -1,5 +1,5 @@
|
||||
--- trafshow.c.orig Wed Apr 12 00:10:18 2006
|
||||
+++ trafshow.c Wed Apr 12 00:12:49 2006
|
||||
--- trafshow.c.orig 2023-06-13 16:53:56.932059000 +0700
|
||||
+++ trafshow.c 2023-06-13 16:57:12.824618000 +0700
|
||||
@@ -20,6 +20,7 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
@ -8,7 +8,34 @@
|
||||
#ifdef HAVE_PCAP_GET_SELECTABLE_FD
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
@@ -307,6 +308,7 @@
|
||||
@@ -59,7 +60,7 @@ static pcap_if_t *pcap_matchdev(pcap_if_t *dp, const c
|
||||
static void vers();
|
||||
static void usage();
|
||||
static pcap_if_t *pcap_matchdev(pcap_if_t *dp, const char *name);
|
||||
-static int pcap_init(PCAP_HANDLER **ph_list, pcap_if_t *dp);
|
||||
+static int ts_pcap_init(PCAP_HANDLER **ph_list, pcap_if_t *dp);
|
||||
static void *pcap_feed(void *arg); /* PCAP_HANDLER *ph */
|
||||
#ifdef HAVE_PCAP_GET_SELECTABLE_FD
|
||||
static void *pcap_feed2(void *arg); /* PCAP_HANDLER *ph */
|
||||
@@ -173,7 +174,7 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
/* initialize list of pcap handlers */
|
||||
- if ((op = pcap_init(&ph_list, dev_list)) < 1) {
|
||||
+ if ((op = ts_pcap_init(&ph_list, dev_list)) < 1) {
|
||||
fprintf(stderr, "No packet capture device available (no permission?)\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -299,7 +300,7 @@ static int
|
||||
}
|
||||
|
||||
static int
|
||||
-pcap_init(ph_list, dp)
|
||||
+ts_pcap_init(ph_list, dp)
|
||||
PCAP_HANDLER **ph_list;
|
||||
pcap_if_t *dp;
|
||||
{
|
||||
@@ -308,6 +309,7 @@ pcap_init(ph_list, dp)
|
||||
const pcap_addr_t *ap;
|
||||
PCAP_HANDLER *ph, *ph_prev = 0;
|
||||
char *cp, buf[256];
|
||||
@ -16,16 +43,16 @@
|
||||
|
||||
if (!ph_list) return -1;
|
||||
|
||||
@@ -334,6 +336,12 @@
|
||||
@@ -339,6 +341,12 @@ pcap_init(ph_list, dp)
|
||||
err++;
|
||||
continue;
|
||||
}
|
||||
if (pcap_setnonblock(pd, 1, buf) < 0) {
|
||||
fprintf(stderr, "%s: %s\n", dp->name, buf);
|
||||
+ if (ioctl(pcap_fileno(pd), BIOCIMMEDIATE, &v) < 0) {
|
||||
+ fprintf(stderr, "%s: %s\n", dp->name, strerror(errno));
|
||||
+ pcap_close(pd);
|
||||
+ err++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (ioctl(pcap_fileno(pd), BIOCIMMEDIATE, &v) < 0) {
|
||||
+ fprintf(stderr, "%s: %s\n", dp->name, strerror(errno));
|
||||
pcap_close(pd);
|
||||
err++;
|
||||
continue;
|
||||
if ((ph = (PCAP_HANDLER *)malloc(sizeof(PCAP_HANDLER))) == 0) {
|
||||
perror("malloc");
|
||||
exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user