mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
ip6_gre: fix hardware header length for NBMA tunnels
ip6gre_tnl_link_config_route() accumulates the lower device's hardware
header length into dev->hard_header_len whenever header_ops is set. This
is incorrect for both users of header_ops.
ip6gretap and ip6erspan have a fixed Ethernet hardware header length.
For an NBMA ip6gre tunnel, ip6gre_header() creates only the GRE header,
the optional FOU or GUE header, and the outer IPv6 header. The lower
device header is headroom needed later, not part of the tunnel device's
hardware header.
Keep the lower device header in needed_headroom. Set hard_header_len to
the tunnel header length only for ARPHRD_IP6GRE devices with header_ops,
and leave the fixed Ethernet header length unchanged for tap and erspan
devices.
Fixes: 832ba59649 ("net: ip6_gre: set dev->hard_header_len when using header_ops")
Cc: stable@vger.kernel.org
Suggested-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/64b46542bbe1701f07702aaa50273e2a87903db5.1786542637.git.zhilinz@nebusec.ai
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
8acf691d80
commit
505b6d296c
|
|
@ -1137,13 +1137,8 @@ static void ip6gre_tnl_link_config_route(struct ip6_tnl *t, int set_mtu,
|
|||
return;
|
||||
|
||||
if (rt->dst.dev) {
|
||||
unsigned short dst_len = rt->dst.dev->hard_header_len +
|
||||
t_hlen;
|
||||
|
||||
if (t->dev->header_ops)
|
||||
dev->hard_header_len = dst_len;
|
||||
else
|
||||
dev->needed_headroom = dst_len;
|
||||
dev->needed_headroom = rt->dst.dev->hard_header_len +
|
||||
t_hlen;
|
||||
|
||||
if (set_mtu) {
|
||||
int mtu = rt->dst.dev->mtu - t_hlen;
|
||||
|
|
@ -1171,8 +1166,8 @@ static int ip6gre_calc_hlen(struct ip6_tnl *tunnel)
|
|||
|
||||
t_hlen = tunnel->hlen + sizeof(struct ipv6hdr);
|
||||
|
||||
if (tunnel->dev->header_ops)
|
||||
tunnel->dev->hard_header_len = LL_MAX_HEADER + t_hlen;
|
||||
if (tunnel->dev->header_ops && tunnel->dev->type == ARPHRD_IP6GRE)
|
||||
tunnel->dev->hard_header_len = t_hlen;
|
||||
else
|
||||
tunnel->dev->needed_headroom = LL_MAX_HEADER + t_hlen;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user