Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2002 21:37:33 -0700 (PDT)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/netinet ip_fw.h ip_fw2.c src/sbin/ipfw ipfw2.c
Message-ID:  <200208100437.g7A4bXGZ046962@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
luigi       2002/08/09 21:37:33 PDT

  Modified files:
    sys/netinet          ip_fw.h ip_fw2.c 
    sbin/ipfw            ipfw2.c 
  Log:
  One bugfix and one new feature.
  
  The bugfix (ipfw2.c) makes the handling of port numbers with
  a dash in the name, e.g. ftp-data, consistent with old ipfw:
  use \\ before the - to consider it as part of the name and not
  a range separator.
  
  The new feature (all this description will go in the manpage):
  
  each rule now belongs to one of 32 different sets, which can
  be optionally specified in the following form:
  
          ipfw add 100 set 23 allow ip from any to any
  
  If "set N" is not specified, the rule belongs to set 0.
  
  Individual sets can be disabled, enabled, and deleted with the commands:
  
          ipfw disable set N
          ipfw enable set N
          ipfw delete set N
  
  Enabling/disabling of a set is atomic. Rules belonging to a disabled
  set are skipped during packet matching, and they are not listed
  unless you use the '-S' flag in the show/list commands.
  Note that dynamic rules, once created, are always active until
  they expire or their parent rule is deleted.
  Set 31 is reserved for the default rule and cannot be disabled.
  
  All sets are enabled by default. The enable/disable status of the sets
  can be shown with the command
  
          ipfw show sets
  
  Hopefully, this feature will make life easier to those who want to
  have atomic ruleset addition/deletion/tests. Examples:
  
  To add a set of rules atomically:
  
          ipfw disable set 18
          ipfw add ... set 18 ...         # repeat as needed
          ipfw enable set 18
  
  To delete a set of rules atomically
  
          ipfw disable set 18
          ipfw delete set 18
          ipfw enable set 18
  
  To test a ruleset and disable it and regain control if something
  goes wrong:
  
          ipfw disable set 18
          ipfw add ... set 18 ...         # repeat as needed
          ipfw enable set 18 ; echo "done "; sleep 30 && ipfw disable set 18
  
      here if everything goes well, you press control-C before
      the "sleep" terminates, and your ruleset will be left
      active. Otherwise, e.g. if you cannot access your box,
      the ruleset will be disabled after the sleep terminates.
  
  I think there is only one more thing that one might want, namely
  a command to assign all rules in set X to set Y, so one can
  test a ruleset using the above mechanisms, and once it is
  considered acceptable, make it part of an existing ruleset.
  
  Revision  Changes    Path
  1.8       +85 -22    src/sbin/ipfw/ipfw2.c
  1.74      +3 -3      src/sys/netinet/ip_fw.h
  1.7       +95 -18    src/sys/netinet/ip_fw2.c

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




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