git: 2cda71d98af0 - main - net/trafshow: unbreak for FreeBSD 14
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Jun 2023 10:08:36 UTC
The branch main has been updated by eugen: URL: https://cgit.FreeBSD.org/ports/commit/?id=2cda71d98af01f78fb0da7acab2818ea6bed576e commit 2cda71d98af01f78fb0da7acab2818ea6bed576e Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2023-06-13 10:05:07 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2023-06-13 10:07:17 +0000 net/trafshow: unbreak for FreeBSD 14 Modern libpcap got its own pcap_init() function, so rename trafshow's private one to ts_pcap_init(). --- net/trafshow/files/patch-trafshow.c | 49 ++++++++++++++++++++++++++++--------- 1 file 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);