Skip to content

Commit f52f11e

Browse files
lxindavem330
authored andcommitted
lwtunnel: add options process for arp request
Without options copied to the dst tun_info in iptunnel_metadata_reply() called by arp_process for handling arp_request, the generated arp_reply packet may be dropped or sent out with wrong options for some tunnels like erspan and vxlan, and the traffic will break. Fixes: 63d008a ("ipv4: send arp replies to the correct tunnel") Signed-off-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 426071f commit f52f11e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/ipv4/ip_tunnel_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,14 @@ struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
126126

127127
if (!md || md->type != METADATA_IP_TUNNEL ||
128128
md->u.tun_info.mode & IP_TUNNEL_INFO_TX)
129-
130129
return NULL;
131130

132-
res = metadata_dst_alloc(0, METADATA_IP_TUNNEL, flags);
131+
src = &md->u.tun_info;
132+
res = metadata_dst_alloc(src->options_len, METADATA_IP_TUNNEL, flags);
133133
if (!res)
134134
return NULL;
135135

136136
dst = &res->u.tun_info;
137-
src = &md->u.tun_info;
138137
dst->key.tun_id = src->key.tun_id;
139138
if (src->mode & IP_TUNNEL_INFO_IPV6)
140139
memcpy(&dst->key.u.ipv6.dst, &src->key.u.ipv6.src,
@@ -143,6 +142,8 @@ struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
143142
dst->key.u.ipv4.dst = src->key.u.ipv4.src;
144143
dst->key.tun_flags = src->key.tun_flags;
145144
dst->mode = src->mode | IP_TUNNEL_INFO_TX;
145+
ip_tunnel_info_opts_set(dst, ip_tunnel_info_opts(src),
146+
src->options_len, 0);
146147

147148
return res;
148149
}

0 commit comments

Comments
 (0)