qosmngr: add ebtable handling for loopback (lo) interface

If interface is loopback then we add the rule to nat table's
output chain instead of broute tables BROUTING chain
This commit is contained in:
Mohd Husaam Mehdi 2024-07-03 14:15:21 +05:30 committed by Rahul Thakur
parent 9eb14ac309
commit 6ef90dcd9d

View file

@ -150,6 +150,15 @@ broute_filter_on_vid() {
}
broute_append_rule() {
# if src_if is loopback, then add the rule to OUTPUT(qos_output) chain of nat table
if [ "$src_if" = "lo" ]; then
echo "ebtables --concurrent -t nat -A qos_output $BR_RULE" >> /tmp/qos/classify.ebtables
if [ -n "$BR6_RULE" ]; then
echo "ebtables --concurrent -t nat -A qos_output $BR6_RULE" >> /tmp/qos/classify.ebtables
fi
return
fi
local broute_chain="$1"
#when ethertype is not configured by user then both proto rules of ipv4
#and ipv6 to be installed otherwise install ipv6 proto rule only.
@ -449,9 +458,9 @@ handle_ebtables_rules() {
if [ -n "$BR_RULE" ]; then
if [ -n "$vid_mark" ] || [ -n "$pcp_mark" ]; then
broute_append_rule "prevlanxlate"
broute_append_rule "prevlanxlate" "$src_if"
else
broute_append_rule "qos"
broute_append_rule "qos" "$src_if"
fi
fi
}
@ -501,6 +510,15 @@ handle_ebtables_dscp2pbit() {
create_ebtables_chains() {
ebtables --concurrent -t nat -N qos_output -P RETURN 2> /dev/null
ret=$?
if [ $ret -eq 0 ]; then
ebtables --concurrent -t nat -A OUTPUT -j qos_output
else
ebtables --concurrent -t nat -D OUTPUT -j qos_output
ebtables --concurrent -t nat -A OUTPUT -j qos_output
fi
ebtables --concurrent -t broute -N dscp2pbits -P RETURN 2> /dev/null
ret=$?
if [ $ret -eq 0 ]; then
@ -531,6 +549,7 @@ create_ebtables_chains() {
}
flush_ebtables_chains() {
echo "ebtables -t nat -F qos_output" > /tmp/qos/classify.ebtables
echo "ebtables -t broute -F qos" > /tmp/qos/classify.ebtables
echo "ebtables -t broute -F dscp2pbits" >> /tmp/qos/classify.ebtables
echo "ebtables -t broute -F prevlanxlate" >> /tmp/qos/classify.ebtables