PERFORCE change 34416 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat Jul 12 21:26:02 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=34416

Change 34416 by marcel at marcel_nfs on 2003/07/12 21:25:01

	IFC @34415

Affected files ...

.. //depot/projects/ia64/contrib/gcc/config/i386/freebsd.h#18 integrate
.. //depot/projects/ia64/etc/rc.d/sshd#3 integrate
.. //depot/projects/ia64/gnu/lib/csu/Makefile#16 integrate
.. //depot/projects/ia64/gnu/usr.bin/cc/cc_tools/auto-host.h#13 integrate
.. //depot/projects/ia64/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#103 integrate
.. //depot/projects/ia64/release/scripts/print-cdrom-packages.sh#25 integrate
.. //depot/projects/ia64/sbin/ipfw/ipfw.8#23 integrate
.. //depot/projects/ia64/sbin/ipfw/ipfw2.c#21 integrate
.. //depot/projects/ia64/sys/dev/ciss/ciss.c#22 integrate
.. //depot/projects/ia64/sys/dev/firewire/fwdev.c#17 integrate
.. //depot/projects/ia64/sys/dev/kbd/atkbdcreg.h#3 integrate
.. //depot/projects/ia64/sys/ia64/ia64/trap.c#59 integrate
.. //depot/projects/ia64/sys/ia64/include/ia64_cpu.h#6 integrate
.. //depot/projects/ia64/sys/isa/psm.c#17 integrate
.. //depot/projects/ia64/sys/kern/kern_descrip.c#60 integrate
.. //depot/projects/ia64/sys/kern/kern_lock.c#18 integrate
.. //depot/projects/ia64/sys/kern/kern_mtxpool.c#8 integrate
.. //depot/projects/ia64/sys/kern/kern_prot.c#29 integrate
.. //depot/projects/ia64/sys/kern/kern_resource.c#25 integrate
.. //depot/projects/ia64/sys/kern/kern_sx.c#8 integrate
.. //depot/projects/ia64/sys/netinet/ip_fw2.c#24 integrate
.. //depot/projects/ia64/sys/sys/kernel.h#13 integrate
.. //depot/projects/ia64/sys/sys/mutex.h#14 integrate
.. //depot/projects/ia64/usr.sbin/fwcontrol/fwcontrol.c#10 integrate
.. //depot/projects/ia64/usr.sbin/sysinstall/config.c#12 integrate
.. //depot/projects/ia64/usr.sbin/sysinstall/menus.c#31 integrate
.. //depot/projects/ia64/usr.sbin/sysinstall/sysinstall.h#22 integrate
.. //depot/projects/ia64/usr.sbin/sysinstall/variable.c#3 integrate
.. //depot/projects/ia64/usr.sbin/usbd/usbd.c#7 integrate

Differences ...

==== //depot/projects/ia64/contrib/gcc/config/i386/freebsd.h#18 (text+ko) ====

@@ -22,7 +22,7 @@
 the Free Software Foundation, 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* $FreeBSD: src/contrib/gcc/config/i386/freebsd.h,v 1.63 2003/07/11 05:01:52 kan Exp $ */
+/* $FreeBSD: src/contrib/gcc/config/i386/freebsd.h,v 1.64 2003/07/12 19:33:34 kan Exp $ */
 
 #undef  CC1_SPEC
 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
@@ -128,10 +128,12 @@
    compiler get the contents of <float.h> and std::numeric_limits correct.  */
 #define SUBTARGET_OVERRIDE_OPTIONS			\
   do {							\
-    real_format_for_mode[XFmode - QFmode]		\
-      = &ieee_extended_intel_96_round_53_format;	\
-    real_format_for_mode[TFmode - QFmode]		\
-      = &ieee_extended_intel_96_round_53_format;	\
+    if (!TARGET_64BIT) {				\
+      real_format_for_mode[XFmode - QFmode]		\
+	= &ieee_extended_intel_96_round_53_format;	\
+      real_format_for_mode[TFmode - QFmode]		\
+	= &ieee_extended_intel_96_round_53_format;	\
+    }							\
   } while (0)
 
 /* Tell final.c that we don't need a label passed to mcount.  */

==== //depot/projects/ia64/etc/rc.d/sshd#3 (text+ko) ====

@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # $NetBSD: sshd,v 1.18 2002/04/29 08:23:34 lukem Exp $
-# $FreeBSD: src/etc/rc.d/sshd,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $FreeBSD: src/etc/rc.d/sshd,v 1.3 2003/07/13 01:49:07 mtm Exp $
 #
 
 # PROVIDE: sshd
@@ -12,12 +12,16 @@
 
 name="sshd"
 rcvar=`set_rcvar`
-command="/usr/sbin/${name}"
 keygen_cmd="sshd_keygen"
 start_precmd="sshd_precmd"
 pidfile="/var/run/${name}.pid"
-required_files="/etc/ssh/sshd_config"
 extra_commands="keygen reload"
+case ${OSTYPE} in
+NetBSD)
+	command="/usr/sbin/${name}"
+	required_files="/etc/ssh/sshd_config"
+	;;
+esac
 
 sshd_keygen()
 {

==== //depot/projects/ia64/gnu/lib/csu/Makefile#16 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/gnu/lib/csu/Makefile,v 1.19 2003/07/11 05:27:23 kan Exp $
+# $FreeBSD: src/gnu/lib/csu/Makefile,v 1.20 2003/07/13 02:41:48 kan Exp $
 
 GCCDIR=	${.CURDIR}/../../../contrib/gcc
 CCDIR=	${.CURDIR}/../../usr.bin/cc
@@ -23,6 +23,7 @@
 BEGINSRC=	crtbegin.asm
 ENDSRC=		crtend.asm
 CFLAGS+=	-x assembler-with-cpp	# Ugly hack
+CFLAGS+=	-include osreldate.h
 .undef SRCS				# hack for 'make depend'
 .endif
 .if ${MACHINE_ARCH} == "powerpc"

==== //depot/projects/ia64/gnu/usr.bin/cc/cc_tools/auto-host.h#13 (text+ko) ====

@@ -1,6 +1,8 @@
-/* $FreeBSD: src/gnu/usr.bin/cc/cc_tools/auto-host.h,v 1.15 2003/07/11 18:55:58 kan Exp $ */
+/* $FreeBSD: src/gnu/usr.bin/cc/cc_tools/auto-host.h,v 1.16 2003/07/13 02:41:48 kan Exp $ */
 
-#include <osreldate.h>
+#ifndef __FreeBSD_version
+#include <sys/param.h>
+#endif
 
 /* auto-host.h.  Generated automatically by configure.  */
 /* config.in.  Generated automatically from configure.in by autoheader.  */

==== //depot/projects/ia64/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#103 (text+ko) ====

@@ -3,7 +3,7 @@
 
   <corpauthor>The FreeBSD Project</corpauthor>
 
-  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.583 2003/07/07 22:44:38 bmah Exp $</pubdate>
+  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.584 2003/07/12 07:41:39 hrs Exp $</pubdate>
 
   <copyright>
     <year>2000</year>
@@ -169,6 +169,8 @@
     <sect3 id="net-proto">
       <title>Network Protocols</title>
 
+      <para>&man.ipfw.4; rules now support C++-style comment.</para>
+
       <para>To reduce information leakage, IPv4 packets no longer have
 	a <varname>ip_id</varname> field set unless fragmentation is
 	being done.</para>
@@ -226,6 +228,9 @@
     <para>The dev_db utility is unnecessary due to the mandatory
       presence of devfs, and has been removed.</para>
 
+    <para>&man.ipfw.8; <literal>list</literal> and <literal>show</literal>
+      command now support ranges of rule numbers.</para>
+
     <para>The <filename>libcipher</filename> DES cryptography library
       has been removed.  All of its functionality is provided by the
       <filename>libcrypto</filename> library, and all base systems
@@ -248,6 +253,9 @@
     <para>&man.ps.1; now supports a <option>-H</option> to display all
       kernel-visible threads in each process.</para>
 
+    <para>A bug that &man.rarpd.8; does not recognize removable Ethernet NICs
+      is fixed.</para>
+
     <para>A number of utilities available in <filename>/bin</filename>
       and <filename>/sbin</filename> are now available as a
       statically-linked <quote>crunched</quote> binary that lives in
@@ -275,6 +283,9 @@
     <para><application>BIND</application> has been updated from 8.3.4
       to 8.3.6.</para>
 
+    <para><application>GCC</application> has been updated from 3.2.2 to
+      3.3.1-prerelease (a 11 July 2003 snapshot).</para>
+
     <para><application>lukemftp</application> has been updated from
       1.6beta2 to a 30 June 2003 snapshot from NetBSD.</para>
 
@@ -290,7 +301,13 @@
   <sect2 id="ports">
     <title>Ports/Packages Collection Infrastructure</title>
 
-    <para></para>
+    <para>If <makevar>GNU_CONFIGURE</makevar> is defined,
+      all instances of config.guess and config.sub found
+      under <filename><makevar>WRKDIR</makevar></filename>
+      are replaced with the master versions from
+      <filename><makevar>PORTSDIR</makevar>/Template</filename>.
+      This allows old ports (which contain old versions
+      of these scripts) to build on newer architectures like ia64 and amd64.</para>
 
   </sect2>
 

==== //depot/projects/ia64/release/scripts/print-cdrom-packages.sh#25 (text+ko) ====

@@ -2,7 +2,7 @@
 #
 # Author:	Jordan Hubbard
 # Date:		Mon Jul 10 01:18:20 2000
-# Version:	$FreeBSD: src/release/scripts/print-cdrom-packages.sh,v 1.42 2003/05/09 09:41:18 scottl Exp $
+# Version:	$FreeBSD: src/release/scripts/print-cdrom-packages.sh,v 1.43 2003/07/12 15:35:06 trhodes Exp $
 #
 # MAINTAINER:	re
 #
@@ -72,9 +72,12 @@
 elif [ "X${PKG_ARCH}" = "Xi386" ]; then
 CDROM_SET_1="${CDROM_SET_1} emulators/linux_base"
 fi
+CDROM_SET_1="${CDROM_SET_1} devel/pcre"
 CDROM_SET_1="${CDROM_SET_1} lang/perl5"
 CDROM_SET_1="${CDROM_SET_1} net/pcnfsd"
 CDROM_SET_1="${CDROM_SET_1} net/rsync"
+CDROM_SET_1="${CDROM_SET_1} mail/exim"
+CDROM_SET_1="${CDROM_SET_1} mail/postfix"
 CDROM_SET_1="${CDROM_SET_1} x11-fonts/XFree86-4-font100dpi"
 CDROM_SET_1="${CDROM_SET_1} x11-fonts/XFree86-4-font75dpi"
 CDROM_SET_1="${CDROM_SET_1} x11-fonts/XFree86-4-fontCyrillic"

==== //depot/projects/ia64/sbin/ipfw/ipfw.8#23 (text+ko) ====

@@ -1,5 +1,5 @@
 .\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.127 2003/07/08 13:24:41 dannyboy Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.129 2003/07/12 08:35:25 luigi Exp $
 .\"
 .Dd August 13, 2002
 .Dt IPFW 8
@@ -13,9 +13,9 @@
 .Cm add
 .Ar rule
 .Nm
-.Op Fl acdeftnNS
+.Op Fl acdefnNStT
 .Brq Cm list | show
-.Op Ar number ...
+.Op Ar rule | first-last ...
 .Nm
 .Op Fl f | q
 .Cm flush
@@ -54,7 +54,7 @@
 .Op Ar number ...
 .Pp
 .Nm
-.Op Fl nq
+.Op Fl cnNqS
 .Oo
 .Fl p Ar preproc
 .Oo
@@ -261,7 +261,10 @@
 While listing pipes, sort according to one of the four
 counters (total or current packets or bytes).
 .It Fl t
-While listing, show last match timestamp.
+While listing, show last match timestamp (converted with ctime()).
+.It Fl T
+While listing, show last match timestamp (as seconds from the epoch).
+This form can be more convenient for postprocessing by scripts.
 .El
 .Pp
 To ease configuration, rules can be put into a file which is
@@ -855,6 +858,12 @@
 .Pp
 The following match patterns can be used (listed in alphabetical order):
 .Bl -tag -width indent
+.It Cm // this is a comment.
+Inserts the specified text as a comment in the rule.
+Everything following // is considered as a comment and stored in the rule.
+You can have comment-only rules, which are listed as having a
+.Cm count
+action followed by the comment.
 .It Cm bridged
 Matches only bridged packets.
 .It Cm dst-ip Ar ip-address
@@ -879,8 +888,9 @@
 .It Cm icmptypes Ar types
 Matches ICMP packets whose ICMP type is in the list
 .Ar types .
-The list may be specified as any combination of ranges or
-individual types separated by commas.
+The list may be specified as any combination of
+individual types (numeric) separated by commas.
+.Em Ranges are not allowed.
 The supported ICMP types are:
 .Pp
 echo reply

==== //depot/projects/ia64/sbin/ipfw/ipfw2.c#21 (text+ko) ====

@@ -17,7 +17,7 @@
  *
  * NEW command line interface for IP firewall facility
  *
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.31 2003/07/08 07:52:47 luigi Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.33 2003/07/12 08:35:25 luigi Exp $
  */
 
 #include <sys/param.h>
@@ -40,7 +40,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
-#include <timeconv.h>
+#include <timeconv.h>	/* XXX do we need this ? */
 #include <unistd.h>
 #include <sysexits.h>
 
@@ -57,7 +57,6 @@
 
 int
 		do_resolv,		/* Would try to resolve all */
-		do_acct,		/* Show packet/byte count */
 		do_time,		/* Show time stamps */
 		do_quiet,		/* Be quiet in add and flush */
 		do_force,		/* Don't ask for confirmation */
@@ -81,7 +80,7 @@
  *
  */
 struct _s_x {
-	char *s;
+	char const *s;
 	int x;
 };
 
@@ -228,6 +227,7 @@
 	TOK_MACTYPE,
 	TOK_VERREVPATH,
 	TOK_IPSEC,
+	TOK_COMMENT,
 
 	TOK_PLR,
 	TOK_NOERROR,
@@ -290,6 +290,7 @@
 	{ "reset",		TOK_RESET },
 	{ "unreach",		TOK_UNREACH },
 	{ "check-state",	TOK_CHECKSTATE },
+	{ "//",			TOK_COMMENT },
 	{ NULL, 0 }	/* terminator */
 };
 
@@ -338,6 +339,7 @@
 	{ "mac-type",		TOK_MACTYPE },
 	{ "verrevpath",		TOK_VERREVPATH },
 	{ "ipsec",		TOK_IPSEC },
+	{ "//",			TOK_COMMENT },
 
 	{ "not",		TOK_NOT },		/* pseudo option */
 	{ "!", /* escape ? */	TOK_NOT },		/* pseudo option */
@@ -361,7 +363,7 @@
 /*
  * conditionally runs the command.
  */
-int
+static int
 do_cmd(int optname, void *optval, socklen_t optlen)
 {
 	static int s = -1;	/* the socket */
@@ -392,7 +394,7 @@
 match_token(struct _s_x *table, char *string)
 {
 	struct _s_x *pt;
-	int i = strlen(string);
+	uint i = strlen(string);
 
 	for (pt = table ; i && pt->s != NULL ; pt++)
 		if (strlen(pt->s) == i && !bcmp(string, pt->s, i))
@@ -404,8 +406,8 @@
  * match_value takes a table and a value, returns the string associated
  * with the value (NULL in case of failure).
  */
-static char *
-match_value(struct _s_x *p, uint32_t value)
+static char const *
+match_value(struct _s_x *p, int value)
 {
 	for (; p->s != NULL; p++)
 		if (p->x == value)
@@ -421,7 +423,7 @@
 {
 
 	if (proto == IPPROTO_ETHERTYPE) {
-		char *s;
+		char const *s;
 
 		if (do_resolv && (s = match_value(ether_types, port)) )
 			printf("%s", s);
@@ -460,7 +462,7 @@
 {
 	uint16_t *p = cmd->ports;
 	int i;
-	char *sep;
+	char const *sep;
 
 	if (cmd->o.len & F_NOT)
 		printf(" not");
@@ -624,7 +626,7 @@
 static void
 print_reject_code(uint16_t code)
 {
-	char *s = match_value(icmpcodes, code);
+	char const *s = match_value(icmpcodes, code);
 
 	if (s != NULL)
 		printf("unreach %s", s);
@@ -661,9 +663,9 @@
  * There is a specialized check for f_tcpflags.
  */
 static void
-print_flags(char *name, ipfw_insn *cmd, struct _s_x *list)
+print_flags(char const *name, ipfw_insn *cmd, struct _s_x *list)
 {
-	char *comma="";
+	char const *comma = "";
 	int i;
 	u_char set = cmd->arg1 & 0xff;
 	u_char clear = (cmd->arg1 >> 8) & 0xff;
@@ -692,7 +694,7 @@
  * Print the ip address contained in a command.
  */
 static void
-print_ip(ipfw_insn_ip *cmd, char *s)
+print_ip(ipfw_insn_ip *cmd, char const *s)
 {
 	struct hostent *he = NULL;
 	int len = F_LEN((ipfw_insn *)cmd);
@@ -896,11 +898,13 @@
 	}
 	printf("%05u ", rule->rulenum);
 
-	if (do_acct)
+	if (pcwidth>0 || bcwidth>0)
 		printf("%*llu %*llu ", pcwidth, align_uint64(&rule->pcnt),
 		    bcwidth, align_uint64(&rule->bcnt));
 
-	if (do_time) {
+	if (do_time == 2)
+		printf("%10u ", rule->timestamp);
+	else if (do_time == 1) {
 		char timestr[30];
 		time_t t = (time_t)0;
 
@@ -910,6 +914,9 @@
 			twidth = strlen(timestr);
 		}
 		if (rule->timestamp) {
+#if _FreeBSD_version < 500000 /* XXX check */
+#define	_long_to_time(x)	(time_t)(x)
+#endif
 			t = _long_to_time(rule->timestamp);
 
 			strcpy(timestr, ctime(&t));
@@ -1138,14 +1145,14 @@
 			case O_XMIT:
 			case O_RECV:
 			case O_VIA: {
-				char *s;
+				char const *s;
 				ipfw_insn_if *cmdif = (ipfw_insn_if *)cmd;
 
 				if (cmd->opcode == O_XMIT)
 					s = "xmit";
 				else if (cmd->opcode == O_RECV)
 					s = "recv";
-				else if (cmd->opcode == O_VIA)
+				else /* if (cmd->opcode == O_VIA) */
 					s = "via";
 				if (cmdif->name[0] == '\0')
 					printf(" %s %s", s,
@@ -1256,6 +1263,10 @@
 				printf(" ipsec");
 				break;
 
+			case O_NOP:
+				printf(" // %s", (char *)(cmd + 1));
+				break;
+
 			case O_KEEP_STATE:
 				printf(" keep-state");
 				break;
@@ -1265,7 +1276,7 @@
 				struct _s_x *p = limit_masks;
 				ipfw_insn_limit *c = (ipfw_insn_limit *)cmd;
 				uint8_t x = c->limit_mask;
-				char *comma = " ";
+				char const *comma = " ";
 
 				printf(" limit");
 				for ( ; p->x != 0 ; p++)
@@ -1309,7 +1320,7 @@
 	}
 	bcopy(&d->rule, &rulenum, sizeof(rulenum));
 	printf("%05d", rulenum);
-	if (do_acct)
+	if (pcwidth>0 || bcwidth>0)
 	    printf(" %*llu %*llu (%ds)", pcwidth,
 		align_uint64(&d->pcnt), bcwidth,
 		align_uint64(&d->bcnt), d->expire);
@@ -1338,7 +1349,7 @@
 	printf("\n");
 }
 
-int
+static int
 sort_q(const void *pa, const void *pb)
 {
 	int rev = (do_sort < 0);
@@ -1447,9 +1458,9 @@
 }
 
 static void
-list_pipes(void *data, int nbytes, int ac, char *av[])
+list_pipes(void *data, uint nbytes, int ac, char *av[])
 {
-	u_long rulenum;
+	int rulenum;
 	void *next = data;
 	struct dn_pipe *p = (struct dn_pipe *) data;
 	struct dn_flow_set *fs;
@@ -1472,7 +1483,7 @@
 		 * compute length, as pipe have variable size
 		 */
 		l = sizeof(*p) + p->fs.rq_elements * sizeof(*q);
-		next = (void *)p + l;
+		next = (char *)p + l;
 		nbytes -= l;
 
 		if (rulenum != 0 && rulenum != p->pipe_nr)
@@ -1507,7 +1518,7 @@
 		if (fs->next != (struct dn_flow_set *)DN_IS_QUEUE)
 			break;
 		l = sizeof(*fs) + fs->rq_elements * sizeof(*q);
-		next = (void *)fs + l;
+		next = (char *)fs + l;
 		nbytes -= l;
 		q = (struct dn_flow_queue *)(fs+1);
 		sprintf(prefix, "q%05d: weight %d pipe %d ",
@@ -1539,7 +1550,7 @@
 		errx(EX_USAGE, "set needs command");
 	if (!strncmp(*av, "show", strlen(*av)) ) {
 		void *data;
-		char *msg;
+		char const *msg;
 
 		nbytes = sizeof(struct ip_fw);
 		if ((data = calloc(1, nbytes)) == NULL)
@@ -1654,17 +1665,19 @@
 }
 
 static void
-list(int ac, char *av[])
+list(int ac, char *av[], int show_counters)
 {
 	struct ip_fw *r;
 	ipfw_dyn_rule *dynrules, *d;
 
-	void *lim, *data = NULL;
+#define NEXT(r)	((struct ip_fw *)((char *)r + RULESIZE(r)))
+	char *lim;
+	void *data = NULL;
 	int bcwidth, n, nbytes, nstat, ndyn, pcwidth, width;
 	int exitval = EX_OK;
 	int lac;
 	char **lav;
-	u_long rnum;
+	u_long rnum, last;
 	char *endptr;
 	int seen = 0;
 
@@ -1701,25 +1714,24 @@
 	 * Count static rules. They have variable size so we
 	 * need to scan the list to count them.
 	 */
-	for (nstat = 1, r = data, lim = data + nbytes;
-		    r->rulenum < 65535 && (void *)r < lim;
-		    ++nstat, r = (void *)r + RULESIZE(r) )
+	for (nstat = 1, r = data, lim = (char *)data + nbytes;
+		    r->rulenum < 65535 && (char *)r < lim;
+		    ++nstat, r = NEXT(r) )
 		; /* nothing */
 
 	/*
 	 * Count dynamic rules. This is easier as they have
 	 * fixed size.
 	 */
-	r = (void *)r + RULESIZE(r);
+	r = NEXT(r);
 	dynrules = (ipfw_dyn_rule *)r ;
-	n = (void *)r - data;
+	n = (char *)r - (char *)data;
 	ndyn = (nbytes - n) / sizeof *dynrules;
 
 	/* if showing stats, figure out column widths ahead of time */
 	bcwidth = pcwidth = 0;
-	if (do_acct) {
-		for (n = 0, r = data; n < nstat;
-		    n++, r = (void *)r + RULESIZE(r)) {
+	if (show_counters) {
+		for (n = 0, r = data; n < nstat; n++, r = NEXT(r)) {
 			/* packet counter */
 			width = snprintf(NULL, 0, "%llu",
 			    align_uint64(&r->pcnt));
@@ -1748,8 +1760,7 @@
 	}
 	/* if no rule numbers were specified, list all rules */
 	if (ac == 0) {
-		for (n = 0, r = data; n < nstat;
-		    n++, r = (void *)r + RULESIZE(r) )
+		for (n = 0, r = data; n < nstat; n++, r = NEXT(r) )
 			show_ipfw(r, pcwidth, bcwidth);
 
 		if (do_dynamic && ndyn) {
@@ -1764,17 +1775,19 @@
 
 	for (lac = ac, lav = av; lac != 0; lac--) {
 		/* convert command line rule # */
-		rnum = strtoul(*lav++, &endptr, 10);
+		last = rnum = strtoul(*lav++, &endptr, 10);
+		if (*endptr == '-')
+			last = strtoul(endptr+1, &endptr, 10);
 		if (*endptr) {
+				
 			exitval = EX_USAGE;
 			warnx("invalid rule number: %s", *(lav - 1));
 			continue;
 		}
-		for (n = seen = 0, r = data; n < nstat;
-		    n++, r = (void *)r + RULESIZE(r) ) {
-			if (r->rulenum > rnum)
+		for (n = seen = 0, r = data; n < nstat; n++, r = NEXT(r) ) {
+			if (r->rulenum > last)
 				break;
-			if (r->rulenum == rnum) {
+			if (r->rulenum >= rnum && r->rulenum <= last) {
 				show_ipfw(r, pcwidth, bcwidth);
 				seen = 1;
 			}
@@ -1791,6 +1804,8 @@
 		printf("## Dynamic rules:\n");
 		for (lac = ac, lav = av; lac != 0; lac--) {
 			rnum = strtoul(*lav++, &endptr, 10);
+			if (*endptr == '-')
+				last = strtoul(endptr+1, &endptr, 10);
 			if (*endptr)
 				/* already warned */
 				continue;
@@ -1800,7 +1815,7 @@
 				bcopy(&d->rule, &rulenum, sizeof(rulenum));
 				if (rulenum > rnum)
 					break;
-				if (rulenum == rnum)
+				if (r->rulenum >= rnum && r->rulenum <= last)
 					show_dyn_ipfw(d, pcwidth, bcwidth);
 			}
 		}
@@ -1813,6 +1828,7 @@
 
 	if (exitval != EX_OK)
 		exit(exitval);
+#undef NEXT
 }
 
 static void
@@ -2083,12 +2099,12 @@
 delete(int ac, char *av[])
 {
 	uint32_t rulenum;
-	struct dn_pipe pipe;
+	struct dn_pipe p;
 	int i;
 	int exitval = EX_OK;
 	int do_set = 0;
 
-	memset(&pipe, 0, sizeof pipe);
+	memset(&p, 0, sizeof p);
 
 	av++; ac--;
 	if (ac > 0 && !strncmp(*av, "set", strlen(*av))) {
@@ -2101,15 +2117,14 @@
 		i = atoi(*av); av++; ac--;
 		if (do_pipe) {
 			if (do_pipe == 1)
-				pipe.pipe_nr = i;
+				p.pipe_nr = i;
 			else
-				pipe.fs.fs_nr = i;
-			i = do_cmd(IP_DUMMYNET_DEL, &pipe, sizeof pipe);
+				p.fs.fs_nr = i;
+			i = do_cmd(IP_DUMMYNET_DEL, &p, sizeof p);
 			if (i) {
 				exitval = 1;
 				warn("rule %u: setsockopt(IP_DUMMYNET_DEL)",
-				    do_pipe == 1 ? pipe.pipe_nr :
-				    pipe.fs.fs_nr);
+				    do_pipe == 1 ? p.pipe_nr : p.fs.fs_nr);
 			}
 		} else {
 			rulenum =  (i & 0xffff) | (do_set << 24);
@@ -2164,22 +2179,22 @@
 static void
 config_pipe(int ac, char **av)
 {
-	struct dn_pipe pipe;
+	struct dn_pipe p;
 	int i;
 	char *end;
 	uint32_t a;
 	void *par = NULL;
 
-	memset(&pipe, 0, sizeof pipe);
+	memset(&p, 0, sizeof p);
 
 	av++; ac--;
 	/* Pipe number */
 	if (ac && isdigit(**av)) {
 		i = atoi(*av); av++; ac--;
 		if (do_pipe == 1)
-			pipe.pipe_nr = i;
+			p.pipe_nr = i;
 		else
-			pipe.fs.fs_nr = i;
+			p.fs.fs_nr = i;
 	}
 	while (ac > 0) {
 		double d;
@@ -2188,7 +2203,7 @@
 
 		switch(tok) {
 		case TOK_NOERROR:
-			pipe.fs.flags_fs |= DN_NOERROR;
+			p.fs.flags_fs |= DN_NOERROR;
 			break;
 
 		case TOK_PLR:
@@ -2198,26 +2213,26 @@
 				d = 1;
 			else if (d < 0)
 				d = 0;
-			pipe.fs.plr = (int)(d*0x7fffffff);
+			p.fs.plr = (int)(d*0x7fffffff);
 			ac--; av++;
 			break;
 
 		case TOK_QUEUE:
 			NEED1("queue needs queue size\n");
 			end = NULL;
-			pipe.fs.qsize = strtoul(av[0], &end, 0);
+			p.fs.qsize = strtoul(av[0], &end, 0);
 			if (*end == 'K' || *end == 'k') {
-				pipe.fs.flags_fs |= DN_QSIZE_IS_BYTES;
-				pipe.fs.qsize *= 1024;
+				p.fs.flags_fs |= DN_QSIZE_IS_BYTES;
+				p.fs.qsize *= 1024;
 			} else if (*end == 'B' || !strncmp(end, "by", 2)) {
-				pipe.fs.flags_fs |= DN_QSIZE_IS_BYTES;
+				p.fs.flags_fs |= DN_QSIZE_IS_BYTES;
 			}
 			ac--; av++;
 			break;
 
 		case TOK_BUCKETS:
 			NEED1("buckets needs argument\n");
-			pipe.fs.rq_size = strtoul(av[0], NULL, 0);
+			p.fs.rq_size = strtoul(av[0], NULL, 0);
 			ac--; av++;
 			break;
 
@@ -2229,11 +2244,11 @@
 			 */
 			par = NULL;
 
-			pipe.fs.flow_mask.dst_ip = 0;
-			pipe.fs.flow_mask.src_ip = 0;
-			pipe.fs.flow_mask.dst_port = 0;
-			pipe.fs.flow_mask.src_port = 0;
-			pipe.fs.flow_mask.proto = 0;
+			p.fs.flow_mask.dst_ip = 0;
+			p.fs.flow_mask.src_ip = 0;
+			p.fs.flow_mask.dst_port = 0;
+			p.fs.flow_mask.src_port = 0;
+			p.fs.flow_mask.proto = 0;
 			end = NULL;
 
 			while (ac >= 1) {
@@ -2247,28 +2262,28 @@
 				    /*
 				     * special case, all bits significant
 				     */
-				    pipe.fs.flow_mask.dst_ip = ~0;
-				    pipe.fs.flow_mask.src_ip = ~0;
-				    pipe.fs.flow_mask.dst_port = ~0;
-				    pipe.fs.flow_mask.src_port = ~0;
-				    pipe.fs.flow_mask.proto = ~0;
-				    pipe.fs.flags_fs |= DN_HAVE_FLOW_MASK;
+				    p.fs.flow_mask.dst_ip = ~0;
+				    p.fs.flow_mask.src_ip = ~0;
+				    p.fs.flow_mask.dst_port = ~0;
+				    p.fs.flow_mask.src_port = ~0;
+				    p.fs.flow_mask.proto = ~0;
+				    p.fs.flags_fs |= DN_HAVE_FLOW_MASK;
 				    goto end_mask;
 
 			    case TOK_DSTIP:
-				    p32 = &pipe.fs.flow_mask.dst_ip;
+				    p32 = &p.fs.flow_mask.dst_ip;
 				    break;
 
 			    case TOK_SRCIP:
-				    p32 = &pipe.fs.flow_mask.src_ip;
+				    p32 = &p.fs.flow_mask.src_ip;
 				    break;
 
 			    case TOK_DSTPORT:
-				    p16 = &pipe.fs.flow_mask.dst_port;
+				    p16 = &p.fs.flow_mask.dst_port;
 				    break;
 
 			    case TOK_SRCPORT:
-				    p16 = &pipe.fs.flow_mask.src_port;
+				    p16 = &p.fs.flow_mask.src_port;
 				    break;
 
 			    case TOK_PROTO:
@@ -2296,10 +2311,10 @@
 				    if (a > 255)
 					    errx(EX_DATAERR,
 						"mask: must be 8 bit");
-				    pipe.fs.flow_mask.proto = (uint8_t)a;
+				    p.fs.flow_mask.proto = (uint8_t)a;
 			    }
 			    if (a != 0)
-				    pipe.fs.flags_fs |= DN_HAVE_FLOW_MASK;
+				    p.fs.flags_fs |= DN_HAVE_FLOW_MASK;
 			    ac--; av++;
 			} /* end while, config masks */
 end_mask:
@@ -2308,9 +2323,9 @@
 		case TOK_RED:
 		case TOK_GRED:
 			NEED1("red/gred needs w_q/min_th/max_th/max_p\n");
-			pipe.fs.flags_fs |= DN_IS_RED;
+			p.fs.flags_fs |= DN_IS_RED;
 			if (tok == TOK_GRED)
-				pipe.fs.flags_fs |= DN_IS_GENTLE_RED;
+				p.fs.flags_fs |= DN_IS_GENTLE_RED;
 			/*
 			 * the format for parameters is w_q/min_th/max_th/max_p
 			 */
@@ -2318,29 +2333,29 @@
 			    double w_q = strtod(end, NULL);
 			    if (w_q > 1 || w_q <= 0)
 				errx(EX_DATAERR, "0 < w_q <= 1");
-			    pipe.fs.w_q = (int) (w_q * (1 << SCALE_RED));
+			    p.fs.w_q = (int) (w_q * (1 << SCALE_RED));
 			}
 			if ((end = strsep(&av[0], "/"))) {
-			    pipe.fs.min_th = strtoul(end, &end, 0);
+			    p.fs.min_th = strtoul(end, &end, 0);
 			    if (*end == 'K' || *end == 'k')
-				pipe.fs.min_th *= 1024;
+				p.fs.min_th *= 1024;
 			}
 			if ((end = strsep(&av[0], "/"))) {
-			    pipe.fs.max_th = strtoul(end, &end, 0);
+			    p.fs.max_th = strtoul(end, &end, 0);
 			    if (*end == 'K' || *end == 'k')
-				pipe.fs.max_th *= 1024;
+				p.fs.max_th *= 1024;
 			}
 			if ((end = strsep(&av[0], "/"))) {
 			    double max_p = strtod(end, NULL);
 			    if (max_p > 1 || max_p <= 0)
 				errx(EX_DATAERR, "0 < max_p <= 1");
-			    pipe.fs.max_p = (int)(max_p * (1 << SCALE_RED));
+			    p.fs.max_p = (int)(max_p * (1 << SCALE_RED));
 			}
 			ac--; av++;
 			break;
 
 		case TOK_DROPTAIL:
-			pipe.fs.flags_fs &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
+			p.fs.flags_fs &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
 			break;
 
 		case TOK_BW:
@@ -2351,24 +2366,24 @@
 			 * set clocking interface or bandwidth value
 			 */
 			if (av[0][0] >= 'a' && av[0][0] <= 'z') {
-			    int l = sizeof(pipe.if_name)-1;
+			    int l = sizeof(p.if_name)-1;
 			    /* interface name */
-			    strncpy(pipe.if_name, av[0], l);
-			    pipe.if_name[l] = '\0';
-			    pipe.bandwidth = 0;
+			    strncpy(p.if_name, av[0], l);
+			    p.if_name[l] = '\0';
+			    p.bandwidth = 0;
 			} else {
-			    pipe.if_name[0] = '\0';
-			    pipe.bandwidth = strtoul(av[0], &end, 0);
+			    p.if_name[0] = '\0';
+			    p.bandwidth = strtoul(av[0], &end, 0);
 			    if (*end == 'K' || *end == 'k') {
 				end++;
-				pipe.bandwidth *= 1000;
+				p.bandwidth *= 1000;
 			    } else if (*end == 'M') {
 				end++;
-				pipe.bandwidth *= 1000000;
+				p.bandwidth *= 1000000;
 			    }
 			    if (*end == 'B' || !strncmp(end, "by", 2))
-				pipe.bandwidth *= 8;
-			    if (pipe.bandwidth < 0)
+				p.bandwidth *= 8;
+			    if (p.bandwidth < 0)
 				errx(EX_DATAERR, "bandwidth too large");
 			}
 			ac--; av++;
@@ -2378,7 +2393,7 @@
 			if (do_pipe != 1)
 				errx(EX_DATAERR, "delay only valid for pipes");
 			NEED1("delay needs argument 0..10000ms\n");
-			pipe.delay = strtoul(av[0], NULL, 0);
+			p.delay = strtoul(av[0], NULL, 0);
 			ac--; av++;
 			break;
 
@@ -2386,7 +2401,7 @@
 			if (do_pipe == 1)
 				errx(EX_DATAERR,"weight only valid for queues");
 			NEED1("weight needs argument 0..100\n");
-			pipe.fs.weight = strtoul(av[0], &end, 0);
+			p.fs.weight = strtoul(av[0], &end, 0);
 			ac--; av++;
 			break;
 
@@ -2394,7 +2409,7 @@
 			if (do_pipe == 1)
 				errx(EX_DATAERR,"pipe only valid for queues");
 			NEED1("pipe needs pipe_number\n");
-			pipe.fs.parent_nr = strtoul(av[0], &end, 0);
+			p.fs.parent_nr = strtoul(av[0], &end, 0);
 			ac--; av++;
 			break;
 
@@ -2403,34 +2418,34 @@
 		}
 	}
 	if (do_pipe == 1) {
-		if (pipe.pipe_nr == 0)
+		if (p.pipe_nr == 0)
 			errx(EX_DATAERR, "pipe_nr must be > 0");
-		if (pipe.delay > 10000)
+		if (p.delay > 10000)
 			errx(EX_DATAERR, "delay must be < 10000");
 	} else { /* do_pipe == 2, queue */
-		if (pipe.fs.parent_nr == 0)
+		if (p.fs.parent_nr == 0)
 			errx(EX_DATAERR, "pipe must be > 0");
-		if (pipe.fs.weight >100)
+		if (p.fs.weight >100)
 			errx(EX_DATAERR, "weight must be <= 100");
 	}
-	if (pipe.fs.flags_fs & DN_QSIZE_IS_BYTES) {
-		if (pipe.fs.qsize > 1024*1024)
+	if (p.fs.flags_fs & DN_QSIZE_IS_BYTES) {
+		if (p.fs.qsize > 1024*1024)
 			errx(EX_DATAERR, "queue size must be < 1MB");
 	} else {
-		if (pipe.fs.qsize > 100)
+		if (p.fs.qsize > 100)
 			errx(EX_DATAERR, "2 <= queue size <= 100");
 	}
-	if (pipe.fs.flags_fs & DN_IS_RED) {
+	if (p.fs.flags_fs & DN_IS_RED) {
 		size_t len;
 		int lookup_depth, avg_pkt_size;
 		double s, idle, weight, w_q;
-		struct clockinfo clock;
+		struct clockinfo ck;
 		int t;
 
-		if (pipe.fs.min_th >= pipe.fs.max_th)
+		if (p.fs.min_th >= p.fs.max_th)
 		    errx(EX_DATAERR, "min_th %d must be < than max_th %d",
-			pipe.fs.min_th, pipe.fs.max_th);
-		if (pipe.fs.max_th == 0)
+			p.fs.min_th, p.fs.max_th);
+		if (p.fs.max_th == 0)
 		    errx(EX_DATAERR, "max_th must be > 0");
 
 		len = sizeof(int);
@@ -2455,7 +2470,7 @@
 			    " be greater than zero");
 
 		len = sizeof(struct clockinfo);
-		if (sysctlbyname("kern.clockrate", &clock, &len, NULL, 0) == -1)
+		if (sysctlbyname("kern.clockrate", &ck, &len, NULL, 0) == -1)

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


More information about the p4-projects mailing list