# rp_filter
# default value - 0
# The max value from conf/{all,interface}/rp_filter is used
# when doing source validation on the {interface}.

type: txt

help: Policy for source validation by reversed path, as specified in RFC3704

val_help: strict; Enable Strict Reverse Path Forwarding as defined in RFC3704
val_help: loose; Enable Loose Reverse Path Forwarding as defined in RFC3704
val_help: disable; No source validation

syntax:expression: $VAR(@) in "strict", "loose", "disable"; "source-validation must be set to 'loose', 'strict' or 'disable'"

update:
        read all < /proc/sys/net/ipv4/conf/all/rp_filter
        if [ x$VAR(@) == xstrict ]; then
           new=1
        elif [ x$VAR(@) == xloose ]; then
           new=2
        else
           new=0
        fi

        if [ "$all" -gt "$new" ]; then
           echo "Warning: global source-validation overrides per interface"
           global="disable"
           if [ "$all" -eq 1 ]; then
              global=strict
           elif [ "$all" -eq 2 ]; then
              global=loose
           fi
           echo "Global value is $global"
        fi
        sudo sh -c "echo $new > \
               /proc/sys/net/ipv4/conf/$IFNAME/rp_filter"

delete:
	sudo sh -c "echo 0 > /proc/sys/net/ipv4/conf/$IFNAME/rp_filter"
