[BACK]Return to ipfilter CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / rc.d

Annotation of src/etc/rc.d/ipfilter, Revision 1.4.4.1

1.1       lukem       1: #!/bin/sh
                      2: #
1.4.4.1 ! lukem       3: # $NetBSD: ipfilter,v 1.6 2000/07/21 01:14:23 lukem Exp $
1.1       lukem       4: #
                      5:
                      6: # PROVIDE: ipfilter
                      7: # REQUIRE: root beforenetlkm mountcritlocal tty
                      8:
                      9: . /etc/rc.subr
                     10:
                     11: name="ipfilter"
1.4.4.1 ! lukem      12: start_precmd="ipfilter_prestart"
1.1       lukem      13: start_cmd="ipfilter_start"
                     14: stop_precmd="checkyesno ipfilter && [ -f /etc/ipf.conf ]"
                     15: stop_cmd="ipfilter_stop"
                     16: reload_precmd="$stop_precmd"
                     17: reload_cmd="ipfilter_reload"
1.4.4.1 ! lukem      18: status_precmd="$stop_precmd"
        !            19: status_cmd="ipfilter_status"
        !            20: extra_commands="reload status"
1.1       lukem      21:
1.4.4.1 ! lukem      22: ipfilter_prestart()
1.1       lukem      23: {
1.2       veego      24:        if ! checkyesno ipfilter; then
1.4.4.1 ! lukem      25:                return 1
1.1       lukem      26:        fi
                     27:        if [ ! -f /etc/ipf.conf ]; then
1.4.4.1 ! lukem      28:                warn "/etc/ipf.conf not readable; ipfilter start aborted."
        !            29:                        #
        !            30:                        # If booting directly to multiuser, send SIGTERM to
        !            31:                        # the parent (/etc/rc) to abort the boot
        !            32:                        #
        !            33:                if [ "$autoboot" = yes ]; then
        !            34:                        echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
        !            35:                        kill -TERM $$
        !            36:                        exit 1
        !            37:                fi
        !            38:                return 1
1.1       lukem      39:        fi
1.4.4.1 ! lukem      40:        return 0
        !            41: }
        !            42:
        !            43: ipfilter_start()
        !            44: {
1.1       lukem      45:        echo "Enabling ipfilter."
                     46:        /sbin/ipf -E -Fa -f /etc/ipf.conf
                     47: }
                     48:
                     49: ipfilter_stop()
                     50: {
                     51:        echo "Disabling ipfilter."
                     52:        /sbin/ipf -D
                     53: }
                     54:
                     55: ipfilter_reload()
                     56: {
                     57:        echo "Reloading ipfilter rules."
                     58:        /sbin/ipf -I -Fa -f /etc/ipf.conf
                     59:        if [ $? -eq 0 ]; then
                     60:                /sbin/ipf -s
                     61:        else
                     62:                warn "Reload failed; not swapping to new ruleset."
                     63:        fi
1.4.4.1 ! lukem      64: }
        !            65:
        !            66: ipfilter_status()
        !            67: {
        !            68:        /sbin/ipf -V
1.1       lukem      69: }
                     70:
1.4       lukem      71: load_rc_config $name
1.3       lukem      72: run_rc_command "$1"

CVSweb <webmaster@jp.NetBSD.org>