the following script: # tc qdisc add dev eth0 clsact # tc filter add dev eth0 egress protocol ip matchall \ > action mpls push protocol mpls_uc label 0x355aa bos 1 causes corruption of all IP packets transmitted by eth0. On TC egress, we can't rely on the value of skb->mac_len, because it's 0 and a MPLS 'push' operation will result in an overwrite of the first 4 octets in the packet L2 header (e.g. the Destination Address if eth0 is an Ethernet); the same error pattern is present also in the MPLS 'pop' operation. Fix this error in act_mpls data plane, computing 'mac_len' as the difference between the network header and the mac header (when not at TC ingress), and use it in MPLS 'push'/'pop' core functions. v2: unbreak 'make htmldocs' because of missing documentation of 'mac_len' in skb_mpls_pop(), reported by kbuild test robot
Showing the changes to include (1 of 4 files). Show all
Unified · Split
| @@ -3510,8 +3510,9 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len); · 3509 unmodified lines | ||
| 3510 | 3510 | int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci); |
| 3511 | 3511 | int skb_vlan_pop(struct sk_buff *skb); |
| 3512 | 3512 | int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); |
| 3513 | −int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto); | |
| 3514 | −int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto); | |
| 3513 | +int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, | |
| 3514 | + int mac_len); | |
| 3515 | +int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); | |
| 3515 | 3516 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); |
| 3516 | 3517 | int skb_mpls_dec_ttl(struct sk_buff *skb); |
| 3517 | 3518 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, |