Message ID | 1574848877-7531-1-git-send-email-martinvarghesenokia@gmail.com |
---|---|
State | Deferred |
Delegated to: | David Miller |
Headers | show |
Series | [v3,net-next] Enhanced skb_mpls_pop to update ethertype of the packet in all the cases when an ethernet header is present is the packet. | expand |
net-next is closed, please resubmit this when net-next opens back up. Thank you.
On Wed, Nov 27, 2019 at 11:24 AM David Miller <davem@davemloft.net> wrote: > > > net-next is closed, please resubmit this when net-next opens back up. > I think this patch is intended for -net as it fixes a bug in OVS? Martin, if it is the case, please resend with targeting to -net instead. Also, please make the $subject shorter. Thanks.
On Fri, Nov 29, 2019 at 10:07:53PM -0800, Cong Wang wrote: > On Wed, Nov 27, 2019 at 11:24 AM David Miller <davem@davemloft.net> wrote: > > > > > > net-next is closed, please resubmit this when net-next opens back up. > > > > I think this patch is intended for -net as it fixes a bug in OVS? > > Martin, if it is the case, please resend with targeting to -net instead. > Also, please make the $subject shorter. > There are few upcoming features to net-next from my side which relies on this fix. In that case should i post against both net and net-next ? Please advice Thanks Martin
On Sat, Nov 30, 2019 at 8:57 PM Martin Varghese <martinvarghesenokia@gmail.com> wrote: > > On Fri, Nov 29, 2019 at 10:07:53PM -0800, Cong Wang wrote: > > On Wed, Nov 27, 2019 at 11:24 AM David Miller <davem@davemloft.net> wrote: > > > > > > > > > net-next is closed, please resubmit this when net-next opens back up. > > > > > > > I think this patch is intended for -net as it fixes a bug in OVS? > > > > Martin, if it is the case, please resend with targeting to -net instead. > > Also, please make the $subject shorter. > > > There are few upcoming features to net-next from my side which relies on this fix. > In that case should i post against both net and net-next ? > Please advice If this is a bug fix, you only need to post for net. Then David will merge net into net-next regularly, after that you can rebase your feature patches onto net-next. Thanks.
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index dfe02b6..70204b9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3530,7 +3530,8 @@ int skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci); int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, int mac_len); -int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len); +int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len, + bool ethernet); int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse); int skb_mpls_dec_ttl(struct sk_buff *skb); struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy, diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 867e61d..312e80e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5529,12 +5529,14 @@ int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto, * @skb: buffer * @next_proto: ethertype of header after popped MPLS header * @mac_len: length of the MAC header + * @ethernet: flag to indicate if ethernet header is present in packet * * Expects skb->data at mac header. * * Returns 0 on success, -errno otherwise. */ -int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len) +int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len, + bool ethernet) { int err; @@ -5553,7 +5555,7 @@ int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len) skb_reset_mac_header(skb); skb_set_network_header(skb, mac_len); - if (skb->dev && skb->dev->type == ARPHRD_ETHER) { + if (ethernet) { struct ethhdr *hdr; /* use mpls_hdr() to get ethertype to account for VLANs. */ diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 12936c1..91e2100 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c @@ -179,7 +179,8 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key, { int err; - err = skb_mpls_pop(skb, ethertype, skb->mac_len); + err = skb_mpls_pop(skb, ethertype, skb->mac_len, + ovs_key_mac_proto(key) == MAC_PROTO_ETHERNET); if (err) return err; diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c index 4d8c822..47e0cfd 100644 --- a/net/sched/act_mpls.c +++ b/net/sched/act_mpls.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2019 Netronome Systems, Inc. */ +#include <linux/if_arp.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h> @@ -76,7 +77,8 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, switch (p->tcfm_action) { case TCA_MPLS_ACT_POP: - if (skb_mpls_pop(skb, p->tcfm_proto, mac_len)) + if (skb_mpls_pop(skb, p->tcfm_proto, mac_len, + skb->dev && skb->dev->type == ARPHRD_ETHER)) goto drop; break; case TCA_MPLS_ACT_PUSH: