History

net: Handle l3mdev in ip_tunnel_init_flow

Ido reported that the commit referenced in the Fixes tag broke a gre use case with dummy devices. Add a check to ip_tunnel_init_flow to see if the oif is an l3mdev port and if so set the oif to 0 to avoid the oif comparison in fib_lookup_good_nhc.

David Ahern committed 4 years ago

Commit db53cd31 parent 83daab04 files · +17 −9Browse files

Showing the changes to include (1 of 4 files). Show all

Unified · Split

include/net/ip_tunnels.h+9−2
@@ -243,11 +243,18 @@ static inline __be32 tunnel_id_to_key32(__be64 tun_id) · 242 unmodified lines
243243 static inline void ip_tunnel_init_flow(struct flowi4 *fl4,
244244 int proto,
245245 __be32 daddr, __be32 saddr,
246− __be32 key, __u8 tos, int oif,
246+ __be32 key, __u8 tos,
247+ struct net *net, int oif,
247248 __u32 mark, __u32 tun_inner_hash)
248249 {
249250 memset(fl4, 0, sizeof(*fl4));
250− fl4->flowi4_oif = oif;
251+
252+ if (oif) {
253+ fl4->flowi4_l3mdev = l3mdev_master_upper_ifindex_by_index_rcu(net, oif);
254+ /* Legacy VRF/l3mdev use case */
255+ fl4->flowi4_oif = fl4->flowi4_l3mdev ? 0 : oif;
256+ }
257+
251258 fl4->daddr = daddr;
252259 fl4->saddr = saddr;
253260 fl4->flowi4_tos = tos;