diff options
author | Eugene Grosbein <eugen@FreeBSD.org> | 2023-06-13 10:05:07 +0000 |
---|---|---|
committer | Eugene Grosbein <eugen@FreeBSD.org> | 2023-06-13 10:07:17 +0000 |
commit | 2cda71d98af01f78fb0da7acab2818ea6bed576e (patch) | |
tree | 494269d9e14d5fce997c53df96e97131712495ae | |
parent | 824f0617e7e84bc8acc0eb575f8f778f8a666d52 (diff) | |
download | ports-2cda71d98af01f78fb0da7acab2818ea6bed576e.tar.gz ports-2cda71d98af01f78fb0da7acab2818ea6bed576e.zip |
-rw-r--r-- | net/trafshow/files/patch-trafshow.c | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/net/trafshow/files/patch-trafshow.c b/net/trafshow/files/patch-trafshow.c index a5a92eaf6118..9cb11dbec8d8 100644 --- a/net/trafshow/files/patch-trafshow.c +++ b/net/trafshow/files/patch-trafshow.c @@ -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); |