]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/sched/act_mpls.c
Merge branch 'parisc-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux.git] / net / sched / act_mpls.c
index 4cf6c553bb0bbf06376d4068c25775c1948cf065..be3f215cd0277b1a32e8da8634b5edd2f32b25af 100644 (file)
@@ -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,12 +77,14 @@ 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:
                new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol));
-               if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len))
+               if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len,
+                                 skb->dev && skb->dev->type == ARPHRD_ETHER))
                        goto drop;
                break;
        case TCA_MPLS_ACT_MODIFY:
@@ -119,7 +122,6 @@ static int valid_label(const struct nlattr *attr,
 }
 
 static const struct nla_policy mpls_policy[TCA_MPLS_MAX + 1] = {
-       [TCA_MPLS_UNSPEC]       = { .strict_start_type = TCA_MPLS_UNSPEC + 1 },
        [TCA_MPLS_PARMS]        = NLA_POLICY_EXACT_LEN(sizeof(struct tc_mpls)),
        [TCA_MPLS_PROTO]        = { .type = NLA_U16 },
        [TCA_MPLS_LABEL]        = NLA_POLICY_VALIDATE_FN(NLA_U32, valid_label),
@@ -131,7 +133,8 @@ static const struct nla_policy mpls_policy[TCA_MPLS_MAX + 1] = {
 static int tcf_mpls_init(struct net *net, struct nlattr *nla,
                         struct nlattr *est, struct tc_action **a,
                         int ovr, int bind, bool rtnl_held,
-                        struct tcf_proto *tp, struct netlink_ext_ack *extack)
+                        struct tcf_proto *tp, u32 flags,
+                        struct netlink_ext_ack *extack)
 {
        struct tc_action_net *tn = net_generic(net, mpls_net_id);
        struct nlattr *tb[TCA_MPLS_MAX + 1];
@@ -224,7 +227,7 @@ static int tcf_mpls_init(struct net *net, struct nlattr *nla,
 
        if (!exists) {
                ret = tcf_idr_create(tn, index, est, a,
-                                    &act_mpls_ops, bind, true);
+                                    &act_mpls_ops, bind, true, 0);
                if (ret) {
                        tcf_idr_cleanup(tn, index);
                        return ret;
@@ -262,7 +265,7 @@ static int tcf_mpls_init(struct net *net, struct nlattr *nla,
 
        spin_lock_bh(&m->tcf_lock);
        goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
-       rcu_swap_protected(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
+       p = rcu_replace_pointer(m->mpls_p, p, lockdep_is_held(&m->tcf_lock));
        spin_unlock_bh(&m->tcf_lock);
 
        if (goto_ch)