X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=active-response%2Froute-null.sh;fp=active-response%2Froute-null.sh;h=4a336eebbb8d6a983096dfcb119d4a3cc0a5df6e;hp=5bc3e407da99f1edf3a7919eddd1d6511db92424;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b diff --git a/active-response/route-null.sh b/active-response/route-null.sh index 5bc3e40..4a336ee 100755 --- a/active-response/route-null.sh +++ b/active-response/route-null.sh @@ -29,6 +29,12 @@ if [ "x${IP}" = "x" ]; then exit 1; fi +# Match the loopback address to the version of the provided IP address +LOOPBACK=127.0.0.1 +echo "${IP}" | grep "\:" > /dev/null 2>&1 +if [ $? = 0 ]; then + LOOPBACK=::1 +fi # Adding the ip to null route if [ "x${ACTION}" = "xadd" ]; then @@ -38,7 +44,7 @@ if [ "x${ACTION}" = "xadd" ]; then fi if [ "X${UNAME}" = "XFreeBSD" ]; then - route -q add ${IP} 127.0.0.1 -blackhole + route -q add ${IP} $LOOPBACK -blackhole exit 0; fi @@ -51,7 +57,7 @@ elif [ "x${ACTION}" = "xdelete" ]; then fi if [ "X${UNAME}" = "XFreeBSD" ]; then - route -q delete ${IP} 127.0.0.1 -blackhole + route -q delete ${IP} $LOOPBACK -blackhole exit 0; fi