* [PATCH net-next] lwtunnel: get nlsize for erspan options properly
@ 2019-11-10 4:21 Xin Long
2019-11-11 12:40 ` Simon Horman
2019-11-11 22:44 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Xin Long @ 2019-11-10 4:21 UTC (permalink / raw)
To: network dev; +Cc: davem, David Ahern
erspan v1 has OPT_ERSPAN_INDEX while erspan v2 has OPT_ERSPAN_DIR and
OPT_ERSPAN_HWID attributes, and they require different nlsize when
dumping.
So this patch is to get nlsize for erspan options properly according
to erspan version.
Fixes: b0a21810bd5e ("lwtunnel: add options setting and dumping for erspan")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv4/ip_tunnel_core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index ee71e76..e444cd1 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -613,9 +613,15 @@ static int ip_tun_opts_nlsize(struct ip_tunnel_info *info)
opt_len += nla_total_size(0) /* LWTUNNEL_IP_OPTS_VXLAN */
+ nla_total_size(4); /* OPT_VXLAN_GBP */
} else if (info->key.tun_flags & TUNNEL_ERSPAN_OPT) {
+ struct erspan_metadata *md = ip_tunnel_info_opts(info);
+
opt_len += nla_total_size(0) /* LWTUNNEL_IP_OPTS_ERSPAN */
+ nla_total_size(1) /* OPT_ERSPAN_VER */
- + nla_total_size(4); /* OPT_ERSPAN_INDEX/DIR/HWID */
+ + (md->version == 1 ? nla_total_size(4)
+ /* OPT_ERSPAN_INDEX (v1) */
+ : nla_total_size(1) +
+ nla_total_size(1));
+ /* OPT_ERSPAN_DIR + HWID (v2) */
}
return opt_len;
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] lwtunnel: get nlsize for erspan options properly
2019-11-10 4:21 [PATCH net-next] lwtunnel: get nlsize for erspan options properly Xin Long
@ 2019-11-11 12:40 ` Simon Horman
2019-11-11 22:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2019-11-11 12:40 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, davem, David Ahern
On Sun, Nov 10, 2019 at 12:21:18PM +0800, Xin Long wrote:
> erspan v1 has OPT_ERSPAN_INDEX while erspan v2 has OPT_ERSPAN_DIR and
> OPT_ERSPAN_HWID attributes, and they require different nlsize when
> dumping.
>
> So this patch is to get nlsize for erspan options properly according
> to erspan version.
>
> Fixes: b0a21810bd5e ("lwtunnel: add options setting and dumping for erspan")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] lwtunnel: get nlsize for erspan options properly
2019-11-10 4:21 [PATCH net-next] lwtunnel: get nlsize for erspan options properly Xin Long
2019-11-11 12:40 ` Simon Horman
@ 2019-11-11 22:44 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-11 22:44 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, dsahern
From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 10 Nov 2019 12:21:18 +0800
> erspan v1 has OPT_ERSPAN_INDEX while erspan v2 has OPT_ERSPAN_DIR and
> OPT_ERSPAN_HWID attributes, and they require different nlsize when
> dumping.
>
> So this patch is to get nlsize for erspan options properly according
> to erspan version.
>
> Fixes: b0a21810bd5e ("lwtunnel: add options setting and dumping for erspan")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-12 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 4:21 [PATCH net-next] lwtunnel: get nlsize for erspan options properly Xin Long
2019-11-11 12:40 ` Simon Horman
2019-11-11 22:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).