Skip to content

Instantly share code, notes, and snippets.

@missing233
Created November 5, 2024 17:58
Show Gist options
  • Save missing233/195b39d61dcdccb7598ecfdef39253ed to your computer and use it in GitHub Desktop.
Save missing233/195b39d61dcdccb7598ecfdef39253ed to your computer and use it in GitHub Desktop.
vlan_fixes_hook
#!/bin/sh
# /ptconf/8311/vlan_fixes_hook.sh
# this will allow all vlans to work, and remaps the multicast to IPTV_VLAN
# the multicast rules may need some adjustment depending on exactly how the packets are actually tagged from the OLT
# if the upstream multicast packets are double tagged, it might require some different rules, if they are single tagged, this should just work
INTERNET_VLAN=3202
IPTV_VLAN=2338
INTERNET_CONVERT=0
tc_flower_clear del dev eth0_0 ingress
tc_flower_clear del dev eth0_0 egress
tc_flower_clear del dev eth0_0_2 egress
if [ "$INTERNET_CONVERT" -eq 0 ]; then
tc_flower_add dev eth0_0 egress handle 0x1 protocol 802.1Q pref 1 flower skip_sw vlan_id $INTERNET_VLAN action vlan pop pass
else
tc_flower_add dev eth0_0 egress handle 0x1 protocol 802.1Q pref 1 flower skip_sw vlan_id $INTERNET_VLAN action vlan modify id $INTERNET_CONVERT pass
fi
tc_flower_add dev eth0_0 egress handle 0x2 protocol 802.1Q pref 2 flower skip_sw action pass
tc_flower_add dev eth0_0 ingress handle 0x1 protocol 802.1Q pref 1 flower skip_sw action pass
tc_flower_add dev eth0_0 ingress handle 0x2 protocol all pref 2 flower skip_sw action vlan push id $INTERNET_VLAN protocol 802.1Q pass
tc_flower_add dev eth0_0_2 egress handle 0x1 protocol 802.1ad pref 1 flower skip_sw action vlan modify id $IPTV_VLAN protocol 802.1Q pass
tc_flower_add dev eth0_0_2 egress handle 0x2 protocol 802.1Q pref 2 flower skip_sw action vlan modify id $IPTV_VLAN protocol 802.1Q pass
tc_flower_add dev eth0_0_2 egress handle 0x3 protocol all pref 3 flower skip_sw action vlan push id $IPTV_VLAN protocol 802.1Q pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment