History

net/sched: fix corrupted L2 header with MPLS 'push' and 'pop' actions

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

Davide Caratti committed 7 years ago

Commit fa4e0f81 parent dedc5a04 files · +25 −16Browse files

Showing the changes to include/linux (1 of 4 files). Show all

Unified · Split

include/linux/skbuff.h+3−2
@@ -3510,8 +3510,9 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len); · 3509 unmodified lines
3510int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);3510int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);
3511int skb_vlan_pop(struct sk_buff *skb);3511int skb_vlan_pop(struct sk_buff *skb);
3512int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);3512int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
3513int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto);3513int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
3514int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto);3514 int mac_len);
3515int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len);
3515int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse);3516int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse);
3516int skb_mpls_dec_ttl(struct sk_buff *skb);3517int skb_mpls_dec_ttl(struct sk_buff *skb);
3517struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,3518struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t