[patch] /etc/rc.d/ipfw

Maksim Yevmenkin maksim.yevmenkin at gmail.com
Sun Mar 22 12:28:37 PDT 2009


hello,

would anyone object to the following small patch to /etc/rc.d/ifpw.

this is basically to teach ipfw to

1) load ipfw_nat module when nat is required and natd is _not_ used

2) pass firewall type to rc.firewall script

thanks,
max

====

> diff -u  /etc/rc.d/ipfw ipfw
--- /etc/rc.d/ipfw      2008-07-24 07:02:05.000000000 -0700
+++ ipfw        2009-03-22 11:53:19.000000000 -0700
@@ -23,10 +23,19 @@
        if checkyesno dummynet_enable; then
                required_modules="$required_modules dummynet"
        fi
+       if checkyesno firewall_nat_enable; then
+               if ! checkyesno natd_enable; then
+                       required_modules="$required_modules ipfw_nat"
+               fi
+       fi
 }

 ipfw_start()
 {
+       local   _firewall_type
+
+       _firewall_type=$1
+
        # set the firewall rules script if none was specified
        [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall

@@ -34,7 +43,7 @@
                if [ -f /etc/rc.d/natd ] ; then
                        /etc/rc.d/natd start
                fi
-               /bin/sh "${firewall_script}"
+               /bin/sh "${firewall_script}" "${_firewall_type}"
                echo 'Firewall rules loaded.'
        elif [ "`ipfw list 65535`" = "65535 deny ip from any to any" ]; then
                echo 'Warning: kernel has firewall functionality, but' \
@@ -65,4 +74,4 @@
 }

 load_rc_config $name
-run_rc_command "$1"
+run_rc_command "$*"


More information about the freebsd-rc mailing list