[ovs-discuss] problem with multiple pop_mpls

Tonghao Zhang xiangxia.m.yue at gmail.com
Mon Nov 18 12:59:56 UTC 2019


On Fri, Nov 15, 2019 at 12:39 AM Adel Belkhiri <adel.belkhiri at gmail.com>
wrote:

> Hello again,
>
> Thanks Ahmed and Tonghao for your replies.
>
>
> Tonghao : IP packets are encapsulated By the MPLS protocol. After popping
> the inner mpls header we will find the IP header. That's why i used
> pop_mpls:0x800 to change the type of the ethernet frame.
>
I hope the patch may help you, not fully test.

diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 0f7ab53fc141..dab0f5f7f6d6 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -3061,9 +3061,15 @@ static int __ovs_nla_copy_actions(struct net *net,
const struct nlattr *attr,
  break;
  }

- case OVS_ACTION_ATTR_POP_MPLS:
+ case OVS_ACTION_ATTR_POP_MPLS: {
+ const struct ovs_action_pop_mpls *mpls = nla_data(a);
+
  if (vlan_tci & htons(VLAN_CFI_MASK) ||
-    !eth_p_mpls(eth_type))
+    (eth_type != htons(ETH_P_IP) &&
+     eth_type != htons(ETH_P_IPV6) &&
+     eth_type != htons(ETH_P_ARP) &&
+     eth_type != htons(ETH_P_RARP) &&
+     !eth_p_mpls(eth_type)))
  return -EINVAL;

  /* Disallow subsequent L2.5+ set and mpls_pop actions
@@ -3075,9 +3081,10 @@ static int __ovs_nla_copy_actions(struct net *net,
const struct nlattr *attr,
  * Support for these actions is planned using packet
  * recirculation.
  */
- eth_type = htons(0);
+ eth_type = mpls->mpls_ethertype;
  break;

+ }
  case OVS_ACTION_ATTR_SET:
  err = validate_set(a, key, sfa,
    &skip_copy, mac_proto, eth_type,
diff --git a/datapath/linux/compat/include/linux/openvswitch.h
b/datapath/linux/compat/include/linux/openvswitch.h
index 778827f8b5a2..3e227944fb32 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -708,6 +708,10 @@ struct ovs_action_push_mpls {
  __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
 };

+struct ovs_action_pop_mpls {
+ __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
+};
+
 /**
  * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action
argument.
  * @vlan_tpid: Tag protocol identifier (TPID) to push.



> Ahmed : Yes. I'm working with the kernel datapath. Normally since it
> supports multiple pushing it should also support multiple popping. With
> double popping the kernel datapath forward the packet to the ovs-vswitchd
> but this latter could not handle it properly (may be because of a bug).
>
>
> Best regards,
> Adele
>
>
> Le jeu. 14 nov. 2019 à 04:14, Ahmed Medhat <a.medhat.h at gmail.com> a
> écrit :
>
>> Hi Adel,
>>
>> I expect you are using the kernel datapath type which has basic
>> support to mpls. You can use the userspace datapath typeif you need
>> multiple mpls pushing/popping.
>>
>> ovs-vsctl add-br br0 -- set bridge <bridge name> datapath_type=netdev
>>
>> Best regards,
>> Ahmed
>>
>> On Wed, Nov 13, 2019 at 6:46 PM Adel Belkhiri <adel.belkhiri at gmail.com>
>> wrote:
>> >
>> > Hi All,
>> >
>> > I have an issue with popping multiple mpls headers with ovs. The
>> pushing via push_mpls works fine but the popping via pop_mpls triggers a
>> warning in the log and the operation is not accomplished.
>> >
>> > |WARN|system at ovs-system: execute pop_mpls(eth_type=0x8847),pop_mpls
>> (eth_type=0x800),2 failed (Invalid argument) on packet
>> mpls,vlan_tci=0x0000,
>> dl_src=ba:bd:0d:9d:c5:ee,dl_dst=ea:f5:19:d4:e2:4f,mpls_label=15,mpls_tc=0,mpls_ttl=64,mpls_bos=0,mpls_lse1=45376
>> with metadata skb_priority(0),skb_mark(0), in_port(1) mtu 0
>> >
>> > I'm using the last version of OVS : 2.12.90. My OpenFlow rules are the
>> following :
>> >
>> > sudo ovs-ofctl add-flow $S1
>> "table=0,in_port=$S1_ETH2,eth_type=0x8847,mpls_bos=1,actions=pop_mpls:0x8847,resubmit(,0)"
>> > sudo ovs-ofctl add-flow $S1
>> "table=0,in_port=$S1_ETH2,eth_type=0x8847,mpls_bos=0,actions=pop_mpls:0x800,output:$S1_ETH1"
>> >
>> >
>> > Any hint how to solve this?
>> >
>> > Many thanks.
>> > Adele.
>> > _______________________________________________
>> > discuss mailing list
>> > discuss at openvswitch.org
>> > https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>>
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20191118/acd7925d/attachment.html>


More information about the discuss mailing list