mcastmngr: add filtering rules for downstream

This is necessary to filter IGMP messages from downstream interfaces.
This commit is contained in:
Anatoly Mirin 2023-04-24 12:43:16 +03:00 committed by Rahul Thakur
parent adb318f735
commit 1abf717fc6

View file

@ -41,22 +41,29 @@ config_mcproxy_interfaces() {
return
fi
for upstream in $upstreams; do
for excp in $exceptions; do
local filter=""
for excp in $exceptions; do
case $excp in
*/*)
ip_start="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
ip_end="$(ipcalc.sh $excp | grep BROADCAST | awk '{print substr($0,11)}')"
filter="$filter ($ip_start - $ip_end | *)"
;;
*)
filter="$filter ($excp | *)"
;;
esac
case $excp in
*/*)
ip_start="$(ipcalc.sh $excp | grep IP | awk '{print substr($0,4)}')"
ip_end="$(ipcalc.sh $excp | grep BROADCAST | awk '{print substr($0,11)}')"
filter="$filter ($ip_start - $ip_end | *)"
;;
*)
filter="$filter ($excp | *)"
;;
esac
for upstream in $upstreams; do
echo "pinstance main upstream \"$upstream\" in blacklist table{$filter };" >> $CONFFILE
echo "pinstance main upstream \"$upstream\" out blacklist table{$filter };" >> $CONFFILE
done
for downstream in $downstreams; do
echo "pinstance main downstream \"$downstream\" in blacklist table{$filter };" >> $CONFFILE
echo "pinstance main downstream \"$downstream\" out blacklist table{$filter };" >> $CONFFILE
done
echo "pinstance main upstream \"$upstream\" in blacklist table{$filter };" >> $CONFFILE
echo "pinstance main upstream \"$upstream\" out blacklist table{$filter };" >> $CONFFILE
done
}