diff options
Diffstat (limited to 'sysutils/pftop/patches')
-rw-r--r-- | sysutils/pftop/patches/patch-aa | 39 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ab | 449 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ac | 43 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ad | 261 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ae | 28 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-af | 12 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ag | 120 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ah | 53 | ||||
-rw-r--r-- | sysutils/pftop/patches/patch-ai | 33 |
9 files changed, 567 insertions, 471 deletions
diff --git a/sysutils/pftop/patches/patch-aa b/sysutils/pftop/patches/patch-aa index c33f4881f2c..b4499afbf43 100644 --- a/sysutils/pftop/patches/patch-aa +++ b/sysutils/pftop/patches/patch-aa @@ -1,15 +1,28 @@ -$NetBSD: patch-aa,v 1.1.1.1 2004/11/05 15:08:33 peter Exp $ +$NetBSD: patch-aa,v 1.2 2008/06/15 14:09:03 peter Exp $ ---- config.h.orig 2003-08-05 03:19:58.000000000 +0200 -+++ config.h 2004-10-25 13:20:55.000000000 +0200 -@@ -24,8 +24,8 @@ - #if OS_LEVEL > 32 - #define HAVE_ADDR_MASK - #define HAVE_ADDR_TYPE --#define HAVE_ALTQ --#define HAVE_RULE_ANCHOR -+/*#define HAVE_ALTQ*/ -+/*#define HAVE_RULE_ANCHOR*/ - #define HAVE_RULE_TOS - #endif +--- Makefile.old 2007-11-07 07:34:18.000000000 +0100 ++++ Makefile 2008-06-15 00:43:41.000000000 +0200 +@@ -6,17 +6,21 @@ + PROG= pftop + SRCS= pftop.c cache.c engine.c +-SRCS+= sf-gencode.c sf-grammer.y sf-scanner.l pcap-nametoaddr.c ++SRCS+= sf-gencode.c sf-grammer.c sf-scanner.l pcap-nametoaddr.c + SRCS+= bpf_optimize.c bpf_filter.c bpf_dump.c bpf_image.c + MAN= pftop.8 + ++CLEANFILES+= sf-grammer.c ++ + CFLAGS+= -Wall -DOS_LEVEL=${OSLEVEL} + LDADD+= -lcurses + ++NOGCCERROR=yes ++ + MANDIR=${LOCALBASE}/man/cat + BINDIR=${LOCALBASE}/sbin + +-.y.c: ++sf-grammer.c: sf-grammer.y + ${YACC.y} -d -b ${.TARGET:R} -o ${.TARGET} ${.IMPSRC} + + .include <bsd.prog.mk> diff --git a/sysutils/pftop/patches/patch-ab b/sysutils/pftop/patches/patch-ab index bbd435f582c..a2b5a7a58cc 100644 --- a/sysutils/pftop/patches/patch-ab +++ b/sysutils/pftop/patches/patch-ab @@ -1,449 +1,24 @@ -$NetBSD: patch-ab,v 1.4 2006/03/06 23:02:08 peter Exp $ +$NetBSD: patch-ab,v 1.5 2008/06/15 14:09:03 peter Exp $ ---- pftop.c.orig 2003-08-05 03:20:39.000000000 +0200 -+++ pftop.c 2006-03-06 23:52:20.000000000 +0100 -@@ -31,6 +31,11 @@ - */ - #include "config.h" - -+#ifdef __NetBSD__ -+#include <sys/param.h> -+#include <sys/syslimits.h> -+#endif -+ - #include <sys/types.h> - #include <sys/ioctl.h> - #include <sys/socket.h> -@@ -39,7 +44,11 @@ +--- cache.c.old 2008-06-14 17:43:59.000000000 +0200 ++++ cache.c 2008-06-15 01:15:37.000000000 +0200 +@@ -23,7 +23,11 @@ #include <netinet/in.h> - #define TCPSTATES + #include <netinet/tcp_fsm.h> +#ifdef __DragonFly__ +#include <net/pf/pfvar.h> +#else #include <net/pfvar.h> -+#endif ++#endif /* !__DragonFly__ */ #include <arpa/inet.h> - #ifdef HAVE_ALTQ -@@ -54,7 +63,9 @@ - #include <err.h> - #include <errno.h> - #include <fcntl.h> -+#include <limits.h> - #include <netdb.h> -+#include <poll.h> - #include <signal.h> #include <stdio.h> - #include <stdlib.h> -@@ -192,9 +203,6 @@ - - volatile sig_atomic_t gotsig_close = 0; - volatile sig_atomic_t gotsig_resize = 0; --volatile sig_atomic_t gotsig_alarm = 0; --int need_update = 0; --int need_sort = 0; - - #define FLD_ALIGN_LEFT 0 - #define FLD_ALIGN_RIGHT 1 -@@ -506,7 +514,6 @@ - - int - tbprintf(char *format, ...) -- GCC_PRINTFLIKE(1,2) /* defined in curses.h */ - { - int len; - va_list arg; -@@ -543,6 +550,10 @@ - } - } - -+#ifndef MIN -+#define MIN(x,y) ((x) < (y) ? (x) : (y)) -+#endif -+ - void - print_str(int len, const char *str) - { -@@ -758,7 +769,6 @@ - } - - if ((curr_view != NULL) && (curr_view->mgr != v->mgr)) { -- gotsig_alarm = 1; - if (v->mgr != NULL && v->mgr->select_fn != NULL) - v->mgr->select_fn(); - } -@@ -766,7 +776,6 @@ - curr_view = v; - curr_mgr = v->mgr; - field_setup(); -- need_update = 1; - } - - void -@@ -849,11 +858,9 @@ - if (cachestates) { - show_field(FLD_SI); - show_field(FLD_SP); -- gotsig_alarm = 1; - } else { - hide_field(FLD_SI); - hide_field(FLD_SP); -- need_update = 1; - } - field_setup(); - } -@@ -1212,7 +1219,7 @@ - ps.ps_buf = (char *) state_buf; - - if (ioctl(dev, DIOCGETSTATES, &ps) < 0) { -- errx(1, "DIOCGETSTATES"); -+ err(1, "DIOCGETSTATES"); - } - num_states = ps.ps_len / sizeof(struct pf_state); - -@@ -1303,7 +1310,7 @@ - tbprintf(" PAUSED"); - - if (rawmode) -- printf("\n\n%s\n", tmp_buf); -+ printf("\n%s", tmp_buf); - else - mvprintw(0, 0, "%s", tmp_buf); - -@@ -1319,7 +1326,10 @@ - len = columns - strlen(tmp_buf); - if (len < 0) - len = 0; -- mvprintw(0, len, "%s", tmp_buf); -+ if (rawmode) -+ printf(" %s\n", tmp_buf); -+ else -+ mvprintw(0, len, "%s", tmp_buf); - } - - tb_end(); -@@ -1645,7 +1655,7 @@ - dispstart = 0; - - if (ioctl(dev, DIOCGETSTATUS, &status)) { -- warnx("DIOCGETSTATUS"); -+ warn("DIOCGETSTATUS"); - return (-1); - } - -@@ -1681,7 +1691,7 @@ - - memset(&pr, 0, sizeof(pr)); - if (ioctl(dev, DIOCGETRULES, &pr)) { -- warnx("DIOCGETRULES"); -+ warn("DIOCGETRULES"); - return (-1); - } - -@@ -1704,7 +1714,7 @@ - for (nr = 0; nr < num_rules; ++nr) { - pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { -- warnx("DIOCGETRULE"); -+ warn("DIOCGETRULE"); - return (-1); - } - rules[nr] = pr.rule; -@@ -1802,7 +1812,11 @@ - PF_AZERO(PT_MASK(src), AF_INET6)) - tbprintf("any "); - else { -+#if OS_LEVEL > 35 -+ if (src->neg) -+#else - if (src->not) -+#endif - tbprintf("! "); - #ifdef HAVE_ADDR_WRAP - tb_print_addrw(&src->addr, PT_MASK(src), af); -@@ -1823,7 +1837,11 @@ - PF_AZERO(PT_MASK(dst), AF_INET6)) - tbprintf("any "); - else { -+#if OS_LEVEL > 35 -+ if (dst->neg) -+#else - if (dst->not) -+#endif - tbprintf("! "); - #ifdef HAVE_ADDR_WRAP - tb_print_addrw(&dst->addr, PT_MASK(dst), af); -@@ -1890,8 +1908,13 @@ - #ifdef HAVE_RULE_STATES - print_fld_size(FLD_STATS, pr->states); - #endif -+#if OS_LEVEL > 37 -+ print_fld_size(FLD_PKTS, pr->packets[0] + pr->packets[1]); -+ print_fld_size(FLD_BYTES, pr->bytes[0] + pr->bytes[1]); -+#else - print_fld_size(FLD_PKTS, pr->packets); - print_fld_size(FLD_BYTES, pr->bytes); -+#endif - print_fld_uint(FLD_RULE, pr->nr); - print_fld_str(FLD_DIR, pr->direction == PF_OUT ? "Out" : "In"); - if (pr->quick) -@@ -2486,12 +2509,6 @@ - } - - void --sig_alarm(int signal) --{ -- gotsig_alarm = 1; --} -- --void - usage() - { - extern char *__progname; -@@ -2544,7 +2561,9 @@ - line++; - mvprintw(line++, 6, "press any key to continue ..."); - -+ timeout(-1); - while (getch() == ERR); -+ timeout(0); - } - - void -@@ -2577,8 +2596,9 @@ - keypad(stdscr, TRUE); - intrflush(stdscr, FALSE); - -- halfdelay(10); -+ cbreak(); - noecho(); -+ timeout(0); - } - - if (maxstates == 0) -@@ -2597,7 +2617,6 @@ - cmdbuf[0] = 0; - } - curr_cmd = cmd; -- need_update = 1; - return prev; - } - -@@ -2618,10 +2637,8 @@ - { - int del; - del = atoi(cmdbuf); -- if (del > 0) { -+ if (del > 0) - delay = del; -- gotsig_alarm = 1; -- } - } - - void -@@ -2646,7 +2663,6 @@ - if (cmd_len < sizeof(cmdbuf) - 1) { - cmdbuf[cmd_len++] = ch; - cmdbuf[cmd_len] = 0; -- need_update = 1; - } else - beep(); - } -@@ -2663,10 +2679,9 @@ - case KEY_BACKSPACE: - case KEY_DC: - case CTRL_H: -- if (cmd_len > 0) { -+ if (cmd_len > 0) - cmdbuf[--cmd_len] = 0; -- need_update = 1; -- } else -+ else - beep(); - break; - default: -@@ -2687,9 +2702,6 @@ - } - - switch (ch) { -- case ' ': -- gotsig_alarm = 1; -- break; - case 'c': - cachestates = !cachestates; - update_cache(); -@@ -2698,25 +2710,21 @@ - /* FALLTHROUGH */ - case 'h': - show_help(); -- need_update = 1; - break; - case 'n': - command_set(&cm_count); - break; - case 'o': - next_order(); -- need_sort = 1; - break; - case 'p': - paused = !paused; -- gotsig_alarm = 1; - break; - case 'q': - gotsig_close = 1; - break; - case 'r': - sortdir *= -1; -- need_sort = 1; - break; - case 's': - command_set(&cm_delay); -@@ -2737,49 +2745,40 @@ - /* FALLTHROUGH */ - case CTRL_N: - dispstart++; -- need_update = 1; - break; - case KEY_UP: - /* FALLTHROUGH */ - case CTRL_P: - dispstart--; -- need_update = 1; - break; - case KEY_NPAGE: - /* FALLTHROUGH */ - case CTRL_V: - dispstart += maxprint; -- need_update = 1; - break; - case KEY_PPAGE: - /* FALLTHROUGH */ - case META_V: - dispstart -= maxprint; -- need_update = 1; - break; - case KEY_HOME: - /* FALLTHROUGH */ - case CTRL_A: - dispstart = 0; -- need_update = 1; - break; - case KEY_END: - /* FALLTHROUGH */ - case CTRL_E: - dispstart = num_disp; -- need_update = 1; - break; - case CTRL_L: - clear(); -- need_update = 1; - break; - default: - break; - } - -- if (set_order_hotkey(ch)) -- need_sort = 1; -- else -+ if (!set_order_hotkey(ch)) - set_view_hotkey(ch); - } - -@@ -2790,6 +2789,7 @@ - extern int optind; - - struct pf_status status; -+ struct pollfd set[1]; - - char *orderstr = NULL; - char *viewstr = NULL; -@@ -2872,7 +2872,6 @@ - signal(SIGINT, sig_close); - signal(SIGQUIT, sig_close); - signal(SIGWINCH, sig_resize); -- signal(SIGALRM, sig_alarm); - - #ifdef HAVE_DEVICE_RO - dev = open("/dev/pf", O_RDONLY); -@@ -2884,7 +2883,7 @@ - - /* preallocate existing states if possible */ - if (ioctl(dev, DIOCGETSTATUS, &status)) { -- warnx("DIOCGETSTATUS"); -+ warn("DIOCGETSTATUS"); - alloc_buf(0); - } else - alloc_buf(status.states); -@@ -2910,36 +2909,7 @@ - if (rawmode && countmax == 0) - countmax = 1; - -- gotsig_alarm = 1; - for (;;) { -- if (gotsig_alarm) { -- read_view(dev); -- need_sort = 1; -- gotsig_alarm = 0; -- alarm(delay); -- } -- -- if (need_sort) { -- sort_view(); -- need_sort = 0; -- need_update = 1; -- -- /* XXX if sort took too long */ -- if (gotsig_alarm) { -- gotsig_alarm = 0; -- alarm(delay); -- } -- } -- -- if (need_update) { -- erase(); -- disp_update(dev); -- end_page(); -- need_update = 0; -- if (countmax && ++count >= countmax) -- break; -- } -- - if (gotsig_close) - break; - if (gotsig_resize) { -@@ -2947,12 +2917,30 @@ - endwin(); - setup_term(maxstates); - gotsig_resize = 0; -- need_update = 1; - } +@@ -40,6 +44,7 @@ -- if (interactive && need_update == 0) -- keyboard(); -- else if (interactive == 0) -+ read_view(dev); -+ sort_view(); -+ -+ if (rawmode == 0) -+ erase(); -+ disp_update(dev); -+ end_page(); -+ -+ if (countmax && ++count >= countmax) -+ break; -+ -+ if (interactive) { -+ set[0].fd = STDIN_FILENO; -+ set[0].events = POLLIN; -+ if (poll(set, 1, delay * 1000) == -1) { -+ if (errno == EINTR) -+ continue; -+ break; -+ } -+ if ((set[0].revents & POLLIN) != 0) -+ keyboard(); -+ } else - sleep(delay); - } + /* initialize the tree and queue */ + RB_HEAD(sc_tree, sc_ent) sctree; ++RB_PROTOTYPE(sc_tree, sc_ent, tlink, sc_cmp); + TAILQ_HEAD(sc_queue, sc_ent) scq1, scq2, scq_free; + RB_GENERATE(sc_tree, sc_ent, tlink, sc_cmp); diff --git a/sysutils/pftop/patches/patch-ac b/sysutils/pftop/patches/patch-ac index 8f71e9eb4b1..f9c190c841f 100644 --- a/sysutils/pftop/patches/patch-ac +++ b/sysutils/pftop/patches/patch-ac @@ -1,24 +1,25 @@ -$NetBSD: patch-ac,v 1.2 2006/03/06 23:02:08 peter Exp $ +$NetBSD: patch-ac,v 1.3 2008/06/15 14:09:03 peter Exp $ ---- cache.c.orig 2003-08-05 03:20:29.000000000 +0200 -+++ cache.c 2006-03-06 23:52:42.000000000 +0100 -@@ -37,7 +37,11 @@ - #include <netinet/in.h> +--- config.h.old 2008-06-15 01:19:59.000000000 +0200 ++++ config.h 2008-06-15 12:16:51.000000000 +0200 +@@ -42,7 +42,9 @@ + #if OS_LEVEL > 32 + #define HAVE_ADDR_MASK + #define HAVE_ADDR_TYPE ++#ifndef __NetBSD__ + #define HAVE_ALTQ ++#endif /* !__NetBSD__ */ + #define HAVE_RULE_TOS + #define HAVE_OP_RRG + #endif +@@ -64,6 +66,10 @@ - #include <netinet/tcp_fsm.h> -+#ifdef __DragonFly__ -+#include <net/pf/pfvar.h> -+#else - #include <net/pfvar.h> -+#endif - #include <arpa/inet.h> - - #include <stdio.h> -@@ -54,6 +58,7 @@ - - /* initialize the tree and queue */ - RB_HEAD(sc_tree, sc_ent) sctree; -+RB_PROTOTYPE(sc_tree, sc_ent, tlink, sc_cmp); - TAILQ_HEAD(sc_queue, sc_ent) scq1, scq2, scq_free; - RB_GENERATE(sc_tree, sc_ent, tlink, sc_cmp); + #if OS_LEVEL > 37 + #define HAVE_INOUT_COUNT_RULES ++#ifdef __NetBSD__ ++/* NetBSD has pf/ALTQ since 4.0, which shipped with pf 3.7 */ ++#define HAVE_ALTQ ++#endif /* __NetBSD__ */ + #endif + #if OS_LEVEL > 38 diff --git a/sysutils/pftop/patches/patch-ad b/sysutils/pftop/patches/patch-ad new file mode 100644 index 00000000000..103bac0527c --- /dev/null +++ b/sysutils/pftop/patches/patch-ad @@ -0,0 +1,261 @@ +$NetBSD: patch-ad,v 1.1 2008/06/15 14:09:03 peter Exp $ + +--- engine.c.old 2008-06-14 17:38:55.000000000 +0200 ++++ engine.c 2008-06-15 12:41:47.000000000 +0200 +@@ -22,7 +22,10 @@ + + #include <ctype.h> + #include <curses.h> ++#include <errno.h> ++#include <poll.h> + #include <signal.h> ++#include <stdarg.h> + #include <stdlib.h> + #include <string.h> + #include <unistd.h> +@@ -33,6 +36,10 @@ + #define MIN(a,b) (((a)<(b))?(a):(b)) + #endif + ++#ifndef CIRCLEQ_END ++#define CIRCLEQ_END(head) ((void *)(head)) ++#endif ++ + /* circular linked list of views */ + CIRCLEQ_HEAD(view_list, view_ent) view_head = + CIRCLEQ_HEAD_INITIALIZER(view_head); +@@ -55,9 +62,6 @@ + + volatile sig_atomic_t gotsig_close = 0; + volatile sig_atomic_t gotsig_resize = 0; +-volatile sig_atomic_t gotsig_alarm = 0; +-int need_update = 0; +-int need_sort = 0; + + SCREEN *screen; + +@@ -105,7 +109,6 @@ + + int + tbprintf(char *format, ...) +- GCC_PRINTFLIKE(1,2) /* defined in curses.h */ + { + int len; + va_list arg; +@@ -482,7 +485,6 @@ + v = ve->view; + + if ((curr_view != NULL) && (curr_mgr != v->mgr)) { +- gotsig_alarm = 1; + if (v->mgr != NULL && v->mgr->select_fn != NULL) + v->mgr->select_fn(); + } +@@ -491,7 +493,6 @@ + curr_view = v; + curr_mgr = v->mgr; + field_setup(); +- need_update = 1; + } + + void +@@ -905,12 +906,6 @@ + } + + void +-sig_alarm(int signal) +-{ +- gotsig_alarm = 1; +-} +- +-void + setup_term(int dmax) + { + max_disp = dmax; +@@ -941,8 +936,9 @@ + keypad(stdscr, TRUE); + intrflush(stdscr, FALSE); + +- halfdelay(10); ++ cbreak(); + noecho(); ++ timeout(0); + } + + if (dmax == 0) +@@ -970,7 +966,6 @@ + } + curr_message = NULL; + curr_cmd = cmd; +- need_update = 1; + return prev; + } + +@@ -987,7 +982,6 @@ + + int + msgprintf(char *format, ...) +- GCC_PRINTFLIKE(1,2) /* defined in curses.h */ + { + static char buf[1024]; + int len; +@@ -1085,28 +1079,21 @@ + if (curr_message != NULL) { + if (ch > 0) { + curr_message = NULL; +- need_update = 1; + } + } + + switch (ch) { +- case ' ': +- gotsig_alarm = 1; +- break; + case 'o': + next_order(); +- need_sort = 1; + break; + case 'p': + paused = !paused; +- gotsig_alarm = 1; + break; + case 'q': + gotsig_close = 1; + break; + case 'r': + sortdir *= -1; +- need_sort = 1; + break; + case 'v': + /* FALLTHROUGH */ +@@ -1124,49 +1111,40 @@ + /* FALLTHROUGH */ + case CTRL_N: + dispstart++; +- need_update = 1; + break; + case KEY_UP: + /* FALLTHROUGH */ + case CTRL_P: + dispstart--; +- need_update = 1; + break; + case KEY_NPAGE: + /* FALLTHROUGH */ + case CTRL_V: + dispstart += maxprint; +- need_update = 1; + break; + case KEY_PPAGE: + /* FALLTHROUGH */ + case META_V: + dispstart -= maxprint; +- need_update = 1; + break; + case KEY_HOME: + /* FALLTHROUGH */ + case CTRL_A: + dispstart = 0; +- need_update = 1; + break; + case KEY_END: + /* FALLTHROUGH */ + case CTRL_E: + dispstart = num_disp; +- need_update = 1; + break; + case CTRL_L: + clear(); +- need_update = 1; + break; + default: + break; + } + +- if (set_order_hotkey(ch)) +- need_sort = 1; +- else ++ if (!set_order_hotkey(ch)) + set_view_hotkey(ch); + } + +@@ -1177,43 +1155,15 @@ + signal(SIGINT, sig_close); + signal(SIGQUIT, sig_close); + signal(SIGWINCH, sig_resize); +- signal(SIGALRM, sig_alarm); + } + + void + engine_loop(int countmax) + { ++ struct pollfd set[1]; + int count = 0; + + for (;;) { +- if (gotsig_alarm) { +- read_view(); +- need_sort = 1; +- gotsig_alarm = 0; +- alarm(delay); +- } +- +- if (need_sort) { +- sort_view(); +- need_sort = 0; +- need_update = 1; +- +- /* XXX if sort took too long */ +- if (gotsig_alarm) { +- gotsig_alarm = 0; +- alarm(delay); +- } +- } +- +- if (need_update) { +- erase(); +- disp_update(); +- end_page(); +- need_update = 0; +- if (countmax && ++count >= countmax) +- break; +- } +- + if (gotsig_close) + break; + if (gotsig_resize) { +@@ -1221,13 +1171,31 @@ + endwin(); + setup_term(max_disp); + gotsig_resize = 0; +- need_update = 1; + } + +- if (interactive && need_update == 0) +- keyboard(); +- else if (interactive == 0) ++ read_view(); ++ sort_view(); ++ ++ if (rawmode == 0) ++ erase(); ++ disp_update(); ++ end_page(); ++ if (countmax && ++count >= countmax) ++ break; ++ ++ if (interactive) { ++ set[0].fd = STDIN_FILENO; ++ set[0].events = POLLIN; ++ if (poll(set, 1, delay * 1000) == -1) { ++ if (errno == EINTR) ++ continue; ++ break; ++ } ++ if ((set[0].revents & POLLIN) != 0) ++ keyboard(); ++ } else { + sleep(delay); ++ } + } + + if (rawmode == 0) diff --git a/sysutils/pftop/patches/patch-ae b/sysutils/pftop/patches/patch-ae new file mode 100644 index 00000000000..dc931b044ed --- /dev/null +++ b/sysutils/pftop/patches/patch-ae @@ -0,0 +1,28 @@ +$NetBSD: patch-ae,v 1.1 2008/06/15 14:09:04 peter Exp $ + +--- engine.h.old 2008-06-14 17:39:04.000000000 +0200 ++++ engine.h 2008-06-15 12:38:21.000000000 +0200 +@@ -100,8 +100,8 @@ + + void tb_end(void); + +-int tbprintf(char *format, ...) GCC_PRINTFLIKE(1,2); +-int msgprintf(char *format, ...) GCC_PRINTFLIKE(1,2); ++int tbprintf(char *format, ...); ++int msgprintf(char *format, ...); + + void end_line(void); + void end_page(void); +@@ -150,12 +150,8 @@ + extern int rawwidth; + extern int columns, lines; + +-extern int need_update; +-extern int need_sort; +- + extern volatile sig_atomic_t gotsig_close; + extern volatile sig_atomic_t gotsig_resize; +-extern volatile sig_atomic_t gotsig_alarm; + + extern field_view *curr_view; + extern struct view_manager *curr_mgr; diff --git a/sysutils/pftop/patches/patch-af b/sysutils/pftop/patches/patch-af new file mode 100644 index 00000000000..d068aad2080 --- /dev/null +++ b/sysutils/pftop/patches/patch-af @@ -0,0 +1,12 @@ +$NetBSD: patch-af,v 1.1 2008/06/15 14:09:04 peter Exp $ + +--- pftop.8.old 2008-06-14 18:16:37.000000000 +0200 ++++ pftop.8 2008-06-14 18:16:47.000000000 +0200 +@@ -143,6 +143,7 @@ + .It Fl w Ar width + Set the width of the display for batch mode. + The default width is 80. ++.El + .Sh INTERACTIVE MODE + When + .Nm diff --git a/sysutils/pftop/patches/patch-ag b/sysutils/pftop/patches/patch-ag new file mode 100644 index 00000000000..0b9a6d6f4ad --- /dev/null +++ b/sysutils/pftop/patches/patch-ag @@ -0,0 +1,120 @@ +$NetBSD: patch-ag,v 1.1 2008/06/15 14:09:04 peter Exp $ + +--- pftop.c.old 2008-06-14 17:41:08.000000000 +0200 ++++ pftop.c 2008-06-15 12:42:06.000000000 +0200 +@@ -40,7 +40,11 @@ + #include <netinet/in.h> + #define TCPSTATES + #include <netinet/tcp_fsm.h> ++#ifdef __DragonFly__ ++#include <net/pf/pfvar.h> ++#else + #include <net/pfvar.h> ++#endif /* !__DragonFly__ */ + #include <arpa/inet.h> + + #ifdef HAVE_ALTQ +@@ -55,6 +59,7 @@ + #include <err.h> + #include <errno.h> + #include <fcntl.h> ++#include <limits.h> + #include <netdb.h> + #include <signal.h> + #include <stdio.h> +@@ -736,7 +741,7 @@ + } else { + num_states = 0; + for (n = 0; n<num_states_all; n++) +- if (bpf_filter(filter_prog.bf_insns, (char *)(&state_buf[n]), ++ if (bpf_filter(filter_prog.bf_insns, (u_char *)(&state_buf[n]), + sizeof(pf_state_t), sizeof(pf_state_t)) > 0) + state_ord[num_states++] = n; + } +@@ -828,7 +833,7 @@ + tbprintf(" PAUSED"); + + if (rawmode) +- printf("\n\n%s\n", tmp_buf); ++ printf("\n%s", tmp_buf); + else + mvprintw(0, 0, "%s", tmp_buf); + +@@ -843,7 +848,10 @@ + len = columns - strlen(tmp_buf); + if (len < 0) + len = 0; +- mvprintw(0, len, "%s", tmp_buf); ++ if (rawmode) ++ printf(" %s\n", tmp_buf); ++ else ++ mvprintw(0, len, "%s", tmp_buf); + } + + tb_end(); +@@ -1244,7 +1252,6 @@ + FLD_ANCHOR->max_width = mx; + FLD_ANCHOR->norm_width = nx; + field_setup(); +- need_update = 1; + } + } + #endif +@@ -1279,7 +1286,6 @@ + FLD_LABEL->norm_width = nw; + FLD_LABEL->max_width = mw; + field_setup(); +- need_update = 1; + } + } + #endif +@@ -2041,11 +2047,9 @@ + if (cachestates) { + show_field(FLD_SI); + show_field(FLD_SP); +- gotsig_alarm = 1; + } else { + hide_field(FLD_SI); + hide_field(FLD_SP); +- need_update = 1; + } + field_setup(); + } +@@ -2105,8 +2109,10 @@ + line++; + mvprintw(line++, 6, "press any key to continue ..."); + +- while (getch() == ERR); +- ++ timeout(-1); ++ while (getch() == ERR) ++ continue; ++ timeout(0); + } + + +@@ -2142,7 +2148,6 @@ + del = atoi(cmdbuf); + if (del > 0) { + delay = del; +- gotsig_alarm = 1; + } + } + +@@ -2175,7 +2180,6 @@ + /* FALLTHROUGH */ + case 'h': + show_help(); +- need_update = 1; + break; + case 'n': + command_set(&cm_count, NULL); +@@ -2349,8 +2353,6 @@ + if (rawmode && countmax == 0) + countmax = 1; + +- gotsig_alarm = 1; +- + engine_loop(countmax); + + close(pf_dev); diff --git a/sysutils/pftop/patches/patch-ah b/sysutils/pftop/patches/patch-ah new file mode 100644 index 00000000000..edfa2403609 --- /dev/null +++ b/sysutils/pftop/patches/patch-ah @@ -0,0 +1,53 @@ +$NetBSD: patch-ah,v 1.1 2008/06/15 14:09:04 peter Exp $ + +--- sf-gencode.c.old 2008-06-14 17:44:52.000000000 +0200 ++++ sf-gencode.c 2008-06-15 01:19:43.000000000 +0200 +@@ -32,8 +32,11 @@ + #include <netinet/in.h> + #include <netinet/if_ether.h> + +-#include <net/if_pflog.h> ++#ifdef __DragonFly__ ++#include <net/pf/pfvar.h> ++#else + #include <net/pfvar.h> ++#endif /* !__DragonFly__ */ + + #include <netdb.h> + #include <stdlib.h> +@@ -44,7 +47,7 @@ + + #define INET6 + +-#include <pcap-int.h> ++#include "pcap-int.h" + #include <pcap-namedb.h> + #include "sf-gencode.h" + +@@ -733,13 +736,17 @@ + b1 = gen_proto(IPPROTO_ESP); + break; + ++#ifdef IPPROTO_PFSYNC + case Q_PFSYNC: + b1 = gen_proto(IPPROTO_PFSYNC); + break; ++#endif /* IPPROTO_PFSYNC */ + ++#ifdef IPPROTO_CARP + case Q_CARP: + b1 = gen_proto(IPPROTO_CARP); + break; ++#endif /* IPPROTO_CARP */ + + default: + sf_error("Unknown protocol abbreviation"); +@@ -1560,7 +1567,7 @@ + /* NOTREACHED */ + } + +- b0 = gen_bcmp(off, strlen(ifname), ifname); ++ b0 = gen_bcmp(off, strlen(ifname), (const u_char *)ifname); + return (b0); + #else + sf_error("ifname not supported in this OpenBSD release"); diff --git a/sysutils/pftop/patches/patch-ai b/sysutils/pftop/patches/patch-ai new file mode 100644 index 00000000000..549b54a2cc7 --- /dev/null +++ b/sysutils/pftop/patches/patch-ai @@ -0,0 +1,33 @@ +$NetBSD: patch-ai,v 1.1 2008/06/15 14:09:04 peter Exp $ + +--- sf-scanner.l.old 2008-06-14 18:04:30.000000000 +0200 ++++ sf-scanner.l 2008-06-14 18:19:59.000000000 +0200 +@@ -222,7 +222,8 @@ + if (getaddrinfo(yytext, NULL, &hints, &res)) + sf_error("bogus IPv6 address %s", yytext); + else { +- yylval.e = sdup((char *)yytext); return HID6; ++ yylval.e = (u_char *)sdup((char *)yytext); ++ return HID6; + } + } + [A-Za-z0-9][-_.A-Za-z0-9]*[.A-Za-z0-9] { +@@ -232,8 +233,17 @@ + [^ \[\]\t\n\-_.A-Za-z0-9!<>()&|=]+ { + size_t len = strlen(yytext) * 4 + 1; + char *v = malloc(len); +- if (v != NULL) ++ if (v != NULL) { ++#ifdef __NetBSD__ ++ size_t len = strlen(yytext); ++ if (len > sizeof v) { ++ len = sizeof v; ++ } ++ strvisx(v, yytext, len, 0); ++#else + strnvis(v, yytext, len, 0); ++#endif /* !__NetBSD__ */ ++ } + sf_error("illegal token: %s", v); + free(v); + } |