Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 2002 21:48:28 -0700 (PDT)
From:      Julian Elischer <julian@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 13514 for review
Message-ID:  <200206280448.g5S4mSiC022759@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13514

Change 13514 by julian@julian_jules1 on 2002/06/27 21:47:44

	 MFC

Affected files ...

.. //depot/projects/kse/gnu/usr.bin/binutils/gdb/config.h#3 integrate
.. //depot/projects/kse/sys/conf/files#41 integrate
.. //depot/projects/kse/sys/dev/sound/pci/ich.c#15 integrate
.. //depot/projects/kse/sys/kern/kern_poll.c#7 integrate
.. //depot/projects/kse/sys/netinet/ip_dummynet.c#8 integrate
.. //depot/projects/kse/sys/netinet/ip_fw.h#9 integrate
.. //depot/projects/kse/sys/netinet/ip_fw2.c#1 branch

Differences ...

==== //depot/projects/kse/gnu/usr.bin/binutils/gdb/config.h#3 (text+ko) ====

@@ -1,20 +1,8 @@
-/* $FreeBSD: src/gnu/usr.bin/binutils/gdb/config.h,v 1.4 2002/05/18 04:59:56 obrien Exp $ */
+/* $FreeBSD: src/gnu/usr.bin/binutils/gdb/config.h,v 1.6 2002/06/28 01:33:53 obrien Exp $ */
 
 /* config.h.  Generated automatically by configure.  */
 /* config.in.  Generated automatically from configure.in by autoheader.  */
 
-/* Whether malloc must be declared even if <stdlib.h> is included.  */
-/* #undef NEED_DECLARATION_MALLOC */
-
-/* Whether realloc must be declared even if <stdlib.h> is included.  */
-/* #undef NEED_DECLARATION_REALLOC */
-
-/* Whether free must be declared even if <stdlib.h> is included.  */
-/* #undef NEED_DECLARATION_FREE */
-
-/* Whether strerror must be declared even if <string.h> is included.  */
-/* #undef NEED_DECLARATION_STRERROR */
-
 /* Define if on AIX 3.
    System headers sometimes define this.
    We just want to avoid a redefinition error message.  */
@@ -44,18 +32,24 @@
 /* Define if you have a working `mmap' system call.  */
 #define HAVE_MMAP 1
 
+/* Define if you have <vfork.h>.  */
+/* #undef HAVE_VFORK_H */
+
 /* Define as __inline if that's what the C compiler calls it.  */
 /* #undef inline */
 
 /* Define to `long' if <sys/types.h> doesn't define.  */
 /* #undef off_t */
 
-/* Define if you need to in order for stat and other things to work.  */
-/* #undef _POSIX_SOURCE */
+/* Define to `int' if <sys/types.h> doesn't define.  */
+/* #undef pid_t */
 
 /* Define as the return type of signal handlers (int or void).  */
 #define RETSIGTYPE void
 
+/* Define if the `setpgrp' function takes no argument.  */
+/* #undef SETPGRP_VOID */
+
 /* Define to `unsigned' if <sys/types.h> doesn't define.  */
 /* #undef size_t */
 
@@ -74,13 +68,44 @@
 /* Define if you have the ANSI C header files.  */
 #define STDC_HEADERS 1
 
+/* Define vfork as fork if vfork does not work.  */
+/* #undef vfork */
+
+/* Define if compiling on Solaris 7. */
+/* #undef _MSE_INT_H */
+
+/* Define if your struct reg has r_fs.  */
+#define HAVE_STRUCT_REG_R_FS 1
+
+/* Define if your struct reg has r_gs.  */
+#define HAVE_STRUCT_REG_R_GS 1
+
+/* Define if <link.h> exists and defines struct link_map which has
+   members with an ``l_'' prefix.  (For Solaris, SVR4, and
+   SVR4-like systems.) */
+#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1
+
+/* Define if <link.h> exists and defines struct link_map which has
+  members with an ``lm_'' prefix.  (For SunOS.)  */
+/* #undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
+
+/* Define if <link.h> exists and defines a struct so_map which has
+  members with an ``som_'' prefix.  (Found on older *BSD systems.)  */
+/* #undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
+
+/* Define if <sys/link.h> has struct link_map32 */
+/* #undef HAVE_STRUCT_LINK_MAP32 */
+
+/* Define if the prfpregset_t type is broken. */
+/* #undef PRFPREGSET_T_BROKEN */
+
+/* Define if you want to use new multi-fd /proc interface
+   (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
+/* #undef NEW_PROC_API */
+
 /* Define if ioctl argument PIOCSET is available. */
 /* #undef HAVE_PROCFS_PIOCSET */
 
-/* /proc PID entries are directories containing the files
-   ctl as map status */
-/* #undef HAVE_MULTIPLE_PROC_FDS */
-
 /* Define if the `long long' type works.  */
 #define CC_HAS_LONG_LONG 1
 
@@ -112,18 +137,55 @@
    to explicitly deallocate that memory when gdb calls exit. */
 /* #undef MMCHECK_FORCE */
 
-/* Define if you want to use the full-screen terminal user interface.  */
-/* #undef TUI */
-
 /* Define if <proc_service.h> on solaris uses int instead of
    size_t, and assorted other type changes. */
 /* #undef PROC_SERVICE_IS_OLD */
 
+/* If you want to specify a default CPU variant, define this to be its
+   name, as a C string.  */
+/* #undef TARGET_CPU_DEFAULT */
+
+/* Define if the simulator is being linked in.  */
+/* #undef WITH_SIM */
+
 /* Set to true if the save_state_t structure is present */
-#define HAVE_STRUCT_SAVE_STATE_T 0
+/* #undef HAVE_STRUCT_SAVE_STATE_T */
 
 /* Set to true if the save_state_t structure has the ss_wide member */
-#define HAVE_STRUCT_MEMBER_SS_WIDE 0
+/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */
+
+/* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request.  */
+/* #undef HAVE_PTRACE_GETREGS */
+
+/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request.  */
+/* #undef HAVE_PTRACE_GETFPXREGS */
+
+/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request.  */
+#define HAVE_PT_GETDBREGS 1
+
+/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request.  */
+/* #undef HAVE_PT_GETXMMREGS */
+
+/* Define if gnu-regex.c included with GDB should be used. */
+#define USE_INCLUDED_REGEX 1
+
+/* BFD's default architecture. */
+#define DEFAULT_BFD_ARCH bfd_i386_arch
+
+/* BFD's default target vector. */
+#define DEFAULT_BFD_VEC bfd_elf32_i386_vec
+
+/* Multi-arch enabled. */
+/* #undef GDB_MULTI_ARCH */
+
+/* hostfile */
+#define GDB_XM_FILE config/i386/xm-i386.h
+
+/* targetfile */
+#define GDB_TM_FILE config/i386/tm-fbsd.h
+
+/* nativefile */
+#define GDB_NM_FILE config/i386/nm-fbsd.h
 
 /* Define if you have the __argz_count function.  */
 /* #undef HAVE___ARGZ_COUNT */
@@ -143,6 +205,9 @@
 /* Define if you have the bzero function.  */
 #define HAVE_BZERO 1
 
+/* Define if you have the canonicalize_file_name function.  */
+/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
 /* Define if you have the dcgettext function.  */
 /* #undef HAVE_DCGETTEXT */
 
@@ -158,9 +223,15 @@
 /* Define if you have the munmap function.  */
 #define HAVE_MUNMAP 1
 
+/* Define if you have the poll function.  */
+#define HAVE_POLL 1
+
 /* Define if you have the putenv function.  */
 #define HAVE_PUTENV 1
 
+/* Define if you have the realpath function.  */
+#define HAVE_REALPATH 1
+
 /* Define if you have the sbrk function.  */
 #define HAVE_SBRK 1
 
@@ -173,9 +244,21 @@
 /* Define if you have the setpgid function.  */
 #define HAVE_SETPGID 1
 
+/* Define if you have the setpgrp function.  */
+#define HAVE_SETPGRP 1
+
 /* Define if you have the sigaction function.  */
 #define HAVE_SIGACTION 1
 
+/* Define if you have the sigprocmask function.  */
+#define HAVE_SIGPROCMASK 1
+
+/* Define if you have the sigsetmask function.  */
+#define HAVE_SIGSETMASK 1
+
+/* Define if you have the socketpair function.  */
+#define HAVE_SOCKETPAIR 1
+
 /* Define if you have the stpcpy function.  */
 /* #undef HAVE_STPCPY */
 
@@ -197,8 +280,8 @@
 /* Define if you have the <curses.h> header file.  */
 #define HAVE_CURSES_H 1
 
-/* Define if you have the <endian.h> header file.  */
-/* #undef HAVE_ENDIAN_H */
+/* Define if you have the <dirent.h> header file.  */
+#define HAVE_DIRENT_H 1
 
 /* Define if you have the <limits.h> header file.  */
 #define HAVE_LIMITS_H 1
@@ -215,12 +298,27 @@
 /* Define if you have the <memory.h> header file.  */
 #define HAVE_MEMORY_H 1
 
+/* Define if you have the <ncurses.h> header file.  */
+#define HAVE_NCURSES_H 1
+
+/* Define if you have the <ndir.h> header file.  */
+/* #undef HAVE_NDIR_H */
+
 /* Define if you have the <nl_types.h> header file.  */
 #define HAVE_NL_TYPES_H 1
 
+/* Define if you have the <nlist.h> header file.  */
+#define HAVE_NLIST_H 1
+
 /* Define if you have the <objlist.h> header file.  */
 /* #undef HAVE_OBJLIST_H */
 
+/* Define if you have the <poll.h> header file.  */
+#define HAVE_POLL_H 1
+
+/* Define if you have the <proc_service.h> header file.  */
+/* #undef HAVE_PROC_SERVICE_H */
+
 /* Define if you have the <ptrace.h> header file.  */
 /* #undef HAVE_PTRACE_H */
 
@@ -230,6 +328,9 @@
 /* Define if you have the <stddef.h> header file.  */
 #define HAVE_STDDEF_H 1
 
+/* Define if you have the <stdint.h> header file.  */
+#define HAVE_STDINT_H 1
+
 /* Define if you have the <stdlib.h> header file.  */
 #define HAVE_STDLIB_H 1
 
@@ -239,9 +340,30 @@
 /* Define if you have the <sys/debugreg.h> header file.  */
 /* #undef HAVE_SYS_DEBUGREG_H */
 
+/* Define if you have the <sys/dir.h> header file.  */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/fault.h> header file.  */
+/* #undef HAVE_SYS_FAULT_H */
+
+/* Define if you have the <sys/file.h> header file.  */
+#define HAVE_SYS_FILE_H 1
+
+/* Define if you have the <sys/filio.h> header file.  */
+#define HAVE_SYS_FILIO_H 1
+
+/* Define if you have the <sys/ioctl.h> header file.  */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define if you have the <sys/ndir.h> header file.  */
+/* #undef HAVE_SYS_NDIR_H */
+
 /* Define if you have the <sys/param.h> header file.  */
 #define HAVE_SYS_PARAM_H 1
 
+/* Define if you have the <sys/poll.h> header file.  */
+#define HAVE_SYS_POLL_H 1
+
 /* Define if you have the <sys/procfs.h> header file.  */
 #define HAVE_SYS_PROCFS_H 1
 
@@ -251,6 +373,15 @@
 /* Define if you have the <sys/reg.h> header file.  */
 /* #undef HAVE_SYS_REG_H */
 
+/* Define if you have the <sys/select.h> header file.  */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <sys/syscall.h> header file.  */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define if you have the <sys/user.h> header file.  */
+#define HAVE_SYS_USER_H 1
+
 /* Define if you have the <sys/wait.h> header file.  */
 #define HAVE_SYS_WAIT_H 1
 
@@ -263,6 +394,12 @@
 /* Define if you have the <termios.h> header file.  */
 #define HAVE_TERMIOS_H 1
 
+/* Define if you have the <thread_db.h> header file.  */
+/* #undef HAVE_THREAD_DB_H */
+
+/* Define if you have the <time.h> header file.  */
+#define HAVE_TIME_H 1
+
 /* Define if you have the <unistd.h> header file.  */
 #define HAVE_UNISTD_H 1
 
@@ -273,10 +410,10 @@
 /* #undef HAVE_WAIT_H */
 
 /* Define if you have the <wchar.h> header file.  */
-/* #undef HAVE_WCHAR_H */
+#define HAVE_WCHAR_H 1
 
 /* Define if you have the <wctype.h> header file.  */
-/* #undef HAVE_WCTYPE_H */
+#define HAVE_WCTYPE_H 1
 
 /* Define if you have the dl library (-ldl).  */
 /* #undef HAVE_LIBDL */
@@ -284,6 +421,9 @@
 /* Define if you have the m library (-lm).  */
 #define HAVE_LIBM 1
 
+/* Define if you have the socket library (-lsocket).  */
+/* #undef HAVE_LIBSOCKET */
+
 /* Define if you have the w library (-lw).  */
 /* #undef HAVE_LIBW */
 
@@ -294,11 +434,14 @@
 #define HAVE_LC_MESSAGES 1
 
 /* Define to 1 if NLS is requested */
-#define ENABLE_NLS 1
+/* #define ENABLE_NLS 1 */
 
 /* Define as 1 if you have gettext and don't want to use GNU gettext. */
 /* #undef HAVE_GETTEXT */
 
+/* Define if sigsetjmp is available.  */
+#define HAVE_SIGSETJMP 1
+
 /* Define if malloc is not declared in system header files. */
 /* #undef NEED_DECLARATION_MALLOC */
 
@@ -314,6 +457,9 @@
 /* Define if strdup is not declared in system header files. */
 /* #undef NEED_DECLARATION_STRDUP */
 
+/* Define if strstr is not declared in system header files. */
+/* #undef NEED_DECLARATION_STRSTR */
+
 /* Define if <sys/procfs.h> has pstatus_t. */
 /* #undef HAVE_PSTATUS_T */
 
@@ -328,3 +474,33 @@
 /* Define if <sys/procfs.h> has fpregset_t. */
 #define HAVE_FPREGSET_T 1
 
+/* Define if <sys/procfs.h> has prgregset_t. */
+/* #undef HAVE_PRGREGSET_T */
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#define HAVE_PRFPREGSET_T 1
+
+/* Define if <sys/procfs.h> has prgregset32_t. */
+/* #undef HAVE_PRGREGSET32_T */
+
+/* Define if <sys/procfs.h> has prfpregset32_t. */
+/* #undef HAVE_PRFPREGSET32_T */
+
+/* Define if <sys/procfs.h> has lwpid_t. */
+/* #undef HAVE_LWPID_T */
+
+/* Define if <sys/procfs.h> has psaddr_t. */
+/* #undef HAVE_PSADDR_T */
+
+/* Define if <sys/procfs.h> has prsysent_t. */
+/* #undef HAVE_PRSYSENT_T */
+
+/* Define if <sys/procfs.h> has pr_sigset_t. */
+/* #undef HAVE_PR_SIGSET_T */
+
+/* Define if <sys/procfs.h> has pr_sigaction64_t. */
+/* #undef HAVE_PR_SIGACTION64_T */
+
+/* Define if <sys/procfs.h> has pr_siginfo64_t. */
+/* #undef HAVE_PR_SIGINFO64_T */
+

==== //depot/projects/kse/sys/conf/files#41 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.654 2002/06/26 03:34:43 ken Exp $
+# $FreeBSD: src/sys/conf/files,v 1.655 2002/06/27 23:02:17 luigi Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1165,7 +1165,7 @@
 netinet/ip_encap.c	optional inet
 netinet/ip_encap.c	optional inet6
 netinet/ip_flow.c	optional inet
-netinet/ip_fw.c		optional ipfirewall
+netinet/ip_fw2.c	optional ipfirewall
 netinet/ip_icmp.c	optional inet
 netinet/ip_input.c	optional inet
 netinet/ip_mroute.c	optional inet

==== //depot/projects/kse/sys/dev/sound/pci/ich.c#15 (text+ko) ====

@@ -32,7 +32,7 @@
 #include <pci/pcireg.h>
 #include <pci/pcivar.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.21 2002/05/05 15:37:09 orion Exp $");
+SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pci/ich.c,v 1.22 2002/06/27 22:36:01 scottl Exp $");
 
 /* -------------------------------------------------------------------- */
 
@@ -85,6 +85,8 @@
 	struct sc_chinfo ch[3];
 	int ac97rate;
 	struct ich_desc *dtbl;
+	struct intr_config_hook	intrhook;
+	int use_intrhook;
 };
 
 /* -------------------------------------------------------------------- */
@@ -455,13 +457,20 @@
 /* Calibrate card (some boards are overclocked and need scaling) */
 
 static
-unsigned int ich_calibrate(struct sc_info *sc)
+void ich_calibrate(void *arg)
 {
-	struct sc_chinfo *ch = &sc->ch[1];
+	struct sc_info *sc;
+	struct sc_chinfo *ch;
 	struct timeval t1, t2;
 	u_int8_t ociv, nciv;
 	u_int32_t wait_us, actual_48k_rate, bytes;
 
+	sc = (struct sc_info *)arg;
+	ch = &sc->ch[1];
+
+	if (sc->use_intrhook)
+		config_intrhook_disestablish(&sc->intrhook);
+
 	/*
 	 * Grab audio from input for fixed interval and compare how
 	 * much we actually get with what we expect.  Interval needs
@@ -516,7 +525,7 @@
 
 	if (nciv == ociv) {
 		device_printf(sc->dev, "ac97 link rate calibration timed out after %d us\n", wait_us);
-		return 0;
+		return;
 	}
 
 	actual_48k_rate = (bytes * 250000) / wait_us;
@@ -534,7 +543,7 @@
 	 	printf("\n");
 	}
 
-	return sc->ac97rate;
+	return;
 }
 
 /* -------------------------------------------------------------------- */
@@ -708,7 +717,15 @@
 	pcm_setstatus(dev, status);
 
 	ich_initsys(sc);
-	ich_calibrate(sc);
+
+	sc->intrhook.ich_func = ich_calibrate;
+	sc->intrhook.ich_arg = sc;
+	sc->use_intrhook = 1;
+	if (config_intrhook_establish(&sc->intrhook) != 0) {
+		device_printf(dev, "Cannot establish calibration hook, will calibrate now\n");
+		sc->use_intrhook = 0;
+		ich_calibrate(sc);
+	}
 
 	return 0;
 

==== //depot/projects/kse/sys/kern/kern_poll.c#7 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/kern/kern_poll.c,v 1.6 2002/03/09 08:02:52 luigi Exp $
+ * $FreeBSD: src/sys/kern/kern_poll.c,v 1.7 2002/06/27 23:23:04 luigi Exp $
  */
 
 #include <sys/param.h>
@@ -195,6 +195,12 @@
 /*
  * Hook from hardclock. Tries to schedule a netisr, but keeps track
  * of lost ticks due to the previous handler taking too long.
+ * Normally, this should not happen, because polling handler should
+ * run for a short time. However, in some cases (e.g. when there are
+ * changes in link status etc.) the drivers take a very long time
+ * (even in the order of milliseconds) to reset and reconfigure the
+ * device, causing apparent lost polls.
+ *
  * The first part of the code is just for debugging purposes, and tries
  * to count how often hardclock ticks are shorter than they should,
  * meaning either stray interrupts or delayed events.
@@ -217,10 +223,11 @@
 		prev_t = t;
 
 	if (pending_polls > 100) {
-		/* too much, assume it has stalled */
+		/*
+		 * Too much, assume it has stalled (not always true
+		 * see comment above).
+		 */
 		stalled++;
-		printf("poll stalled [%d] in phase %d\n",
-			stalled, phase);
 		pending_polls = 0;
 		phase = 0;
 	}

==== //depot/projects/kse/sys/netinet/ip_dummynet.c#8 (text+ko) ====

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2001 Luigi Rizzo, Universita` di Pisa
+ * Copyright (c) 1998-2002 Luigi Rizzo, Universita` di Pisa
  * Portions Copyright (c) 2000 Akamba Corp.
  * All rights reserved
  *
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.47 2002/06/22 11:51:02 luigi Exp $
+ * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.48 2002/06/27 23:02:17 luigi Exp $
  */
 
 #define DEB(x)
@@ -61,7 +61,6 @@
 #include <sys/systm.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
-#include <sys/queue.h>			/* XXX */
 #include <sys/kernel.h>
 #include <sys/module.h>
 #include <sys/proc.h>
@@ -166,12 +165,6 @@
 
 int if_tx_rdy(struct ifnet *ifp);
 
-/*
- * ip_fw_chain_head is used when deleting a pipe, because ipfw rules can
- * hold references to the pipe.
- */
-extern LIST_HEAD (ip_fw_head, ip_fw) ip_fw_chain_head;
-
 static void
 rt_unref(struct rtentry *rt)
 {
@@ -1023,9 +1016,13 @@
 struct dn_flow_set *
 locate_flowset(int pipe_nr, struct ip_fw *rule)
 {
-    struct dn_flow_set *fs = NULL ;
+    ipfw_insn_pipe *cmd = (ipfw_insn_pipe *)(rule->cmd + rule->act_ofs);
+    struct dn_flow_set *fs = (struct dn_flow_set *)(cmd->pipe_ptr);
+
+    if (fs != NULL)
+	return fs;
 
-    if ( (rule->fw_flg & IP_FW_F_COMMAND) == IP_FW_F_QUEUE )
+    if ( cmd->o.opcode == O_QUEUE )
 	for (fs=all_flow_sets; fs && fs->fs_nr != pipe_nr; fs=fs->next)
 	    ;
     else {
@@ -1035,8 +1032,7 @@
 	if (p1 != NULL)
 	    fs = &(p1->fs) ;
     }
-    if (fs != NULL)
-	rule->pipe_ptr = fs ; /* record for the future */
+    (struct dn_flow_set *)(cmd->pipe_ptr) = fs; /* record for the future */
     return fs ;
 }
 
@@ -1065,16 +1061,18 @@
     u_int64_t len = m->m_pkthdr.len ;
     struct dn_flow_queue *q = NULL ;
     int s ;
+    int action = fwa->rule->cmd[fwa->rule->act_ofs].opcode;
 
     s = splimp();
 
     pipe_nr &= 0xffff ;
 
-    if ( (fs = fwa->rule->pipe_ptr) == NULL ) {
-	fs = locate_flowset(pipe_nr, fwa->rule);
-	if (fs == NULL)
-	    goto dropit ;	/* this queue/pipe does not exist! */
-    }
+    /*
+     * this is a dummynet rule, so we expect a O_PIPE or O_QUEUE rule
+     */
+    fs = locate_flowset(pipe_nr, fwa->rule);
+    if (fs == NULL)
+	goto dropit ;	/* this queue/pipe does not exist! */
     pipe = fs->pipe ;
     if (pipe == NULL) { /* must be a queue, try find a matching pipe */
 	for (pipe = all_pipes; pipe && pipe->pipe_nr != fs->parent_nr;
@@ -1152,7 +1150,7 @@
      * to schedule it. This involves different actions for fixed-rate or
      * WF2Q queues.
      */
-    if ( (fwa->rule->fw_flg & IP_FW_F_COMMAND) == IP_FW_F_PIPE ) {
+    if ( action == O_PIPE ) {
 	/*
 	 * Fixed-rate queue: just insert into the ready_heap.
 	 */
@@ -1302,15 +1300,13 @@
 dummynet_flush()
 {
     struct dn_pipe *curr_p, *p ;
-    struct ip_fw *rule ;
     struct dn_flow_set *fs, *curr_fs;
     int s ;
 
     s = splimp() ;
 
     /* remove all references to pipes ...*/
-    LIST_FOREACH(rule, &ip_fw_chain_head, next)
-	rule->pipe_ptr = NULL ;
+    flush_pipe_ptrs(NULL);
     /* prevent future matches... */
     p = all_pipes ;
     all_pipes = NULL ; 
@@ -1375,8 +1371,8 @@
 	fs = &(p->fs) ;
 	dn_rule_delete_fs(fs, r);
 	for (pkt = p->head ; pkt ; pkt = DN_NEXT(pkt) )
-	    if (pkt->rule == r)
-		pkt->rule = ip_fw_default_rule ;
+	    if (pkt->hdr.mh_data == r)
+		pkt->hdr.mh_data = (void *)ip_fw_default_rule ;
     }
 }
 
@@ -1663,7 +1659,6 @@
 delete_pipe(struct dn_pipe *p)
 {
     int s ;
-    struct ip_fw *rule ;
 
     if (p->pipe_nr == 0 && p->fs.fs_nr == 0)
 	return EINVAL ;
@@ -1687,9 +1682,7 @@
 	else
 	    a->next = b->next ;
 	/* remove references to this pipe from the ip_fw rules. */
-	LIST_FOREACH(rule, &ip_fw_chain_head, next)
-	    if (rule->pipe_ptr == &(b->fs))
-		rule->pipe_ptr = NULL ;
+	flush_pipe_ptrs(&(b->fs));
 
 	/* remove all references to this pipe from flow_sets */
 	for (fs = all_flow_sets; fs; fs= fs->next )
@@ -1721,9 +1714,7 @@
 	else
 	    a->next = b->next ;
 	/* remove references to this flow_set from the ip_fw rules. */
-	LIST_FOREACH(rule, &ip_fw_chain_head, next)
-	    if (rule->pipe_ptr == b)
-		rule->pipe_ptr = NULL ;
+	flush_pipe_ptrs(b);
 
 	if (b->pipe != NULL) {
 	    /* Update total weight on parent pipe and cleanup parent heaps */
@@ -1847,9 +1838,14 @@
 
     /* Disallow sets in really-really secure mode. */
     if (sopt->sopt_dir == SOPT_SET) {
+#if __FreeBSD_version >= 500034
 	error =  securelevel_ge(sopt->sopt_td->td_ucred, 3);
 	if (error)
 	    return (error);
+#else
+	if (securelevel >= 3)
+	    return (EPERM);
+#endif
     }
 
     switch (sopt->sopt_name) {

==== //depot/projects/kse/sys/netinet/ip_fw.h#9 (text+ko) ====

@@ -1,183 +1,305 @@
 /*
- * Copyright (c) 1993 Daniel Boulet
- * Copyright (c) 1994 Ugen J.S.Antsilevich
+ * Copyright (c) 2002 Luigi Rizzo, Universita` di Pisa
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * Redistribution and use in source forms, with and without modification,
- * are permitted provided that this entire comment appears intact.
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
- * Redistribution in binary form may occur without any restrictions.
- * Obviously, it would be nice if you gave credit where credit is due
- * but requiring it would be too onerous.
+ * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.69 2002/06/27 23:02:17 luigi Exp $
+ */
+
+#ifndef _IPFW2_H
+#define _IPFW2_H
+
+/*
+ * The kernel representation of ipfw rules is made of a list of
+ * 'instructions' (for all practical purposes equivalent to BPF
+ * instructions), which specify which fields of the packet
+ * (or its metatada) should be analysed.
  *
- * This software is provided ``AS IS'' without any warranties of any kind.
+ * Each instruction is stored in a structure which begins with
+ * "ipfw_insn", and can contain extra fields depending on the
+ * instruction type (listed below).
  *
- * $FreeBSD: src/sys/netinet/ip_fw.h,v 1.68 2002/06/22 11:51:02 luigi Exp $
+ * "enum ipfw_opcodes" are the opcodes supported. We can have up
+ * to 256 different opcodes.
  */
 
-#ifndef _IP_FW_H
-#define _IP_FW_H
+enum ipfw_opcodes {		/* arguments (4 byte each)	*/
+	O_NOP,
+
+	O_IP_SRC,		/* u32 = IP			*/
+	O_IP_SRC_MASK,		/* ip = IP/mask			*/
+	O_IP_SRC_ME,		/* none				*/
+	O_IP_SRC_SET,		/* u32=base, arg1=len, bitmap	*/
+
+	O_IP_DST,		/* u32 = IP			*/
+	O_IP_DST_MASK,		/* ip = IP/mask			*/
+	O_IP_DST_ME,		/* none				*/
+	O_IP_DST_SET,		/* u32=base, arg1=len, bitmap	*/
+
+	O_IP_SRCPORT,		/* (n)port list:mask 4 byte ea	*/
+	O_IP_DSTPORT,		/* (n)port list:mask 4 byte ea	*/
+	O_PROTO,		/* arg1=protocol		*/
+
+	O_MACADDR2,		/* 2 mac addr:mask		*/
+	O_MAC_TYPE,		/* same as srcport		*/
+
+	O_LAYER2,		/* none				*/
+	O_IN,			/* none				*/
+	O_FRAG,			/* none				*/
+
+	O_RECV,			/* none				*/
+	O_XMIT,			/* none				*/
+	O_VIA,			/* none				*/
+
+	O_IPOPT,		/* arg1 = 2*u8 bitmap		*/
+	O_IPLEN,		/* arg1 = len			*/
+	O_IPID,			/* arg1 = id			*/
+
+	O_IPPRE,		/* arg1 = id			*/
+	O_IPTOS,		/* arg1 = id			*/
+	O_IPTTL,		/* arg1 = TTL			*/
+
+	O_IPVER,		/* arg1 = version		*/
+	O_UID,			/* u32 = id			*/
+	O_GID,			/* u32 = id			*/
+	O_ESTAB,		/* none (tcp established)	*/
+	O_TCPFLAGS,		/* arg1 = 2*u8 bitmap		*/
+	O_TCPWIN,		/* arg1 = desired win		*/
+	O_TCPSEQ,		/* u32 = desired seq.		*/
+	O_TCPACK,		/* u32 = desired seq.		*/
+	O_ICMPTYPE,		/* u32 = icmp bitmap		*/
+	O_TCPOPTS,		/* arg1 = 2*u8 bitmap		*/
+	O_IPOPTS,		/* arg1 = 2*u8 bitmap		*/
+
+	O_PROBE_STATE,		/* none				*/
+	O_KEEP_STATE,		/* none				*/
+	O_LIMIT,		/* ipfw_insn_limit		*/
+	O_LIMIT_PARENT,		/* dyn_type, not an opcode.	*/
+	/*
+	 * these are really 'actions', and must be last in the list.
+	 */
+
+	O_LOG,			/* ipfw_insn_log		*/
+	O_PROB,			/* u32 = match probability	*/
 
-#include <sys/queue.h>
+	O_CHECK_STATE,		/* none				*/
+	O_ACCEPT,		/* none				*/
+	O_DENY,			/* none 			*/
+	O_REJECT,		/* arg1=icmp arg (same as deny)	*/
+	O_COUNT,		/* none				*/
+	O_SKIPTO,		/* arg1=next rule number	*/
+	O_PIPE,			/* arg1=pipe number		*/
+	O_QUEUE,		/* arg1=queue number		*/
+	O_DIVERT,		/* arg1=port number		*/
+	O_TEE,			/* arg1=port number		*/
+	O_FORWARD_IP,		/* fwd sockaddr			*/
+	O_FORWARD_MAC,		/* fwd mac			*/
+	O_LAST_OPCODE		/* not an opcode!		*/
+};
 
 /*
- * This union structure identifies an interface, either explicitly
- * by name or implicitly by IP address. The flags IP_FW_F_IIFNAME
- * and IP_FW_F_OIFNAME say how to interpret this structure. An
- * interface unit number of -1 matches any unit number, while an
- * IP address of 0.0.0.0 indicates matches any interface.
+ * Template for instructions.
+ *
+ * ipfw_insn is used for all instructions which require no operands,
+ * a single 16-bit value (arg1), or a couple of 8-bit values.
+ *
+ * For other instructions which require different/larger arguments
+ * we have derived structures, ipfw_insn_*.
+ *
+ * The size of the instruction (in 32-bit words) is in the low
+ * 6 bits of "len". The 2 remaining bits are used to implement
+ * NOT and OR on individual instructions. Given a type, you can
+ * compute the length to be put in "len" using F_INSN_SIZE(t)
+ *
+ * F_NOT	negates the match result of the instruction.
+ *
+ * F_OR		is used to build or blocks. By default, instructions
+ *		are evaluated as part of a logical AND. An "or" block
+ *		{ X or Y or Z } contains F_OR set in all but the last
+ *		instruction of the block. A match will cause the code
+ *		to skip past the last instruction of the block.
+ *
+ * NOTA BENE: in a couple of places we assume that
+ *	sizeof(ipfw_insn) == sizeof(u_int32_t)
+ * this needs to be fixed.
  *
- * The receive and transmit interfaces are only compared against the
- * the packet if the corresponding bit (IP_FW_F_IIFACE or IP_FW_F_OIFACE)
- * is set. Note some packets lack a receive or transmit interface
- * (in which case the missing "interface" never matches).
  */
+typedef struct	_ipfw_insn {	/* template for instructions */
+	enum ipfw_opcodes	opcode:8;
+	u_int8_t	len;	/* numer of 32-byte words */
+#define	F_NOT		0x80
+#define	F_OR		0x40
+#define	F_LEN_MASK	0x3f
+#define	F_LEN(cmd)	((cmd)->len & F_LEN_MASK)
 
-union ip_fw_if {
-	struct in_addr	fu_via_ip;	/* Specified by IP address */
-	struct {			/* Specified by interface name */
-#define FW_IFNLEN	10		/* need room ! was IFNAMSIZ */
-		char	name[FW_IFNLEN];
-		short	unit;		/* -1 means match any unit */
-	} fu_via_if;
-};
+	u_int16_t	arg1;
+} ipfw_insn;
+
+/*
+ * The F_INSN_SIZE(type) computes the size, in 4-byte words, of
+ * a given type.
+ */
+#define	F_INSN_SIZE(t)	((sizeof (t))/sizeof(u_int32_t))
 
 /*
- * Format of an IP firewall descriptor
- *
- * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order.
- * fw_flg and fw_n*p are stored in host byte order (of course).
- * Port numbers are stored in HOST byte order.
+ * This is used to store an array of 16-bit entries (ports etc.)
  */
+typedef struct	_ipfw_insn_u16 {
+	ipfw_insn o;
+	u_int16_t ports[2];	/* there may be more */
+} ipfw_insn_u16;
 
 /*
- * To match MAC headers:
- *     12 bytes at fw_mac_hdr contain the dst-src MAC address after masking.
- *     12 bytes at fw_mac_mask contain the mask to apply to dst-src
- *     2 bytes at fw_mac_type contain the mac type after mask (in net format)
- *     2 bytes at fw_mac_type_mask contain the mac type mask
- *         If IP_FW_F_SRNG, the two contain the low-high of a range of types.
- *     IP_FW_F_DRNG is used to indicare we want to match a vlan.
+ * This is used to store an array of 32-bit entries
+ * (uid, single IPv4 addresses etc.)
  */
-#define	fw_mac_hdr		fw_src
-#define	fw_mac_mask		fw_uar
-#define	fw_mac_type		fw_iplen
-#define	fw_mac_mask_type	fw_ipid
+typedef struct	_ipfw_insn_u32 {
+	ipfw_insn o;
+	u_int32_t d[1];	/* one or more */
+} ipfw_insn_u32;
 
-struct ip_fw {
-	LIST_ENTRY(ip_fw) next;		/* bidirectional list of rules */
-	u_int		fw_flg;		/* Operational Flags word */
-	u_int64_t	fw_pcnt;	/* Packet counters */
-	u_int64_t	fw_bcnt;	/* Byte counters */
+/*
+ * This is used to store IP addr-mask pairs.
+ */
+typedef struct	_ipfw_insn_ip {
+	ipfw_insn o;
+	struct in_addr	addr;
+	struct in_addr	mask;
+} ipfw_insn_ip;
 
-	struct in_addr	fw_src;		/* Source IP address */
-	struct in_addr	fw_dst;		/* Destination IP address */
-	struct in_addr	fw_smsk;	/* Mask for source IP address */
-	struct in_addr	fw_dmsk;	/* Mask for destination address */
-	u_short		fw_number;	/* Rule number */
-	u_char		fw_prot;	/* IP protocol */
-#if 1
-	u_char		fw_nports;	/* # of src/dst port in array */
-#define	IP_FW_GETNSRCP(rule)		((rule)->fw_nports & 0x0f)
-#define	IP_FW_SETNSRCP(rule, n)		do {				\
-					    (rule)->fw_nports &= ~0x0f;	\
-					    (rule)->fw_nports |= (n);	\
-					} while (0)
-#define	IP_FW_GETNDSTP(rule)		((rule)->fw_nports >> 4)
-#define	IP_FW_SETNDSTP(rule, n)		do {				  \
-					    (rule)->fw_nports &= ~0xf0;	  \
-					    (rule)->fw_nports |= (n) << 4;\
-					} while (0)
-#define	IP_FW_HAVEPORTS(rule)		((rule)->fw_nports != 0)
-#else
-	u_char		__pad[1];
-	u_int		_nsrcp;
-	u_int		_ndstp;
-#define	IP_FW_GETNSRCP(rule)		(rule)->_nsrcp
-#define	IP_FW_SETNSRCP(rule,n)		(rule)->_nsrcp = n
-#define	IP_FW_GETNDSTP(rule)		(rule)->_ndstp
-#define	IP_FW_SETNDSTP(rule,n)		(rule)->_ndstp = n
-#define	IP_FW_HAVEPORTS(rule)		((rule)->_ndstp + (rule)->_nsrcp != 0)
-#endif
-#define	IP_FW_MAX_PORTS	10		/* A reasonable maximum */
-    union {
-	u_short		fw_pts[IP_FW_MAX_PORTS]; /* port numbers to match */

>>> TRUNCATED FOR MAIL (1000 lines) <<<

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206280448.g5S4mSiC022759>