* Re: [PATCH net-next 3/3] net/mlx4_en: Fix handling of dma_map failure
From: Francois Romieu @ 2013-08-19 20:42 UTC (permalink / raw)
To: Amir Vadai; +Cc: David S. Miller, netdev
In-Reply-To: <1376894542-27854-4-git-send-email-amirv@mellanox.com>
Amir Vadai <amirv@mellanox.com> :
[...]
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> index 157bcd1..92d7097 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
> @@ -673,6 +673,64 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> tx_info->skb = skb;
> tx_info->nr_txbb = nr_txbb;
>
> + if (lso_header_size)
> + data = ((void *)&tx_desc->lso + ALIGN(lso_header_size + 4,
> + DS_SIZE));
> + else
> + data = &tx_desc->data;
> +
> + /* valid only for none inline segments */
> + tx_info->data_offset = (void *)data - (void *)tx_desc;
> +
> + tx_info->linear = (lso_header_size < skb_headlen(skb) &&
> + !is_inline(skb, NULL)) ? 1 : 0;
> +
> + data += skb_shinfo(skb)->nr_frags + tx_info->linear - 1;
> +
> + if (is_inline(skb, &fragptr)) {
> + tx_info->inl = 1;
> + } else {
> + /* Map fragments */
> + for (i = skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) {
> + frag = &skb_shinfo(skb)->frags[i];
> + dma = skb_frag_dma_map(priv->ddev, frag,
> + 0, skb_frag_size(frag),
> + DMA_TO_DEVICE);
> + if (dma_mapping_error(priv->ddev, dma)) {
goto err_unmap_frags;
You have a lot of huge scope variables. At least use these to hide
the 80 cols problems.
> + for (i++; i < skb_shinfo(skb)->nr_frags; i++) {
> + frag = &skb_shinfo(skb)->frags[i];
> + en_err(priv, "DMA mapping error\n");
> + dma_unmap_page(priv->ddev,
> + (dma_addr_t) be64_to_cpu(data[i].addr),
> + skb_frag_size(frag), PCI_DMA_TODEVICE);
> + }
> + goto tx_drop;
> + }
> +
> + data->addr = cpu_to_be64(dma);
> + data->lkey = cpu_to_be32(mdev->mr.key);
> + wmb();
> + data->byte_count = cpu_to_be32(skb_frag_size(frag));
> + --data;
> + }
> +
> + /* Map linear part */
> + if (tx_info->linear) {
> + u32 byte_count = skb_headlen(skb) - lso_header_size;
> + dma = dma_map_single(priv->ddev, skb->data +
> + lso_header_size, byte_count,
> + PCI_DMA_TODEVICE);
> + if (dma_mapping_error(priv->ddev, dma))
> + goto tx_drop;
(frags dma leak)
goto err_unmap_frags;
You may consider a local variable for 'priv->ddev' btw.
--
Ueimor
^ permalink raw reply
* Re: NAT stops forwarding ACKs after PMTU discovery
From: Christoph Paasch @ 2013-08-19 20:43 UTC (permalink / raw)
To: Jozsef Kadlecsik
Cc: Eric Dumazet, Corey Hickey, Linux Netdev List, netfilter-devel
In-Reply-To: <alpine.DEB.2.00.1308192207130.27869@blackhole.kfki.hu>
On 19/08/13 - 22:13:59, Jozsef Kadlecsik wrote:
> On Mon, 19 Aug 2013, Eric Dumazet wrote:
>
> > On Mon, 2013-08-19 at 15:49 +0200, Christoph Paasch wrote:
> >
> > > It's a TCP-patch, that interprets duplicate-acks with invalid SACK-blocks as
> > > duplicate acks in tcp_sock->sacked_out.
> >
> > Yeah, but here, this is conntrack who is blocking the thing.
> >
> > TCP receiver has no chance to 'fix' it.
> >
> > See conntrack is one of those buggy middle box as well.
> >
> > So if you want to properly handle this mess, you'll also have to fix
> > conntrack.
>
> I beg you pardon: why conntrack should be relaxed, when it is expected
> to do more strict TCP checkings (RFC5961, Section 5.).
There is no mention of SACK in this RFC.
The duplicate ACKs with invalid SACK-blocks are valid with respect to
RFC5961, Section 5.
Actually, no RFC says that dup-ACKs with invalid SACK-blocks should
be discarded.
Cheers,
Christoph
^ permalink raw reply
* Re: [PATCH] Passing sk_buff metadata information to user space in TUNTAP driver.
From: Maciej Żenczykowski @ 2013-08-19 20:49 UTC (permalink / raw)
To: Valas Valancius
Cc: Valas Valancius, David S. Miller, Eric Dumazet, Linux NetDev
In-Reply-To: <1376944177-20031-1-git-send-email-vytautas.valancius@gmail.com>
Acked-by: Maciej Żenczykowski <maze@google.com>
I've already reviewed / commented on previous versions of this patch
and am hoping for comments from a wider audience.
I'm hoping this relatively generic and easily extensible way of
exposing additional per-packet metadata to userspace catches on.
Something similar would also be useful for tcpdump (ie. raw packet sockets).
- Maciej
^ permalink raw reply
* Re: NAT stops forwarding ACKs after PMTU discovery
From: Eric Dumazet @ 2013-08-19 21:08 UTC (permalink / raw)
To: Jozsef Kadlecsik
Cc: Christoph Paasch, Corey Hickey, Linux Netdev List,
netfilter-devel
In-Reply-To: <alpine.DEB.2.00.1308192207130.27869@blackhole.kfki.hu>
On Mon, 2013-08-19 at 22:13 +0200, Jozsef Kadlecsik wrote:
> On Mon, 19 Aug 2013, Eric Dumazet wrote:
>
> > On Mon, 2013-08-19 at 15:49 +0200, Christoph Paasch wrote:
> >
> > > It's a TCP-patch, that interprets duplicate-acks with invalid SACK-blocks as
> > > duplicate acks in tcp_sock->sacked_out.
> >
> > Yeah, but here, this is conntrack who is blocking the thing.
> >
> > TCP receiver has no chance to 'fix' it.
> >
> > See conntrack is one of those buggy middle box as well.
> >
> > So if you want to properly handle this mess, you'll also have to fix
> > conntrack.
>
> I beg you pardon: why conntrack should be relaxed, when it is expected
> to do more strict TCP checkings (RFC5961, Section 5.).
>
> Also, it's clearly a broken middle box. Don't shoot the messenger.
Frames are dropped by conntrack, before TCP receiver can even have a
choice.
So Christoph patch would be of no use for Corey.
I do not think I shot anyone, only stated the truth.
We have workarounds in our stack to 'fix' bugs from others, there
is no shame in this.
Glad to see you are interested in RFC 5961 support, as conntrack is
known to break the ACK challenges in response to RST messages (section
3)
^ permalink raw reply
* Re: [PATCH net] packet: restore packet statistics tp_packets to include drops
From: Daniel Borkmann @ 2013-08-19 21:11 UTC (permalink / raw)
To: Willem de Bruijn; +Cc: davem, netdev, sergei.shtylyov
In-Reply-To: <1376944822-30454-1-git-send-email-willemb@google.com>
On 08/19/2013 10:40 PM, Willem de Bruijn wrote:
> getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit
> ee80fbf301 ("packet: account statistics only in tpacket_stats_u")
> cleaned up the getsockopt PACKET_STATISTICS code.
> This also changed semantics. Historically, tp_packets included
> tp_drops on return. The commit removed the line that adds tp_drops
> into tp_packets.
>
> This patch reinstates the old semantics.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
^ permalink raw reply
* Re: [RFC 0/2] Account for duplicate ACKs with invalid SACK-blocks
From: Corey Hickey @ 2013-08-19 21:22 UTC (permalink / raw)
To: Christoph Paasch; +Cc: Eric Dumazet, netdev, Phil Oester, Benjamin Hesmans
In-Reply-To: <1376940568-16512-1-git-send-email-christoph.paasch@uclouvain.be>
On 2013-08-19 12:29, Christoph Paasch wrote:
> There exist sequence-number rewriting middleboxes, who do not modify the
> sequence-number in the SACK-blocks.
> Duplicate acknowledgments with these (invalid) SACK-blocks will not be
> accounted in sacked_out, and thus no fast-retransmit will trigger.
> So, the only way to recover from a packet-loss is through an RTO,
> effectively killing the performance of TCP in this case.
>
> Performance-results can be seen here:
> http://tools.ietf.org/agenda/87/slides/slides-87-tcpm-11.pdf
>
> Another solution might be to simply disable SACK, as soon as an invalid
> SACK-block has been received (as suggested by Phil Oester). This however
> might be too aggressive.
>
> Christoph Paasch (2):
> Use acked_out for reno-style ack acounting instead of sacked_out
> Account acked_out in sack, if the sack is invalid
>
> include/linux/tcp.h | 1 +
> include/net/tcp.h | 17 +++++---
> net/ipv4/tcp_input.c | 103 ++++++++++++++++++++++++++++++++---------------
> net/ipv4/tcp_minisocks.c | 1 +
> net/ipv4/tcp_output.c | 6 +--
> net/ipv4/tcp_timer.c | 2 +-
> 6 files changed, 89 insertions(+), 41 deletions(-)
I tested this patchset, and, unfortunately, the behavior seems to be the
same.
I'm still planning on working with the Cisco device, when I can get some
of the network admin's time, but that won't happen immediately.
Thanks,
Corey
^ permalink raw reply
* Re: [Patch net-next v3 9/9] selinux: use generic union inet_addr
From: Casey Schaufler @ 2013-08-19 21:42 UTC (permalink / raw)
To: David Miller
Cc: amwang, netdev, james.l.morris, sds, eparis, pmoore, linux-kernel,
linux-security-module
In-Reply-To: <20130819.125026.636442915180863272.davem@davemloft.net>
On 8/19/2013 12:50 PM, David Miller wrote:
> It's so that you can pass a generic ipv4/ipv6 address blob into
> things like printf formatting, and since there is an address family
> member present, it knows what's in there and therefore one printf
> format specifier can handle both ipv4 and ipv6 addresses.
The patch message needs to say that, then.
> Like you, I think these changes a complete waste of time too, I'm just
> relaying what I was told.
Well, they certainly don't appear to add any value on their own.
I also generally oppose doing clever things with data structures.
I recently got bitten by the "obvious" relationships between
sockaddr, sockaddr_in and sockaddr_in6, and I've been doing this
stuff since before ioctl was invented.
^ permalink raw reply
* Re: NAT stops forwarding ACKs after PMTU discovery
From: Jozsef Kadlecsik @ 2013-08-19 22:07 UTC (permalink / raw)
To: Eric Dumazet
Cc: Christoph Paasch, Corey Hickey, Linux Netdev List,
netfilter-devel
In-Reply-To: <1376946527.4226.80.camel@edumazet-glaptop>
On Mon, 19 Aug 2013, Eric Dumazet wrote:
> On Mon, 2013-08-19 at 22:13 +0200, Jozsef Kadlecsik wrote:
> > On Mon, 19 Aug 2013, Eric Dumazet wrote:
> >
> > > On Mon, 2013-08-19 at 15:49 +0200, Christoph Paasch wrote:
> > >
> > > > It's a TCP-patch, that interprets duplicate-acks with invalid
> > > > SACK-blocks as duplicate acks in tcp_sock->sacked_out.
> > >
> > > Yeah, but here, this is conntrack who is blocking the thing.
> > >
> > > TCP receiver has no chance to 'fix' it.
> > >
> > > See conntrack is one of those buggy middle box as well.
> > >
> > > So if you want to properly handle this mess, you'll also have to fix
> > > conntrack.
> >
> > I beg you pardon: why conntrack should be relaxed, when it is expected
> > to do more strict TCP checkings (RFC5961, Section 5.).
> >
> > Also, it's clearly a broken middle box. Don't shoot the messenger.
>
> Frames are dropped by conntrack, before TCP receiver can even have a
> choice.
>
> So Christoph patch would be of no use for Corey.
Yes, exactly.
> I do not think I shot anyone, only stated the truth.
There's a middlebox in the path wich breaks SACK completely and conntrack
drops (technically marks as INVALID) the packets with bogus SACK options.
It can be fixed by fixing the middlebox, or disabling SACK by the
TCPOPTSTRIP target, or by relaxing conntrack. For the latter, the next
untested patch may be sufficient:
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 7dcc376..8b5d783 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -649,6 +649,11 @@ static bool tcp_in_window(const struct nf_conn *ct,
receiver->td_end, receiver->td_maxend, receiver->td_maxwin,
receiver->td_scale);
+ /* Fall back to ACK when SACK is bogus */
+ if (!(before(sack, receiver->td_end + 1) &&
+ after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)))
+ sack = ack;
+
pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n",
before(seq, sender->td_maxend + 1),
after(end, sender->td_end - receiver->td_maxwin - 1),
However it is good to cover the issue thus?
> We have workarounds in our stack to 'fix' bugs from others, there
> is no shame in this.
>
> Glad to see you are interested in RFC 5961 support, as conntrack is
> known to break the ACK challenges in response to RST messages (section
> 3)
*Any* netfilter configuration where the non-allowed TCP packets are
dropped and not rejected breaks the ACK challenges. That is why I consider
only section 5 useful from RFC 5961.
Best regards,
Jozsef
-
E-mail : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
H-1525 Budapest 114, POB. 49, Hungary
^ permalink raw reply related
* Re: [PATCH] Fix stack corruption on some architectures
From: Greg Kroah-Hartman @ 2013-08-19 22:23 UTC (permalink / raw)
To: Daniel Gimpelevich; +Cc: Jan Dumon, linux-usb, netdev, linux-kernel
In-Reply-To: <1376944647.5082.12.camel@chimera>
On Mon, Aug 19, 2013 at 01:37:27PM -0700, Daniel Gimpelevich wrote:
> There is no need to get an interface specification if we know it's the
> wrong one; trivial change. The big thing, though, was explained in the
> #mipslinux IRC channel:
> [Mon 2013-08-19 12:28:21 PM PDT] <headless> guys, are you sure it's not "DMA off stack" case?
> [Mon 2013-08-19 12:28:35 PM PDT] <headless> it's a known stack corruptor on non-coherent arches
> [Mon 2013-08-19 12:31:48 PM PDT] <DonkeyHotei> headless: for usb/ehci?
> [Mon 2013-08-19 12:34:11 PM PDT] <DonkeyHotei> headless: explain
> [Mon 2013-08-19 12:35:38 PM PDT] <headless> usb_control_msg() (or other such func) should not use buffer on stack. DMA from/to stack is prohibited
> [Mon 2013-08-19 12:35:58 PM PDT] <headless> and EHCI uses DMA on control xfers (as well as all the others)
>
> Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* [patch -next v2] ipip: dereferencing an ERR_PTR in ip_tunnel_init_net()
From: Dan Carpenter @ 2013-08-19 22:23 UTC (permalink / raw)
To: David S. Miller, Nicolas Dichtel
Cc: Alexey Kuznetsov, Eric Dumazet, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, netdev, kernel-janitors
In-Reply-To: <1376917088.4226.50.camel@edumazet-glaptop>
The __ip_tunnel_create() function returns an ERR_PTR on error so we need
to check for that before dereferencing. This bug was added in commit
6c742e714d8c2 ("ipip: add x-netns support").
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Eric Dumazet said v1 patch looked racy and suggested the v2 fix.
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index a4d9126..830de3f 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -857,13 +857,11 @@ int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
/* FB netdevice is special: we have one, and only one per netns.
* Allowing to move it to another netns is clearly unsafe.
*/
- itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
+ if (!IS_ERR(itn->fb_tunnel_dev))
+ itn->fb_tunnel_dev->features |= NETIF_F_NETNS_LOCAL;
rtnl_unlock();
- if (IS_ERR(itn->fb_tunnel_dev))
- return PTR_ERR(itn->fb_tunnel_dev);
-
- return 0;
+ return PTR_RET(itn->fb_tunnel_dev);
}
EXPORT_SYMBOL_GPL(ip_tunnel_init_net);
^ permalink raw reply related
* Re: [PATCH] Fix stack corruption on some architectures
From: Sergei Shtylyov @ 2013-08-19 22:31 UTC (permalink / raw)
To: Daniel Gimpelevich
Cc: Jan Dumon, Greg Kroah-Hartman, linux-usb, netdev, linux-kernel
In-Reply-To: <1376944647.5082.12.camel@chimera>
Hello.
On 08/20/2013 12:37 AM, Daniel Gimpelevich wrote:
> There is no need to get an interface specification if we know it's the
> wrong one; trivial change.
Is it related to stack corruption? If not, it's asking to be in a separate
patch.
> The big thing, though, was explained in the
> #mipslinux IRC channel:
> [Mon 2013-08-19 12:28:21 PM PDT] <headless> guys, are you sure it's not "DMA off stack" case?
> [Mon 2013-08-19 12:28:35 PM PDT] <headless> it's a known stack corruptor on non-coherent arches
> [Mon 2013-08-19 12:31:48 PM PDT] <DonkeyHotei> headless: for usb/ehci?
> [Mon 2013-08-19 12:34:11 PM PDT] <DonkeyHotei> headless: explain
> [Mon 2013-08-19 12:35:38 PM PDT] <headless> usb_control_msg() (or other such func) should not use buffer on stack. DMA from/to stack is prohibited
> [Mon 2013-08-19 12:35:58 PM PDT] <headless> and EHCI uses DMA on control xfers (as well as all the others)
That headless was me. :-)
> Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] Fix stack corruption on some architectures
From: Daniel Gimpelevich @ 2013-08-19 22:39 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Jan Dumon, Greg Kroah-Hartman, linux-usb, netdev, linux-kernel
In-Reply-To: <52129CD4.1060200@cogentembedded.com>
On Tue, 2013-08-20 at 02:31 +0400, Sergei Shtylyov wrote:
> Hello.
>
> On 08/20/2013 12:37 AM, Daniel Gimpelevich wrote:
>
> > There is no need to get an interface specification if we know it's the
> > wrong one; trivial change.
>
> Is it related to stack corruption? If not, it's asking to be in a separate
> patch.
Perhaps, but I'll leave that up to the maintainer(s). You should be
credited as co-author of the patch.
^ permalink raw reply
* [PATCH] drivers:net:ifb: Fixed coding style error:assignment in if statement
From: Sanil Kumar D @ 2013-08-19 23:39 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Sanil Kumar D
Fixed coding style error (assignment within if statement at 2 places in drivers/net/ifb.c)
Signed-off-by: Sanil Kumar D <skd.linux@gmail.com>
---
drivers/net/ifb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index a3bed28..f3fa85a 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -68,7 +68,8 @@ static void ri_tasklet(unsigned long dev)
struct sk_buff *skb;
txq = netdev_get_tx_queue(_dev, 0);
- if ((skb = skb_peek(&dp->tq)) == NULL) {
+ skb = skb_peek(&dp->tq);
+ if (skb == NULL) {
if (__netif_tx_trylock(txq)) {
skb_queue_splice_tail_init(&dp->rq, &dp->tq);
__netif_tx_unlock(txq);
@@ -112,7 +113,8 @@ static void ri_tasklet(unsigned long dev)
}
if (__netif_tx_trylock(txq)) {
- if ((skb = skb_peek(&dp->rq)) == NULL) {
+ skb = skb_peek(&dp->rq);
+ if (skb == NULL) {
dp->tasklet_pending = 0;
if (netif_queue_stopped(_dev))
netif_wake_queue(_dev);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH net-next v7 8/8] openvswitch: Add vxlan tunneling support.
From: Jesse Gross @ 2013-08-20 0:25 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, David Miller, Stephen Hemminger
In-Reply-To: <1376936614-25770-1-git-send-email-pshelar@nicira.com>
On Mon, Aug 19, 2013 at 11:23 AM, Pravin B Shelar <pshelar@nicira.com> wrote:
> Following patch adds vxlan vport type for openvswitch using
> vxlan api. So now there is vxlan dependency for openvswitch.
>
> CC: Jesse Gross <jesse@nicira.com>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
^ permalink raw reply
* Re: [PATCH ipsec v2 1/3] ipv6: wire up skb->encapsulation
From: Simon Horman @ 2013-08-20 0:35 UTC (permalink / raw)
To: netdev, steffen.klassert, yoshfuji, nicolas.dichtel, edumazet
In-Reply-To: <20130818114652.GA10192@order.stressinduktion.org>
On Sun, Aug 18, 2013 at 01:46:52PM +0200, Hannes Frederic Sowa wrote:
> When pushing a new header before current one call skb_reset_inner_headers
> to record the position of the inner headers in the various ipv6 tunnel
> protocols.
>
> We later need this to correctly identify the addresses needed to send
> back an error in the xfrm layer.
>
> This change is safe, because skb->protocol is always checked before
> dereferencing data from the inner protocol.
It seems that the intention is to only track the inner-most header
due to the presence of if (likely(!skb->encapsulation)). Is this the
intention?
>
> v2:
> a) unchanged
>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Acked-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
>
> This patch is based on Steffen Klassert's ipsec tree.
>
> net/ipv6/ip6_gre.c | 5 +++++
> net/ipv6/ip6_tunnel.c | 6 ++++++
> net/ipv6/sit.c | 5 +++++
> 3 files changed, 16 insertions(+)
>
> diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
> index ecd6073..90747f1 100644
> --- a/net/ipv6/ip6_gre.c
> +++ b/net/ipv6/ip6_gre.c
> @@ -724,6 +724,11 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
> ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
> }
>
> + if (likely(!skb->encapsulation)) {
> + skb_reset_inner_headers(skb);
> + skb->encapsulation = 1;
> + }
> +
> skb_push(skb, gre_hlen);
> skb_reset_network_header(skb);
> skb_set_transport_header(skb, sizeof(*ipv6h));
> diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
> index 1e55866..46ba243 100644
> --- a/net/ipv6/ip6_tunnel.c
> +++ b/net/ipv6/ip6_tunnel.c
> @@ -1027,6 +1027,12 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
> init_tel_txopt(&opt, encap_limit);
> ipv6_push_nfrag_opts(skb, &opt.ops, &proto, NULL);
> }
> +
> + if (likely(!skb->encapsulation)) {
> + skb_reset_inner_headers(skb);
> + skb->encapsulation = 1;
> + }
> +
> skb_push(skb, sizeof(struct ipv6hdr));
> skb_reset_network_header(skb);
> ipv6h = ipv6_hdr(skb);
> diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
> index a3437a4..fbfc5a8 100644
> --- a/net/ipv6/sit.c
> +++ b/net/ipv6/sit.c
> @@ -888,6 +888,11 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
> ttl = iph6->hop_limit;
> tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6));
>
> + if (likely(!skb->encapsulation)) {
> + skb_reset_inner_headers(skb);
> + skb->encapsulation = 1;
> + }
> +
> err = iptunnel_xmit(dev_net(dev), rt, skb, fl4.saddr, fl4.daddr,
> IPPROTO_IPV6, tos, ttl, df);
> iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH ipsec v2 1/3] ipv6: wire up skb->encapsulation
From: Hannes Frederic Sowa @ 2013-08-20 0:36 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, steffen.klassert, yoshfuji, nicolas.dichtel, edumazet
In-Reply-To: <20130820003546.GA14038@verge.net.au>
On Tue, Aug 20, 2013 at 10:35:46AM +1000, Simon Horman wrote:
> On Sun, Aug 18, 2013 at 01:46:52PM +0200, Hannes Frederic Sowa wrote:
> > When pushing a new header before current one call skb_reset_inner_headers
> > to record the position of the inner headers in the various ipv6 tunnel
> > protocols.
> >
> > We later need this to correctly identify the addresses needed to send
> > back an error in the xfrm layer.
> >
> > This change is safe, because skb->protocol is always checked before
> > dereferencing data from the inner protocol.
>
> It seems that the intention is to only track the inner-most header
> due to the presence of if (likely(!skb->encapsulation)). Is this the
> intention?
Ack. Do you see problems with this?
Greetings,
Hannes
^ permalink raw reply
* Re: [PATCH ipsec v2 1/3] ipv6: wire up skb->encapsulation
From: Simon Horman @ 2013-08-20 1:49 UTC (permalink / raw)
To: netdev, steffen.klassert, yoshfuji, nicolas.dichtel, edumazet
In-Reply-To: <20130820003651.GA3938@order.stressinduktion.org>
On Tue, Aug 20, 2013 at 02:36:51AM +0200, Hannes Frederic Sowa wrote:
> On Tue, Aug 20, 2013 at 10:35:46AM +1000, Simon Horman wrote:
> > On Sun, Aug 18, 2013 at 01:46:52PM +0200, Hannes Frederic Sowa wrote:
> > > When pushing a new header before current one call skb_reset_inner_headers
> > > to record the position of the inner headers in the various ipv6 tunnel
> > > protocols.
> > >
> > > We later need this to correctly identify the addresses needed to send
> > > back an error in the xfrm layer.
> > >
> > > This change is safe, because skb->protocol is always checked before
> > > dereferencing data from the inner protocol.
> >
> > It seems that the intention is to only track the inner-most header
> > due to the presence of if (likely(!skb->encapsulation)). Is this the
> > intention?
>
> Ack. Do you see problems with this?
Not if it is intended.
Reviewed-by: Simon Horman <horms@verge.net.au>
^ permalink raw reply
* Re: [PATCHv3 linux-next] hrtimer: Add notifier when clock_was_set was called
From: Fan Du @ 2013-08-20 1:56 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Steffen Klassert, David Miller, Herbert Xu, Daniel Borkmann, LKML,
netdev
In-Reply-To: <alpine.DEB.2.02.1308181102230.4089@ionos.tec.linutronix.de>
On 2013年08月18日 17:05, Thomas Gleixner wrote:
> On Wed, 14 Aug 2013, Fan Du wrote:
>
>> From e3929d4fdfad5b40fd8cad0e217597670d1aef54 Mon Sep 17 00:00:00 2001
>> From: Fan Du<fan.du@windriver.com>
>> Date: Wed, 14 Aug 2013 16:39:23 +0800
>> Subject: [PATCHv3 linux-next] hrtimer: Add notifier when clock_was_set was
>> called
>>
>> When clock_was_set is called in case of system wall time change
>> or host resume from suspend state, use this notifier for places
>> where interested in this action, e.g Ipsec SA lifetime management.
>
> Sigh. These notifiers have been proposed in the past and we always
> rejected them. Why do you need this? There should be nothing except
> the core timekeeping code which needs to know about clock_was_set.
>
> Can you please explain what kind of users you have in mind and WHY
> they need to know about it.
Hi, Thomas
Thanks for your patience. Please let me take a few seconds try to
explain this.
Current xfrm layers has *one* hrtimer to guard Ipsec keys timeout,
The timeout could be measured in either of below two ways:
(1) The timer is started once the keys is created, but this
key is not necessary actually used right now. In detail,
record the get_seconds() when this key is created.
(2) Starting the timer when this key is actually used, e.g when
an IP packet need to be encrypted. In details, recored the
get_seconds() when this key is first used.
So in the hrtimer handler, the code get current get_seconds, and
check against with what saved in (1)or(2), and notify the timeout
up to user land.
So the pitfall is using one hrtimer for two timeout events,
most importantly using get_seconds to check timeout, once system
clock is changed by user intentionally, the key timeout could
misbehave wildly.
A refractor has been proposed to get rid of depending on system wall
clock by cleaning up the hrtimer handler. Unfortunately David frowned
on it in (3), and suggest once system clock is changed, adjust the
timeout of the key.
(3): http://www.spinics.net/lists/netdev/msg245169.html
> Thanks,
>
> tglx
>
--
浮沉随浪只记今朝笑
--fan
^ permalink raw reply
* Re: [PATCH] ipv6: handle Redirect ICMP Message with no Redirected Header option
From: Duan Jiong @ 2013-08-20 1:56 UTC (permalink / raw)
To: hannes; +Cc: davem, netdev
In-Reply-To: <20130819115512.GC9414@order.stressinduktion.org>
于 2013年08月19日 19:55, Hannes Frederic Sowa 写道:
> On Mon, Aug 19, 2013 at 06:54:51PM +0800, Duan Jiong wrote:
>> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>>
>> rfc 4861 says the Redirected Header option is optional, so
>> the kernel should not drop the Redirect Message that has no
>> Redirected Header option. In this patch, the function
>> ip6_redirect_no_header() is introduced to deal with that
>> condition.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> ---
>> include/net/ip6_route.h | 1 +
>> net/ipv6/ndisc.c | 4 +++-
>> net/ipv6/route.c | 21 +++++++++++++++++++++
>> 3 files changed, 25 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
>> index 260f83f..7966f54 100644
>> --- a/include/net/ip6_route.h
>> +++ b/include/net/ip6_route.h
>> @@ -135,6 +135,7 @@ extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
>> extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
>> __be32 mtu);
>> extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
>> +extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, u32 mark);
>> extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
>>
>> struct netlink_callback;
>> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
>> index 79aa965..04d31c2 100644
>> --- a/net/ipv6/ndisc.c
>> +++ b/net/ipv6/ndisc.c
>> @@ -1369,8 +1369,10 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
>> if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts))
>> return;
>>
>> - if (!ndopts.nd_opts_rh)
>> + if (!ndopts.nd_opts_rh) {
>> + ip6_redirect_no_header(skb, dev_net(skb->dev), 0, 0);
>> return;
>> + }
>
> Can't we just jump down to icmpv6_notify without introducing
> ip6_redirect_no_header?
>
No, the function icmpv6_notify need the skb->data point the inner IP
packet that triggered the sending of the ICMP Message, so when the
Redirect Message has no Redirected Header option, it should not be
handled in icmpv6_notify.
>>
>> hdr = (u8 *)ndopts.nd_opts_rh;
>> hdr += 8;
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index b70f897..9934b87 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -1178,6 +1178,27 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> }
>> EXPORT_SYMBOL_GPL(ip6_redirect);
>>
>> +void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> +{
>> + const struct ipv6hdr *iph = (struct ipv6hdr *) skb_network_header(skb);
>
> const struct ipv6hdr *iph = ipv6_hdr(skb);
>
Thanks for you help, i will apply it in next version.
Thanks,
Duan
^ permalink raw reply
* Re: [PATCH] ipv6: handle Redirect ICMP Message with no Redirected Header option
From: Duan Jiong @ 2013-08-20 2:00 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: davem, netdev
In-Reply-To: <52126B54.4080603@cogentembedded.com>
于 2013年08月20日 03:00, Sergei Shtylyov 写道:
> Hello.
>
> On 08/19/2013 02:54 PM, Duan Jiong wrote:
>
>> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>
>> rfc 4861 says the Redirected Header option is optional, so
>> the kernel should not drop the Redirect Message that has no
>> Redirected Header option. In this patch, the function
>> ip6_redirect_no_header() is introduced to deal with that
>> condition.
>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> [...]
>
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index b70f897..9934b87 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -1178,6 +1178,27 @@ void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> }
>> EXPORT_SYMBOL_GPL(ip6_redirect);
>>
>> +void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif, u32 mark)
>> +{
>> + const struct ipv6hdr *iph = (struct ipv6hdr *) skb_network_header(skb);
>> + struct rd_msg *msg = (struct rd_msg *)skb_transport_header(skb);
>
> Be consistent please: either put space after a typecast or not.
>
Thanks for you help, i will apply it in next version.
Thanks,
Duan
^ permalink raw reply
* [PATCH v2.37 1/6] odp: Only pass vlan_tci to commit_vlan_action()
From: Simon Horman @ 2013-08-20 2:15 UTC (permalink / raw)
To: dev, netdev
Cc: Ravi K, Isaku Yamahata, Jesse Gross, Pravin B Shelar,
Joe Stringer
In-Reply-To: <1376964964-18151-1-git-send-email-horms@verge.net.au>
From: Joe Stringer <joe@wand.net.nz>
This allows for future patches to pass different tci values to
commit_vlan_action() without passing an entire flow structure.
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
v2.36 - v2.37
* No change
v2.35
* First post
---
lib/odp-util.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/odp-util.c b/lib/odp-util.c
index a09042e..d0c9bbe 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -3097,10 +3097,10 @@ commit_set_ether_addr_action(const struct flow *flow, struct flow *base,
}
static void
-commit_vlan_action(const struct flow *flow, struct flow *base,
+commit_vlan_action(ovs_be16 vlan_tci, struct flow *base,
struct ofpbuf *odp_actions, struct flow_wildcards *wc)
{
- if (base->vlan_tci == flow->vlan_tci) {
+ if (base->vlan_tci == vlan_tci) {
return;
}
@@ -3110,15 +3110,15 @@ commit_vlan_action(const struct flow *flow, struct flow *base,
nl_msg_put_flag(odp_actions, OVS_ACTION_ATTR_POP_VLAN);
}
- if (flow->vlan_tci & htons(VLAN_CFI)) {
+ if (vlan_tci & htons(VLAN_CFI)) {
struct ovs_action_push_vlan vlan;
vlan.vlan_tpid = htons(ETH_TYPE_VLAN);
- vlan.vlan_tci = flow->vlan_tci;
+ vlan.vlan_tci = vlan_tci;
nl_msg_put_unspec(odp_actions, OVS_ACTION_ATTR_PUSH_VLAN,
&vlan, sizeof vlan);
}
- base->vlan_tci = flow->vlan_tci;
+ base->vlan_tci = vlan_tci;
}
static void
@@ -3330,7 +3330,7 @@ commit_odp_actions(const struct flow *flow, struct flow *base,
struct ofpbuf *odp_actions, struct flow_wildcards *wc)
{
commit_set_ether_addr_action(flow, base, odp_actions, wc);
- commit_vlan_action(flow, base, odp_actions, wc);
+ commit_vlan_action(flow->vlan_tci, base, odp_actions, wc);
commit_set_nw_action(flow, base, odp_actions, wc);
commit_set_port_action(flow, base, odp_actions, wc);
/* Committing MPLS actions should occur after committing nw and port
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2.37 0/6] MPLS actions and matches
From: Simon Horman @ 2013-08-20 2:15 UTC (permalink / raw)
To: dev, netdev
Cc: Ravi K, Isaku Yamahata, Jesse Gross, Pravin B Shelar,
Joe Stringer
Hi,
This series implements MPLS actions and matches based on work by
Ravi K, Leo Alterman, Yamahata-san and Joe Stringer.
This series provides two changes
* Provide user-space support for the VLAN/MPLS tag insertion order
up to and including OpenFlow 1.2, and the different ordering
specified from OpenFlow 1.3. In a nutshell the datapath always
uses the OpenFlow 1.3 ordering, which is to always insert tags
immediately after the L2 header, regardless of the presence of other
tags. And ovs-vswtichd provides compatibility for the behaviour up
to OpenFlow 1.2, which is that MPLS tags should follow VLAN tags
if present.
* Adding basic MPLS action and match support to the kernel datapath
Differences between v2.37 and v2.36:
* Rebase
Differences between v2.36 and v2.35:
* Rebase
* Do not add set_ethertype() to datapath/actions.c.
As this patch has evolved this function had devolved into
to sets of functionality wrapped into a single function with
only one line of common code. Refactor things to simply
open-code setting the ether type in the two locations where
set_ethertype() was previously used. The aim here is to improve
readability.
* Update setting skb->ethertype after mpls push and pop.
- In the case of push_mpls it should be set unconditionally
as in v2.35 the behaviour of this function to always push
an MPLS LSE before any VLAN tags.
- In the case of mpls_pop eth_p_mpls(skb->protocol) is a better
test than skb->protocol != htons(ETH_P_8021Q) as it will give the
correct behaviour in the presence of other VLAN ethernet types,
for example 0x88a8 which is used by 802.1ad. Moreover, it seems
correct to update the ethernet type if it was previously set
according to the top-most MPLS LSE.
* Deaccelerate VLANs when pushing MPLS tags the
- Since v2.35 MPLS push will insert an MPLS LSE before any VLAN tags.
This means that if an accelerated tag is present it should be
deaccelerated to ensure it ends up in the correct position.
* Update skb->mac_len in push_mpls() so that it will be correct
when used by a subsequent call to pop_mpls().
As things stand I do not believe this is strictly necessary as
ovs-vswitchd will not send a pop MPLS action after a push MPLS action.
However, I have added this in order to code more defensively as I believe
that if such a sequence did occur it would be rather unobvious why
it didn't work.
* Do not add skb_cow_head() call in push_mpls().
It is unnecessary as there is a make_writable() call.
This change was also made in v2.30 but some how the
code regressed between then and v2.35.
Differences between v2.35 and v2.34:
* Add support for the tag ordering specified up until OpenFlow 1.2 and
the ordering specified from OpenFlow 1.3.
* Correct error in datapath patch's handling of GSO in the presence
of MPLS and absence of VLANs.
Patch overview:
* The first 5 patches of this series are new,
adding support for different tag ordering.
* The last patch is a revised version of the patch to add MPLS support
to the datapath. It has been updated to use OpenFlow 1.3 tag ordering
and resolve a GSO handling bug: both mentioned above. Its change log
includes a history of changes.
To aid review this series is available in git at:
git://github.com/horms/openvswitch.git devel/mpls-v2.37
Patch list and overall diffstat:
Joe Stringer (5):
odp: Only pass vlan_tci to commit_vlan_action()
odp: Allow VLAN actions after MPLS actions
ofp-actions: Add OFPUTIL_OFPAT13_PUSH_MPLS
ofp-actions: Add separate OpenFlow 1.3 action parser
lib: Push MPLS tags in the OpenFlow 1.3 ordering
Simon Horman (1):
datapath: Add basic MPLS support to kernel
datapath/Modules.mk | 1 +
datapath/actions.c | 122 ++++++-
datapath/datapath.c | 254 +++++++++++--
datapath/datapath.h | 9 +
datapath/flow.c | 58 ++-
datapath/flow.h | 17 +-
datapath/linux/compat/gso.c | 50 ++-
datapath/linux/compat/gso.h | 39 ++
datapath/linux/compat/include/linux/netdevice.h | 12 -
datapath/linux/compat/netdevice.c | 28 --
datapath/mpls.h | 15 +
datapath/vport-lisp.c | 1 +
datapath/vport-netdev.c | 44 ++-
include/linux/openvswitch.h | 7 +-
lib/flow.c | 2 +-
lib/odp-util.c | 22 +-
lib/odp-util.h | 4 +-
lib/ofp-actions.c | 68 +++-
lib/ofp-parse.c | 1 +
lib/ofp-util.c | 3 +
lib/ofp-util.h | 1 +
lib/packets.c | 10 +-
lib/packets.h | 2 +-
ofproto/ofproto-dpif-xlate.c | 103 ++++--
ofproto/ofproto-dpif-xlate.h | 5 +
tests/ofproto-dpif.at | 446 +++++++++++++++++++++++
26 files changed, 1193 insertions(+), 131 deletions(-)
create mode 100644 datapath/mpls.h
--
1.7.10.4
^ permalink raw reply
* [PATCH v2.37 4/6] ofp-actions: Add separate OpenFlow 1.3 action parser
From: Simon Horman @ 2013-08-20 2:16 UTC (permalink / raw)
To: dev, netdev
Cc: Ravi K, Isaku Yamahata, Jesse Gross, Pravin B Shelar,
Joe Stringer
In-Reply-To: <1376964964-18151-1-git-send-email-horms@verge.net.au>
From: Joe Stringer <joe@wand.net.nz>
This patch adds new ofpact_from_openflow13() and
ofpacts_from_openflow13() functions parallel to the existing ofpact
handling code. In the OpenFlow 1.3 version, push_mpls is handled
differently, but all other actions are handled by the existing code.
For push_mpls, ofpact_push_mpls.ofpact.compat is set to
OFPUTIL_OFPAT13_PUSH_MPLS, which allows correct VLAN+MPLS datapath
behaviour to be determined at odp translation time.
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
v2.36 - v2.37
* No change
v2.35
* First post
---
lib/ofp-actions.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 60 insertions(+), 3 deletions(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 921aa27..454b9a1 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -878,6 +878,40 @@ ofpacts_from_openflow11(const union ofp_action *in, size_t n_in,
return ofpacts_from_openflow(in, n_in, out, ofpact_from_openflow11);
}
\f
+static enum ofperr
+ofpact_from_openflow13(const union ofp_action *a, struct ofpbuf *out)
+{
+ enum ofputil_action_code code;
+ enum ofperr error;
+
+ error = decode_openflow11_action(a, &code);
+ if (error) {
+ return error;
+ }
+
+ if (code == OFPUTIL_OFPAT11_PUSH_MPLS) {
+ struct ofpact_push_mpls *oam;
+ struct ofp11_action_push *oap = (struct ofp11_action_push *)a;
+ if (!eth_type_mpls(oap->ethertype)) {
+ return OFPERR_OFPBAC_BAD_ARGUMENT;
+ }
+ oam = ofpact_put_PUSH_MPLS(out);
+ oam->ethertype = oap->ethertype;
+ oam->ofpact.compat = OFPUTIL_OFPAT13_PUSH_MPLS;
+ } else {
+ return ofpact_from_openflow11(a, out);
+ }
+
+ return error;
+}
+
+static enum ofperr
+ofpacts_from_openflow13(const union ofp_action *in, size_t n_in,
+ struct ofpbuf *out)
+{
+ return ofpacts_from_openflow(in, n_in, out, ofpact_from_openflow13);
+}
+\f
/* OpenFlow 1.1 instructions. */
#define DEFINE_INST(ENUM, STRUCT, EXTENSIBLE, NAME) \
@@ -1081,6 +1115,17 @@ get_actions_from_instruction(const struct ofp11_instruction *inst,
*n_actions = (ntohs(inst->len) - sizeof *inst) / OFP11_INSTRUCTION_ALIGN;
}
+static uint8_t
+get_version_from_ofpbuf(const struct ofpbuf *openflow)
+{
+ if (openflow && openflow->l2) {
+ struct ofp_header *oh = openflow->l2;
+ return oh->version;
+ }
+
+ return OFP10_VERSION;
+}
+
/* Attempts to convert 'actions_len' bytes of OpenFlow 1.1 actions from the
* front of 'openflow' into ofpacts. On success, replaces any existing content
* in 'ofpacts' by the converted ofpacts; on failure, clears 'ofpacts'.
@@ -1100,8 +1145,15 @@ ofpacts_pull_openflow11_actions(struct ofpbuf *openflow,
unsigned int actions_len,
struct ofpbuf *ofpacts)
{
- return ofpacts_pull_actions(openflow, actions_len, ofpacts,
- ofpacts_from_openflow11);
+ uint8_t version = get_version_from_ofpbuf(openflow);
+
+ if (version < OFP13_VERSION) {
+ return ofpacts_pull_actions(openflow, actions_len, ofpacts,
+ ofpacts_from_openflow11);
+ } else {
+ return ofpacts_pull_actions(openflow, actions_len, ofpacts,
+ ofpacts_from_openflow13);
+ }
}
enum ofperr
@@ -1153,10 +1205,15 @@ ofpacts_pull_openflow11_instructions(struct ofpbuf *openflow,
if (insts[OVSINST_OFPIT11_APPLY_ACTIONS]) {
const union ofp_action *actions;
size_t n_actions;
+ uint8_t version = get_version_from_ofpbuf(openflow);
get_actions_from_instruction(insts[OVSINST_OFPIT11_APPLY_ACTIONS],
&actions, &n_actions);
- error = ofpacts_from_openflow11(actions, n_actions, ofpacts);
+ if (version < OFP13_VERSION) {
+ error = ofpacts_from_openflow11(actions, n_actions, ofpacts);
+ } else {
+ error = ofpacts_from_openflow13(actions, n_actions, ofpacts);
+ }
if (error) {
goto exit;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2.37 3/6] ofp-actions: Add OFPUTIL_OFPAT13_PUSH_MPLS
From: Simon Horman @ 2013-08-20 2:16 UTC (permalink / raw)
To: dev, netdev
Cc: Ravi K, Isaku Yamahata, Jesse Gross, Pravin B Shelar,
Joe Stringer
In-Reply-To: <1376964964-18151-1-git-send-email-horms@verge.net.au>
From: Joe Stringer <joe@wand.net.nz>
This patch adds a new compatibility enum for use with MPLS, so that the
differing behaviour between OpenFlow 1.2 and 1.3 can be implemented in
ofproto-dpif-xlate.
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
v2.36 - v2.37
* No change
v2.35
* First post
---
lib/ofp-actions.c | 5 ++++-
lib/ofp-parse.c | 1 +
lib/ofp-util.c | 3 +++
lib/ofp-util.h | 1 +
4 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 61e2854..921aa27 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -322,6 +322,7 @@ ofpact_from_nxast(const union ofp_action *a, enum ofputil_action_code code,
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM:
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
+ case OFPUTIL_OFPAT13_PUSH_MPLS:
NOT_REACHED();
case OFPUTIL_NXAST_RESUBMIT:
@@ -480,6 +481,7 @@ ofpact_from_openflow10(const union ofp_action *a, struct ofpbuf *out)
case OFPUTIL_ACTION_INVALID:
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM:
#include "ofp-util.def"
+ case OFPUTIL_OFPAT13_PUSH_MPLS:
NOT_REACHED();
case OFPUTIL_OFPAT10_OUTPUT:
@@ -842,7 +844,8 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out)
ofpact_put_DEC_MPLS_TTL(out);
break;
- case OFPUTIL_OFPAT11_PUSH_MPLS: {
+ case OFPUTIL_OFPAT11_PUSH_MPLS:
+ case OFPUTIL_OFPAT13_PUSH_MPLS: {
struct ofp11_action_push *oap = (struct ofp11_action_push *)a;
if (!eth_type_mpls(oap->ethertype)) {
return OFPERR_OFPBAC_BAD_ARGUMENT;
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 5cb39f5..5e719d3 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -799,6 +799,7 @@ parse_named_action(enum ofputil_action_code code,
break;
case OFPUTIL_OFPAT11_PUSH_MPLS:
+ case OFPUTIL_OFPAT13_PUSH_MPLS:
case OFPUTIL_NXAST_PUSH_MPLS:
error = str_to_u16(arg, "push_mpls", ðertype);
if (!error) {
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 45ff0a1..47d2050 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4764,6 +4764,9 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf)
case OFPUTIL_ACTION_INVALID:
NOT_REACHED();
+ case OFPUTIL_OFPAT13_PUSH_MPLS:
+ return ofputil_put_OFPAT11_PUSH_MPLS(buf);
+
#define OFPAT10_ACTION(ENUM, STRUCT, NAME) \
case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf);
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index f3348c0..b5f3506 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -751,6 +751,7 @@ enum OVS_PACKED_ENUM ofputil_action_code {
#define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM,
#include "ofp-util.def"
+ OFPUTIL_OFPAT13_PUSH_MPLS
};
/* The number of values of "enum ofputil_action_code". */
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2.37 5/6] lib: Push MPLS tags in the OpenFlow 1.3 ordering
From: Simon Horman @ 2013-08-20 2:16 UTC (permalink / raw)
To: dev, netdev
Cc: Ravi K, Isaku Yamahata, Jesse Gross, Pravin B Shelar,
Joe Stringer
In-Reply-To: <1376964964-18151-1-git-send-email-horms@verge.net.au>
From: Joe Stringer <joe@wand.net.nz>
This patch modifies the push_mpls behaviour to follow the OpenFlow 1.3
specification in the presence of VLAN tagged packets. From the spec:
"Newly pushed tags should always be inserted as the outermost tag in the
outermost valid location for that tag. When a new VLAN tag is pushed, it
should be the outermost tag inserted, immediately after the Ethernet
header and before other tags. Likewise, when a new MPLS tag is pushed,
it should be the outermost tag inserted, immediately after the Ethernet
header and before other tags."
When the push_mpls action was inserted using OpenFlow 1.2, we implement
the previous behaviour by inserting VLAN actions around the MPLS action
in the odp translation; Pop VLAN tags before committing MPLS actions,
and push the expected VLAN tag afterwards. The trigger condition for
this is based on the ofpact->compat field.
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
v2.36 - v2.37
* No change
v2.35
* First post
---
lib/flow.c | 2 +-
lib/packets.c | 10 +-
lib/packets.h | 2 +-
ofproto/ofproto-dpif-xlate.c | 10 +-
tests/ofproto-dpif.at | 237 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 253 insertions(+), 8 deletions(-)
diff --git a/lib/flow.c b/lib/flow.c
index 3e29aa1..eae08fa 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -1036,7 +1036,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow)
}
if (eth_type_mpls(flow->dl_type)) {
- b->l2_5 = b->l3;
+ b->l2_5 = (char*)b->l2 + ETH_HEADER_LEN;
push_mpls(b, flow->dl_type, flow->mpls_lse);
}
}
diff --git a/lib/packets.c b/lib/packets.c
index b95e1e0..54a3b20 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -244,11 +244,11 @@ eth_mpls_depth(const struct ofpbuf *packet)
/* Set ethertype of the packet. */
void
-set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type)
+set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type, bool inner)
{
struct eth_header *eh = packet->data;
- if (eh->eth_type == htons(ETH_TYPE_VLAN)) {
+ if (inner && eh->eth_type == htons(ETH_TYPE_VLAN)) {
ovs_be16 *p;
p = ALIGNED_CAST(ovs_be16 *,
(char *)(packet->l2_5 ? packet->l2_5 : packet->l3) - 2);
@@ -356,8 +356,8 @@ push_mpls(struct ofpbuf *packet, ovs_be16 ethtype, ovs_be32 lse)
if (!is_mpls(packet)) {
/* Set ethtype and MPLS label stack entry. */
- set_ethertype(packet, ethtype);
- packet->l2_5 = packet->l3;
+ set_ethertype(packet, ethtype, false);
+ packet->l2_5 = (char*)packet->l2 + ETH_HEADER_LEN;
}
/* Push new MPLS shim header onto packet. */
@@ -378,7 +378,7 @@ pop_mpls(struct ofpbuf *packet, ovs_be16 ethtype)
size_t len;
mh = packet->l2_5;
len = (char*)packet->l2_5 - (char*)packet->l2;
- set_ethertype(packet, ethtype);
+ set_ethertype(packet, ethtype, true);
if (mh->mpls_lse & htonl(MPLS_BOS_MASK)) {
packet->l2_5 = NULL;
} else {
diff --git a/lib/packets.h b/lib/packets.h
index 33be891..1b999e0 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -145,7 +145,7 @@ void eth_pop_vlan(struct ofpbuf *);
uint16_t eth_mpls_depth(const struct ofpbuf *packet);
-void set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type);
+void set_ethertype(struct ofpbuf *packet, ovs_be16 eth_type, bool inner);
const char *eth_from_hex(const char *hex, struct ofpbuf **packetp);
void eth_format_masked(const uint8_t eth[ETH_ADDR_LEN],
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 5a4b415..46fd2a1 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2185,6 +2185,12 @@ may_receive(const struct xport *xport, struct xlate_ctx *ctx)
return true;
}
+static bool
+mpls_compat_behaviour(enum ofputil_action_code compat)
+{
+ return (compat != OFPUTIL_OFPAT13_PUSH_MPLS);
+}
+
static void
vlan_tci_restore(struct xlate_in *xin, ovs_be16 *tci_ptr, ovs_be16 orig_tci)
{
@@ -2366,7 +2372,9 @@ do_xlate_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
/* Save and pop any existing VLAN tags if running in OF1.2 mode. */
ctx->xin->vlan_tci = *vlan_tci;
- flow->vlan_tci = htons(0);
+ if (mpls_compat_behaviour(a->compat)) {
+ flow->vlan_tci = htons(0);
+ }
vlan_tci = &ctx->xin->vlan_tci;
break;
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index 37634a9..3d379d5 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -1017,6 +1017,243 @@ NXST_FLOW reply:
OVS_VSWITCHD_STOP
AT_CLEANUP
+AT_SETUP([ofproto-dpif - OF1.3+ VLAN+MPLS handling])
+OVS_VSWITCHD_START([dnl
+ add-port br0 p1 -- set Interface p1 type=dummy
+])
+ON_EXIT([kill `cat ovs-ofctl.pid`])
+
+AT_CAPTURE_FILE([ofctl_monitor.log])
+AT_DATA([flows.txt], [dnl
+cookie=0xa dl_src=40:44:44:44:55:44 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
+cookie=0xa dl_src=40:44:44:44:55:45 actions=push_vlan:0x8100,mod_vlan_vid:99,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
+cookie=0xa dl_src=40:44:44:44:55:46 actions=push_vlan:0x8100,mod_vlan_vid:99,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
+cookie=0xa dl_src=40:44:44:44:55:47 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
+cookie=0xa dl_src=40:44:44:44:55:48 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],controller
+cookie=0xa dl_src=40:44:44:44:55:49 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],push_vlan:0x8100,mod_vlan_vid:99,controller
+cookie=0xa dl_src=40:44:44:44:55:50 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],push_vlan:0x8100,mod_vlan_vid:99,controller
+cookie=0xa dl_src=40:44:44:44:55:51 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],mod_vlan_pcp:1,controller
+cookie=0xa dl_src=40:44:44:44:55:52 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],load:3->OXM_OF_MPLS_TC[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],mod_vlan_pcp:1,controller
+])
+AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
+
+dnl Modified MPLS controller action.
+dnl The input packet has a VLAN tag, but because we push an MPLS tag in
+dnl OF1.3 mode, we can no longer see it.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:44,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:44,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, we push a VLAN tag, then an MPLS tag in OF1.3 mode, so we
+dnl can only see the MPLS tag in the result.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:45,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:45,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, the input packet is vlan-tagged; we update this tag then
+dnl push an MPLS tag in OF1.3 mode. As such, we can only see the MPLS tag in
+dnl the result.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:46,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:46,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, we push a VLAN tag, then an MPLS tag in OF1.3 mode, so we
+dnl can only see the MPLS tag in the result.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:47,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:47,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, the input packet is vlan-tagged; we update this tag then
+dnl push an MPLS tag in OF1.3 mode. As such, we can only see the MPLS tag in
+dnl the result.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:48,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
+mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:55:48,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
+dnl both of these in the final flow.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:49,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, the input packet in vlan-tagged, which should be stripped
+dnl before we push the MPLS and VLAN tags.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:50,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=0,dl_src=40:44:44:44:55:50,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
+dnl both of these in the final flow.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:51,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:51,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+dnl Modified MPLS controller action.
+dnl In this test, the input packet in vlan-tagged, which should be stripped
+dnl before we push the MPLS and VLAN tags.
+AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
+
+for i in 1 2 3; do
+ ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:55:52,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))'
+done
+OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
+ovs-appctl -t ovs-ofctl exit
+
+AT_CHECK([cat ofctl_monitor.log], [0], [dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:52,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:52,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+dnl
+NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
+mpls,metadata=0,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:55:52,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
+])
+
+AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
+AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:44 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:45 actions=mod_vlan_vid:99,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:46 actions=mod_vlan_vid:99,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:47 actions=load:0x63->OXM_OF_VLAN_VID[[]],push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:48 actions=load:0x63->OXM_OF_VLAN_VID[[]],push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:49 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],mod_vlan_vid:99,CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:50 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],mod_vlan_vid:99,CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:51 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],load:0x63->OXM_OF_VLAN_VID[[]],mod_vlan_pcp:1,CONTROLLER:65535
+ cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:55:52 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],load:0x3->OXM_OF_MPLS_TC[[]],load:0x63->OXM_OF_VLAN_VID[[]],mod_vlan_pcp:1,CONTROLLER:65535
+NXST_FLOW reply:
+])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
AT_SETUP([ofproto-dpif - fragment handling])
OVS_VSWITCHD_START
ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox