<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Nov 15, 2019 at 12:39 AM Adel Belkhiri <<a href="mailto:adel.belkhiri@gmail.com">adel.belkhiri@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello again,<div><br></div><div>Thanks Ahmed and Tonghao for your replies.</div><div><br></div><div><br></div>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.</div></blockquote><div>I hope the patch may help you, not fully test.</div><div><br></div><div>diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c<br>index 0f7ab53fc141..dab0f5f7f6d6 100644<br>--- a/datapath/flow_netlink.c<br>+++ b/datapath/flow_netlink.c<br>@@ -3061,9 +3061,15 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,<br>                     break;<br>               }<br><br>-          case OVS_ACTION_ATTR_POP_MPLS:<br>+               case OVS_ACTION_ATTR_POP_MPLS: {<br>+                     const struct ovs_action_pop_mpls *mpls = nla_data(a);<br>+<br>                     if (vlan_tci & htons(VLAN_CFI_MASK) ||<br>-                       !eth_p_mpls(eth_type))<br>+                     (eth_type != htons(ETH_P_IP) &&<br>+                             eth_type != htons(ETH_P_IPV6) &&<br>+                           eth_type != htons(ETH_P_ARP) &&<br>+                            eth_type != htons(ETH_P_RARP) &&<br>+                           !eth_p_mpls(eth_type)))<br>                               return -EINVAL;<br><br>                    /* Disallow subsequent L2.5+ set and mpls_pop actions<br>@@ -3075,9 +3081,10 @@ static int __ovs_nla_copy_actions(struct net *net, const struct nlattr *attr,<br>                   * Support for these actions is planned using packet<br>                          * recirculation.<br>                     */<br>-                  eth_type = htons(0);<br>+                 eth_type = mpls->mpls_ethertype;<br>                  break;<br><br>+             }<br>            case OVS_ACTION_ATTR_SET:<br>                    err = validate_set(a, key, sfa,<br>                                         &skip_copy, mac_proto, eth_type,<br>diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h<br>index 778827f8b5a2..3e227944fb32 100644<br>--- a/datapath/linux/compat/include/linux/openvswitch.h<br>+++ b/datapath/linux/compat/include/linux/openvswitch.h<br>@@ -708,6 +708,10 @@ struct ovs_action_push_mpls {<br>  __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */<br> };<br><br>+struct ovs_action_pop_mpls {<br>+  __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */<br>+};<br>+<br> /**<br>  * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.<br>  * @vlan_tpid: Tag protocol identifier (TPID) to push.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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).</div><div><br></div><div><br></div><div>Best regards,</div><div>Adele<br><br><table cellpadding="0" style="border-collapse:collapse;margin-top:0px;width:auto;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:0.2px;display:block;color:rgb(119,119,119)"></table></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 14 nov. 2019 à 04:14, Ahmed Medhat <<a href="mailto:a.medhat.h@gmail.com" target="_blank">a.medhat.h@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Adel,<br>
<br>
I expect you are using the kernel datapath type which has basic<br>
support to mpls. You can use the userspace datapath typeif you need<br>
multiple mpls pushing/popping.<br>
<br>
ovs-vsctl add-br br0 -- set bridge <bridge name> datapath_type=netdev<br>
<br>
Best regards,<br>
Ahmed<br>
<br>
On Wed, Nov 13, 2019 at 6:46 PM Adel Belkhiri <<a href="mailto:adel.belkhiri@gmail.com" target="_blank">adel.belkhiri@gmail.com</a>> wrote:<br>
><br>
> Hi All,<br>
><br>
> 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.<br>
><br>
> |WARN|system@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<br>
><br>
> I'm using the last version of OVS : 2.12.90. My OpenFlow rules are the following :<br>
><br>
> sudo ovs-ofctl add-flow $S1 "table=0,in_port=$S1_ETH2,eth_type=0x8847,mpls_bos=1,actions=pop_mpls:0x8847,resubmit(,0)"<br>
> 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"<br>
><br>
><br>
> Any hint how to solve this?<br>
><br>
> Many thanks.<br>
> Adele.<br>
> _______________________________________________<br>
> discuss mailing list<br>
> <a href="mailto:discuss@openvswitch.org" target="_blank">discuss@openvswitch.org</a><br>
> <a href="https://mail.openvswitch.org/mailman/listinfo/ovs-discuss" rel="noreferrer" target="_blank">https://mail.openvswitch.org/mailman/listinfo/ovs-discuss</a><br>
</blockquote></div>
_______________________________________________<br>
discuss mailing list<br>
<a href="mailto:discuss@openvswitch.org" target="_blank">discuss@openvswitch.org</a><br>
<a href="https://mail.openvswitch.org/mailman/listinfo/ovs-discuss" rel="noreferrer" target="_blank">https://mail.openvswitch.org/mailman/listinfo/ovs-discuss</a><br>
</blockquote></div></div>