Commit 0d22199b authored by Branko Mikić's avatar Branko Mikić
Browse files

Bug! MAC_FILTER ID generates a non-unique ID depending on wether the mac...

Bug! MAC_FILTER ID generates a non-unique ID depending on wether the mac address was provided in upper- or lower case. This can lead to multiple MAC_FILTER rules for the same mac address instead of removing an already existing rule since the ID couldn't be found. This has been fixed!
parent e520438d
...@@ -1083,14 +1083,16 @@ formatAsHexID() { ...@@ -1083,14 +1083,16 @@ formatAsHexID() {
checkMACArgFormat "$2" checkMACArgFormat "$2"
(( $? != 0 )) && error 91 "MAC_FILTER expects an ether address (MAC) (eg: 06:00:17:d3:97:b4)" (( $? != 0 )) && error 91 "MAC_FILTER expects an ether address (MAC) (eg: 06:00:17:d3:97:b4)"
printf "# filtering '%s' MAC address in %s chain.\n" $2 $sz printf "# filtering '%s' MAC address in %s chain.%s\n" $2 $sz $(ip n | grep "$2" >/dev/nul && printf " (WARNING! Mac address appears to be a host of the local network.)")
ID=$(printf "MAC_FILTER_%s_%s" $sz ${2//:/}) sy=${2//:/}
sy=${sy,,}
ID=$(printf "MAC_FILTER_%s_%s" $sz $sy)
deleteRules $sz "$ID" deleteRules $sz "$ID"
$IPTABLES -I $sz 1 -m mac --mac-source $2 -j DROP -m comment --comment "$ID" $IPTABLES -I $sz 1 -m mac --mac-source $2 -j DROP -m comment --comment "$ID"
unset sz; unset sz; unset sy;
shift; shift shift; shift
;; ;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment