Implement TCA_VLAN_ACT_POP_ETH and TCA_VLAN_ACT_PUSH_ETH, to respectively pop and push a base Ethernet header at the beginning of a frame. POP_ETH is just a matter of pulling ETH_HLEN bytes. VLAN tags, if any, must be stripped before calling POP_ETH. PUSH_ETH is restricted to skbs with no mac_header, and only the MAC addresses can be configured. The Ethertype is automatically set from skb->protocol. These restrictions ensure that all skb's fields remain consistent, so that this action can't confuse other part of the networking stack (like GSO). Since openvswitch already had these actions, consolidate the code in skbuff.c (like for vlan and mpls push/pop).
Showing the changes to include/uapi/linux (1 of 6 files). Show all
Unified · Split
| @@ -16,6 +16,8 @@ · 15 unmodified lines | ||
| 16 | 16 | #define TCA_VLAN_ACT_POP 1 |
| 17 | 17 | #define TCA_VLAN_ACT_PUSH 2 |
| 18 | 18 | #define TCA_VLAN_ACT_MODIFY 3 |
| 19 | +#define TCA_VLAN_ACT_POP_ETH 4 | |
| 20 | +#define TCA_VLAN_ACT_PUSH_ETH 5 | |
| 19 | 21 | |
| 20 | 22 | struct tc_vlan { |
| 21 | 23 | tc_gen; |
| @@ -30,6 +32,8 @@ enum { · 8 unmodified lines | ||
| 30 | 32 | TCA_VLAN_PUSH_VLAN_PROTOCOL, |
| 31 | 33 | TCA_VLAN_PAD, |
| 32 | 34 | TCA_VLAN_PUSH_VLAN_PRIORITY, |
| 35 | + TCA_VLAN_PUSH_ETH_DST, | |
| 36 | + TCA_VLAN_PUSH_ETH_SRC, | |
| 33 | 37 | __TCA_VLAN_MAX, |
| 34 | 38 | }; |
| 35 | 39 | #define TCA_VLAN_MAX (__TCA_VLAN_MAX - 1) |