summaryrefslogtreecommitdiff
path: root/templates/firewall/log-martians/node.def
blob: 4d38903ec8ba11c2ea7bfc9629f802bd8934c37f (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
# log_martians 
# default value - 1
# Log packets with impossible addresses to kernel log. log_martians for the 
# interface will be enabled if at least one of conf/{all,interface}/log_martians
# is set to TRUE, it will be disabled otherwise

type: txt

help: Set policy for logging IPv4 packets with invalid addresses

comp_help:Possible completions:
  enable\tEnable logging of IPv4 packets with invalid addresses
  disable\tDisable logging of Ipv4 packets with invalid addresses

default: "enable"

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

update:
	if [ x$VAR(@) == xenable ]; then
	    sudo sh -c "echo 1 > /proc/sys/net/ipv4/conf/all/log_martians"
        else
            # log-martians can work when either set for 'all' or 'interface'
            # thus, unset all log-martians 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]%:*}/log_martians"
               let i++
            done
	fi

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