pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/pftop Initial import of pftop-0.4 into the Ne...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f59a4b3ebe8d
branches:  trunk
changeset: 482941:f59a4b3ebe8d
user:      peter <peter%pkgsrc.org@localhost>
date:      Fri Nov 05 15:08:33 2004 +0000

description:
Initial import of pftop-0.4 into the NetBSD Packages Collection.

Pftop is a small, curses-based utility for real-time display of
active states and rule statistics for PF, the packet filter from OpenBSD.

diffstat:

 sysutils/pftop/DESCR            |    2 +
 sysutils/pftop/Makefile         |   22 ++
 sysutils/pftop/PLIST            |    3 +
 sysutils/pftop/distinfo         |    6 +
 sysutils/pftop/patches/patch-aa |   15 +
 sysutils/pftop/patches/patch-ab |  417 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 465 insertions(+), 0 deletions(-)

diffs (truncated from 489 to 300 lines):

diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/DESCR      Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,2 @@
+Pftop is a small, curses-based utility for real-time display of
+active states and rule statistics for PF, the packet filter from OpenBSD. 
diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/Makefile   Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,22 @@
+# $NetBSD: Makefile,v 1.1.1.1 2004/11/05 15:08:33 peter Exp $
+
+DISTNAME=      pftop-0.4
+CATEGORIES=    sysutils net
+MASTER_SITES=  http://www.eee.metu.edu.tr/~canacar/
+
+MAINTAINER=    peter%pointless.nl@localhost
+HOMEPAGE=      http://www.eee.metu.edu.tr/~canacar/pftop/
+COMMENT=       Utility for real-time display of statistics for PF
+
+USE_BUILDLINK3=        yes
+NO_CONFIGURE=  yes
+
+MAKE_ENV+=     OSLEVEL=${_PF_VERSION:S/.//}
+CFLAGS+=       -I${PREFIX}/include
+
+do-install:
+       ${INSTALL_PROGRAM} ${WRKSRC}/pftop ${PREFIX}/sbin
+       ${INSTALL_MAN} ${WRKSRC}/pftop.8 ${PREFIX}/man/man8
+
+.include "../../security/pflkm/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/PLIST      Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2004/11/05 15:08:33 peter Exp $
+sbin/pftop
+man/man8/pftop.8
diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/distinfo   Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1.1.1 2004/11/05 15:08:33 peter Exp $
+
+SHA1 (pftop-0.4.tar.gz) = 717d8a9527a412cf21c1a6b7e6fa054bf0298ab2
+Size (pftop-0.4.tar.gz) = 23631 bytes
+SHA1 (patch-aa) = f8b273c9c81edf44b42d6379aa7ac92ceb1147f7
+SHA1 (patch-ab) = 7c3d45c2bfd1e8c24b6a442c5a4e8e3def9113b4
diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/patches/patch-aa   Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-aa,v 1.1.1.1 2004/11/05 15:08:33 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
+ 
diff -r a956cf987d48 -r f59a4b3ebe8d sysutils/pftop/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/pftop/patches/patch-ab   Fri Nov 05 15:08:33 2004 +0000
@@ -0,0 +1,417 @@
+$NetBSD: patch-ab,v 1.1.1.1 2004/11/05 15:08:33 peter Exp $
+
+This patch fixes the following:
+* compile problem on NetBSD.
+* compile problem on PF > 3.5.
+* fixes at least two segfaults in batch mode.
+* implements a better (less buggy) screen refresh method.
+* changes some errx/warnx to err/warn for better errors.
+
+--- pftop.c.orig       2003-08-05 03:20:39.000000000 +0200
++++ pftop.c    2004-10-27 00:21:10.000000000 +0200
+@@ -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>
+@@ -55,6 +60,7 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <netdb.h>
++#include <poll.h>
+ #include <signal.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -192,9 +198,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 +509,6 @@
+ 
+ int
+ tbprintf(char *format, ...)
+-      GCC_PRINTFLIKE(1,2)       /* defined in curses.h */
+ {
+       int len;
+       va_list arg;
+@@ -758,7 +760,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 +767,6 @@
+       curr_view = v;
+       curr_mgr = v->mgr;
+       field_setup();
+-      need_update = 1;
+ }
+ 
+ void
+@@ -849,11 +849,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 +1210,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 +1301,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 +1317,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 +1646,7 @@
+               dispstart = 0;
+ 
+       if (ioctl(dev, DIOCGETSTATUS, &status)) {
+-              warnx("DIOCGETSTATUS");
++              warn("DIOCGETSTATUS");
+               return (-1);
+       }
+ 
+@@ -1681,7 +1682,7 @@
+ 
+       memset(&pr, 0, sizeof(pr));
+       if (ioctl(dev, DIOCGETRULES, &pr)) {
+-              warnx("DIOCGETRULES");
++              warn("DIOCGETRULES");
+               return (-1);
+       }
+ 
+@@ -1704,7 +1705,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 +1803,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 +1828,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);
+@@ -2486,12 +2495,6 @@
+ }
+ 
+ void
+-sig_alarm(int signal)
+-{
+-      gotsig_alarm = 1;
+-}
+-
+-void
+ usage()
+ {
+       extern char *__progname;
+@@ -2544,7 +2547,9 @@
+       line++;
+       mvprintw(line++, 6, "press any key to continue ...");
+ 
++      timeout(-1);
+       while (getch() == ERR);
++      timeout(0);
+ }
+ 
+ void
+@@ -2577,8 +2582,9 @@
+               keypad(stdscr, TRUE);
+               intrflush(stdscr, FALSE);
+ 
+-              halfdelay(10);
++              cbreak();
+               noecho();
++              timeout(0);
+       }
+ 
+       if (maxstates == 0)
+@@ -2597,7 +2603,6 @@
+               cmdbuf[0] = 0;
+       }
+       curr_cmd = cmd;
+-      need_update = 1;
+       return prev;
+ }
+ 
+@@ -2618,10 +2623,8 @@
+ {
+       int del;
+       del = atoi(cmdbuf);
+-      if (del > 0) {
++      if (del > 0)
+               delay = del;
+-              gotsig_alarm = 1;
+-      }
+ }
+ 
+ void
+@@ -2646,7 +2649,6 @@
+               if (cmd_len < sizeof(cmdbuf) - 1) {
+                       cmdbuf[cmd_len++] = ch;
+                       cmdbuf[cmd_len] = 0;
+-                      need_update = 1;
+               } else
+                       beep();
+       }
+@@ -2663,10 +2665,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;



Home | Main Index | Thread Index | Old Index