summaryrefslogtreecommitdiff
path: root/templates/firewall/send-redirects/node.def
blob: 0a34a1523a1312ffa53b348c46a73e489ae2dc7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# send_redirects 
# default value - 1 
# send_redirects for the interface will be enabled if at least one of 
# conf/{all,interface}/send_redirects is set to TRUE, else it will be disabled.


type: txt

help: Set policy for sending IPv4 ICMP redirect messages

comp_help:Possible completions:
  enable\tEnable sending IPv4 ICMP redirect messages
  disable\tDisable sending IPv4 ICMP redirect messages

default: "enable"

syntax:expression: $VAR(@) in "enable", "disable"; "send-redirects must be enable or disable"

update:
	if [ x$VAR(@) == xenable ]; then
	    sudo sh -c "echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects"
        else
            # send-redirects can work when either set for 'all' or 'interface'
            # thus, unset all send-redirects parameters
            array=(`ls /proc/sys/net/ipv4/conf/`)
            array_len=${#array[*]}
            i=0
            while [ $i -lt $array_len ]; do
               sudo sh -c "echo 0 > \
                 /proc/sys/net/ipv4/conf/${array[$i]%:*}/send_redirects"
               let i++
            done
	fi

delete:
	sudo sh -c "echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects"