VLAN tags transformation

Starting from the Stingray Service Gateway version 7.4 the new feature of VLAN tags transformation is added. Transformation mode is very similar to the Substitution mode, but in this case the number of VLAN tags within the subscriber packet may differ from the number specified in the bras_vlan_subst configuration option.
The examples:

bras_vlan_terminate=3
bras_vlan_subst=1071

For such mode:

if the incoming packet does not have VLAN tags, VLAN=1071 will be added to it

if the incoming packet has one VLAN tag then its value will be replaced by VLAN=1071

if the incoming packet has two VLAN tags (Q-in-Q) then the one of them will be cut off, the second one will be assigned VLAN = 1071

bras_vlan_terminate=3
bras_vlan_subst=1071.65

For such mode:

if the incoming packet does not have VLAN tags or has only one - the Q-in-Q outerVLAN = 1071, innerVLAN = 65 will be added to it

if the incoming packet has two VLAN tags (QinQ) then their values will be changed to outerVLAN = 1071 and innerVLAN = 65

When the traffic is originated the reverse rules are applied.

SSG legacy pf_ring-version, CentOS 6: It should be taken into account that the modes implying VLAN tags adding/removing are very resource-consuming for the Stingray Service Gateway, i.e. when the packet size is changing (that is, VLAN tags deleting/adding), which can significantly affect the total SSG performance.
The DPDK version of SSG on CentOS 8 is practically devoid of this drawback - there is almost no decrease in fastDPI performance due to optimizations of packet processing