123456789101112131415161718192021222324252627 |
- #!/bin/sh
- startstop=$1
- if [ -z "$startstop" ]; then
- startstop="start"
- fi
- table="forwarding_lan_rule"
- filtertable="forwarding_lan_rules_kids"
- macsrc=$(cat ./mac.txt)
- case "$startstop" in
- start)
- for i in $macsrc; do
- iptables -I ${table} -m mac --mac-source $i -m comment --comment "macfiltering" -j ${filtertable}
- done
- ;;
- stop)
- macdel=$(iptables -S ${table} |grep macfiltering|sed -e 's/\ /\n/g'|grep mac-source -A 1 |grep :)
- for i in $macdel; do
- iptables -D ${table} -m mac --mac-source $i -m comment --comment "macfiltering" -j ${filtertable}
- done
-
- ;;
- esac
|