Source-Changes-HG archive

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

[src/netbsd-1-5]: src/dist/ipf Pull up revision 1.3 (requested by martti):



details:   https://anonhg.NetBSD.org/src/rev/6971f4abcc49
branches:  netbsd-1-5
changeset: 492679:6971f4abcc49
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 09 16:55:32 2002 +0000

description:
Pull up revision 1.3 (requested by martti):
  Updated IPFilter to 3.4.23

diffstat:

 dist/ipf/facpri.c           |   17 +-
 dist/ipf/facpri.h           |   10 +-
 dist/ipf/ipft_ef.c          |   10 +-
 dist/ipf/ipft_hx.c          |   36 +-
 dist/ipf/ipft_pc.c          |   19 +-
 dist/ipf/ipft_sn.c          |   33 +-
 dist/ipf/ipft_td.c          |   10 +-
 dist/ipf/iplang/Makefile    |    3 +
 dist/ipf/ipsend/ipresend.1  |    4 +-
 dist/ipf/ipsend/iptest.c    |   15 +-
 dist/ipf/kmem.h             |   13 +-
 dist/ipf/man/Makefile       |    2 +-
 dist/ipf/misc.c             |   83 +++-
 dist/ipf/ml_ipl.c           |    8 +-
 dist/ipf/opt.c              |   10 +-
 dist/ipf/pcap.h             |   11 +-
 dist/ipf/perl/plog          |  990 +++++++++++++++++++++++++------------------
 dist/ipf/samples/proxy.c    |  197 ++++++++-
 dist/ipf/samples/userauth.c |    4 +-
 dist/ipf/snoop.h            |   10 +-
 dist/ipf/test/Makefile      |   14 +-
 dist/ipf/todo               |    1 +
 22 files changed, 950 insertions(+), 550 deletions(-)

diffs (truncated from 2255 to 300 lines):

diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/facpri.c
--- a/dist/ipf/facpri.c Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/facpri.c Sat Feb 09 16:55:32 2002 +0000
@@ -1,11 +1,9 @@
-/*     $NetBSD: facpri.c,v 1.2 2000/05/03 11:40:16 veego Exp $ */
+/*     $NetBSD: facpri.c,v 1.2.4.1 2002/02/09 16:55:32 he Exp $        */
 
 /*
- * Copyright (C) 1993-2000 by Darren Reed.
+ * Copyright (C) 1993-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
+ * See the IPFILTER.LICENCE file for details on licencing.
  */
 #include <stdio.h>
 #include <string.h>
@@ -20,8 +18,12 @@
 #include <syslog.h>
 #include "facpri.h"
 
+#ifndef __STDC__
+# define       const
+#endif
+
 #if !defined(lint)
-static const char rcsid[] = "@(#)Id: facpri.c,v 1.3 2000/03/13 22:10:18 darrenr Exp";
+static const char rcsid[] = "@(#)Id: facpri.c,v 1.3.2.4 2001/07/15 22:06:12 darrenr Exp";
 #endif
 
 typedef        struct  table   {
@@ -57,6 +59,9 @@
 #else
        { "cron2", LOG_CRON2 },
 #endif
+#ifdef LOG_SECURITY
+       { "security", LOG_SECURITY },
+#endif
        { "local0", LOG_LOCAL0 },       { "local1", LOG_LOCAL1 },
        { "local2", LOG_LOCAL2 },       { "local3", LOG_LOCAL3 },
        { "local4", LOG_LOCAL4 },       { "local5", LOG_LOCAL5 },
diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/facpri.h
--- a/dist/ipf/facpri.h Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/facpri.h Sat Feb 09 16:55:32 2002 +0000
@@ -1,12 +1,10 @@
-/*     $NetBSD: facpri.h,v 1.2 2000/05/03 11:40:16 veego Exp $ */
+/*     $NetBSD: facpri.h,v 1.2.4.1 2002/02/09 16:55:32 he Exp $        */
 
 /*
- * Copyright (C) 1999-2000 by Darren Reed.
+ * Copyright (C) 1999-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
- * Id: facpri.h,v 1.3 2000/03/13 22:10:18 darrenr Exp
+ * See the IPFILTER.LICENCE file for details on licencing.
+ * Id: facpri.h,v 1.3.2.1 2001/06/26 10:43:11 darrenr Exp
  */
 
 #ifndef        __FACPRI_H__
diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/ipft_ef.c
--- a/dist/ipf/ipft_ef.c        Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/ipft_ef.c        Sat Feb 09 16:55:32 2002 +0000
@@ -1,11 +1,9 @@
-/*     $NetBSD: ipft_ef.c,v 1.2 2000/05/03 11:40:16 veego Exp $        */
+/*     $NetBSD: ipft_ef.c,v 1.2.4.1 2002/02/09 16:55:32 he Exp $       */
 
 /*
- * Copyright (C) 1993-2000 by Darren Reed.
+ * Copyright (C) 1993-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
+ * See the IPFILTER.LICENCE file for details on licencing.
  */
 
 /*
@@ -53,7 +51,7 @@
 
 #if !defined(lint)
 static const char sccsid[] = "@(#)ipft_ef.c    1.6 2/4/96 (C)1995 Darren Reed";
-static const char rcsid[] = "@(#)Id: ipft_ef.c,v 2.2 2000/03/13 22:10:24 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ipft_ef.c,v 2.2.2.1 2001/06/26 10:43:18 darrenr Exp";
 #endif
 
 static int     etherf_open __P((char *));
diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/ipft_hx.c
--- a/dist/ipf/ipft_hx.c        Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/ipft_hx.c        Sat Feb 09 16:55:32 2002 +0000
@@ -1,11 +1,9 @@
-/*     $NetBSD: ipft_hx.c,v 1.2 2000/05/03 11:40:16 veego Exp $        */
+/*     $NetBSD: ipft_hx.c,v 1.2.4.1 2002/02/09 16:55:32 he Exp $       */
 
 /*
- * Copyright (C) 1995-2000 by Darren Reed.
+ * Copyright (C) 1995-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
+ * See the IPFILTER.LICENCE file for details on licencing.
  */
 #include <stdio.h>
 #include <ctype.h>
@@ -44,7 +42,7 @@
 
 #if !defined(lint)
 static const char sccsid[] = "@(#)ipft_hx.c    1.1 3/9/96 (C) 1996 Darren Reed";
-static const char rcsid[] = "@(#)Id: ipft_hx.c,v 2.2 2000/03/13 22:10:24 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ipft_hx.c,v 2.2.2.4 2001/12/08 15:44:50 darrenr Exp";
 #endif
 
 extern int     opts;
@@ -95,6 +93,14 @@
        char    line[513];
        ip_t    *ip;
 
+       /*
+        * interpret start of line as possibly "[ifname]" or
+        * "[in/out,ifname]".
+        */
+       if (ifn)
+               *ifn = NULL;
+       if (dir)
+               *dir = 0;
        ip = (ip_t *)buf;
        while (fgets(line, sizeof(line)-1, tfp)) {
                if ((s = index(line, '\n'))) {
@@ -111,21 +117,14 @@
                        fflush(stdout);
                }
 
-               /*
-                * interpret start of line as possibly "[ifname]" or
-                * "[in/out,ifname]".
-                */
-               if (ifn)
-                       *ifn = NULL;
-               if (dir)
-                       *dir = 0;
-               if ((*buf == '[') && (s = index(line, ']'))) {
-                       t = buf + 1;
-                       if (t - s > 0) {
+               if ((*line == '[') && (s = index(line, ']'))) {
+                       t = line + 1;
+                       if (s - t > 0) {
+                               *s++ = '\0';
                                if ((u = index(t, ',')) && (u < s)) {
                                        u++;
                                        if (ifn)
-                                               *ifn = u;
+                                               *ifn = strdup(u);
                                        if (dir) {
                                                if (*t == 'i')
                                                        *dir = 0;
@@ -134,7 +133,6 @@
                                        }
                                } else if (ifn)
                                        *ifn = t;
-                               *s++ = '\0';
                        }
                } else
                        s = line;
diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/ipft_pc.c
--- a/dist/ipf/ipft_pc.c        Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/ipft_pc.c        Sat Feb 09 16:55:32 2002 +0000
@@ -1,11 +1,9 @@
-/*     $NetBSD: ipft_pc.c,v 1.2 2000/05/03 11:40:16 veego Exp $        */
+/*     $NetBSD: ipft_pc.c,v 1.2.4.1 2002/02/09 16:55:32 he Exp $       */
 
 /*
- * Copyright (C) 1993-2000 by Darren Reed.
+ * Copyright (C) 1993-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
+ * See the IPFILTER.LICENCE file for details on licencing.
  */
 #include <stdio.h>
 #include <string.h>
@@ -35,7 +33,7 @@
 #include "ipt.h"
 
 #if !defined(lint)
-static const char rcsid[] = "@(#)Id: ipft_pc.c,v 2.2 2000/03/13 22:10:24 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ipft_pc.c,v 2.2.2.2 2001/06/26 10:43:18 darrenr Exp";
 #endif
 
 struct llc     {
@@ -48,7 +46,7 @@
  * While many of these maybe the same, some do have different header formats
  * which make this useful.
  */
-#define        DLT_MAX 10
+#define        DLT_MAX 14
 
 static struct  llc     llcs[DLT_MAX+1] = {
        { 0, 0, 0 },    /* DLT_NULL */
@@ -61,7 +59,10 @@
        { 0, 0, 0 },    /* DLT_ARCNET */
        { 0, 0, 0 },    /* DLT_SLIP */
        { 0, 0, 0 },    /* DLT_PPP */
-       { 0, 0, 0 }     /* DLT_FDDI */
+       { 0, 0, 0 },    /* DLT_FDDI */
+       { 0, 0, 0 },    /* DLT_ATMRFC1483 */
+       { 0, 0, 0 },    /* DLT_LOOP */
+       { 0, 0, 0 }     /* DLT_ENC */
 };
 
 static int     pcap_open __P((char *));
@@ -116,7 +117,7 @@
                swap_hdr(&ph);
        }
 
-       if (ph.pc_v_maj != PCAP_VERSION_MAJ || ph.pc_type > DLT_MAX) {
+       if (ph.pc_v_maj != PCAP_VERSION_MAJ || ph.pc_type >= DLT_MAX) {
                (void) close(fd);
                return -2;
        }
diff -r 05338175c80f -r 6971f4abcc49 dist/ipf/ipft_sn.c
--- a/dist/ipf/ipft_sn.c        Sat Feb 09 16:55:28 2002 +0000
+++ b/dist/ipf/ipft_sn.c        Sat Feb 09 16:55:32 2002 +0000
@@ -1,11 +1,9 @@
-/*     $NetBSD: ipft_sn.c,v 1.2 2000/05/03 11:40:16 veego Exp $        */
+/*     $NetBSD: ipft_sn.c,v 1.2.4.1 2002/02/09 16:55:33 he Exp $       */
 
 /*
- * Copyright (C) 1993-2000 by Darren Reed.
+ * Copyright (C) 1993-2001 by Darren Reed.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and due credit is given
- * to the original author and the contributors.
+ * See the IPFILTER.LICENCE file for details on licencing.
  */
 
 /*
@@ -39,7 +37,7 @@
 #include "ipt.h"
 
 #if !defined(lint)
-static const char rcsid[] = "@(#)Id: ipft_sn.c,v 2.2 2000/03/13 22:10:24 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ipft_sn.c,v 2.2.2.2 2001/06/26 10:43:18 darrenr Exp";
 #endif
 
 struct llc     {
@@ -80,6 +78,7 @@
 {
        struct  snoophdr sh;
        int     fd;
+       int s_v;
 
        if (sfd != -1)
                return sfd;
@@ -92,16 +91,18 @@
        if (read(fd, (char *)&sh, sizeof(sh)) != sizeof(sh))
                return -2;
 
-       if (sh.s_v != SNOOP_VERSION ||
-           sh.s_type < 0 || sh.s_type > SDL_MAX) {
+       s_v = (int)ntohl(sh.s_v);
+       s_type = (int)ntohl(sh.s_type);
+
+       if (s_v != SNOOP_VERSION ||
+           s_type < 0 || s_type > SDL_MAX) {
                (void) close(fd);
                return -2;
        }
 
        sfd = fd;
-       s_type = sh.s_type;
        printf("opened snoop file %s:\n", fname);
-       printf("\tid: %8.8s version: %d type: %d\n", sh.s_id, sh.s_v, s_type);
+       printf("\tid: %8.8s version: %d type: %d\n", sh.s_id, s_v, s_type);
 
        return fd;
 }
@@ -120,20 +121,22 @@
 static int     snoop_read_rec(rec)
 struct snooppkt *rec;
 {
-       int     n, p;
+       int     n, plen, ilen;
 
        if (read(sfd, (char *)rec, sizeof(*rec)) != sizeof(*rec))
                return -2;
 
-       if (rec->sp_ilen > rec->sp_plen || rec->sp_plen < sizeof(*rec))
+       ilen = (int)ntohl(rec->sp_ilen);
+       plen = (int)ntohl(rec->sp_plen);
+       if (ilen > plen || plen < sizeof(*rec))
                return -2;
 
-       p = rec->sp_plen - sizeof(*rec);
-       n = MIN(p, rec->sp_ilen);
+       plen -= sizeof(*rec);



Home | Main Index | Thread Index | Old Index