Currently, TC offers the ability to match on the MPLS fields of a packet through the use of the flow_dissector_key_mpls struct. However, as yet, TC actions do not allow the modification or manipulation of such fields. Add a new module that registers TC action ops to allow manipulation of MPLS. This includes the ability to push and pop headers as well as modify the contents of new or existing headers. A further action to decrement the TTL field of an MPLS header is also provided with a new helper added to support this. Examples of the usage of the new action with flower rules to push and pop MPLS labels are: tc filter add dev eth0 protocol ip parent ffff: flower \ action mpls push protocol mpls_uc label 123 \ action mirred egress redirect dev eth1 tc filter add dev eth0 protocol mpls_uc parent ffff: flower \ action mpls pop protocol ipv4 \ action mirred egress redirect dev eth1
Showing the changes to include/linux (1 of 8 files). Show all
Unified · Split
| @@ -3450,6 +3450,7 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); · 3449 unmodified lines | ||
| 3450 | 3450 | int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto); |
| 3451 | 3451 | int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto); |
| 3452 | 3452 | int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); |
| 3453 | +int skb_mpls_dec_ttl(struct sk_buff *skb); | |
| 3453 | 3454 | struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, |
| 3454 | 3455 | gfp_t gfp); |
| 3455 | 3456 | |