Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gre: Drop ip_route_output_gre().

We already have enough variants of ip_route_output*() functions. We
don't need a GRE specific one in the generic route.h header file.

Furthermore, ip_route_output_gre() is only used once, in ipgre_open(),
where it can be easily replaced by a simple call to
ip_route_output_key().

While there, and for clarity, explicitly set .flowi4_scope to
RT_SCOPE_UNIVERSE instead of relying on the implicit zero
initialisation.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/ab7cba47b8558cd4bfe2dc843c38b622a95ee48e.1734527729.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Guillaume Nault and committed by
Jakub Kicinski
29b54079 5155cbcd

+10 -21
-14
include/net/route.h
··· 185 185 return ip_route_output_flow(net, fl4, sk); 186 186 } 187 187 188 - static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4 *fl4, 189 - __be32 daddr, __be32 saddr, 190 - __be32 gre_key, __u8 tos, int oif) 191 - { 192 - memset(fl4, 0, sizeof(*fl4)); 193 - fl4->flowi4_oif = oif; 194 - fl4->daddr = daddr; 195 - fl4->saddr = saddr; 196 - fl4->flowi4_tos = tos; 197 - fl4->flowi4_proto = IPPROTO_GRE; 198 - fl4->fl4_gre_key = gre_key; 199 - return ip_route_output_key(net, fl4); 200 - } 201 - 202 188 enum skb_drop_reason 203 189 ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, 204 190 dscp_t dscp, struct net_device *dev,
+10 -7
net/ipv4/ip_gre.c
··· 924 924 struct ip_tunnel *t = netdev_priv(dev); 925 925 926 926 if (ipv4_is_multicast(t->parms.iph.daddr)) { 927 - struct flowi4 fl4; 927 + struct flowi4 fl4 = { 928 + .flowi4_oif = t->parms.link, 929 + .flowi4_tos = t->parms.iph.tos & INET_DSCP_MASK, 930 + .flowi4_scope = RT_SCOPE_UNIVERSE, 931 + .flowi4_proto = IPPROTO_GRE, 932 + .saddr = t->parms.iph.saddr, 933 + .daddr = t->parms.iph.daddr, 934 + .fl4_gre_key = t->parms.o_key, 935 + }; 928 936 struct rtable *rt; 929 937 930 - rt = ip_route_output_gre(t->net, &fl4, 931 - t->parms.iph.daddr, 932 - t->parms.iph.saddr, 933 - t->parms.o_key, 934 - t->parms.iph.tos & INET_DSCP_MASK, 935 - t->parms.link); 938 + rt = ip_route_output_key(t->net, &fl4); 936 939 if (IS_ERR(rt)) 937 940 return -EADDRNOTAVAIL; 938 941 dev = rt->dst.dev;