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.

ipv4: Drop tos parameter from flowi4_update_output()

Callers of flowi4_update_output() never try to update ->flowi4_tos:

* ip_route_connect() updates ->flowi4_tos with its own current
value.

* ip_route_newports() has two users: tcp_v4_connect() and
dccp_v4_connect. Both initialise fl4 with ip_route_connect(), which
in turn sets ->flowi4_tos with RT_TOS(inet_sk(sk)->tos) and
->flowi4_scope based on SOCK_LOCALROUTE.

Then ip_route_newports() updates ->flowi4_tos with
RT_CONN_FLAGS(sk), which is the same as RT_TOS(inet_sk(sk)->tos),
unless SOCK_LOCALROUTE is set on the socket. In that case, the
lowest order bit is set to 1, to eventually inform
ip_route_output_key_hash() to restrict the scope to RT_SCOPE_LINK.
This is equivalent to properly setting ->flowi4_scope as
ip_route_connect() did.

* ip_vs_xmit.c initialises ->flowi4_tos with memset(0), then calls
flowi4_update_output() with tos=0.

* sctp_v4_get_dst() uses the same RT_CONN_FLAGS_TOS() when
initialising ->flowi4_tos and when calling flowi4_update_output().

In the end, ->flowi4_tos never changes. So let's just drop the tos
parameter. This will simplify the conversion of ->flowi4_tos from __u8
to dscp_t.

Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Guillaume Nault and committed by
David S. Miller
3f06760c 0f0f5868

+6 -11
+1 -2
include/net/flow.h
··· 116 116 } 117 117 118 118 /* Reset some input parameters after previous lookup */ 119 - static inline void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos, 119 + static inline void flowi4_update_output(struct flowi4 *fl4, int oif, 120 120 __be32 daddr, __be32 saddr) 121 121 { 122 122 fl4->flowi4_oif = oif; 123 - fl4->flowi4_tos = tos; 124 123 fl4->daddr = daddr; 125 124 fl4->saddr = saddr; 126 125 }
+2 -4
include/net/route.h
··· 321 321 if (IS_ERR(rt)) 322 322 return rt; 323 323 ip_rt_put(rt); 324 - flowi4_update_output(fl4, oif, fl4->flowi4_tos, fl4->daddr, 325 - fl4->saddr); 324 + flowi4_update_output(fl4, oif, fl4->daddr, fl4->saddr); 326 325 } 327 326 security_sk_classify_flow(sk, flowi4_to_flowi_common(fl4)); 328 327 return ip_route_output_flow(net, fl4, sk); ··· 336 337 fl4->fl4_dport = dport; 337 338 fl4->fl4_sport = sport; 338 339 ip_rt_put(rt); 339 - flowi4_update_output(fl4, sk->sk_bound_dev_if, 340 - RT_CONN_FLAGS(sk), fl4->daddr, 340 + flowi4_update_output(fl4, sk->sk_bound_dev_if, fl4->daddr, 341 341 fl4->saddr); 342 342 security_sk_classify_flow(sk, flowi4_to_flowi_common(fl4)); 343 343 return ip_route_output_flow(sock_net(sk), fl4, sk);
+2 -2
net/netfilter/ipvs/ip_vs_xmit.c
··· 139 139 if (PTR_ERR(rt) == -EINVAL && *saddr && 140 140 rt_mode & IP_VS_RT_MODE_CONNECT && !loop) { 141 141 *saddr = 0; 142 - flowi4_update_output(&fl4, 0, 0, daddr, 0); 142 + flowi4_update_output(&fl4, 0, daddr, 0); 143 143 goto retry; 144 144 } 145 145 IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n", &daddr); ··· 147 147 } else if (!*saddr && rt_mode & IP_VS_RT_MODE_CONNECT && fl4.saddr) { 148 148 ip_rt_put(rt); 149 149 *saddr = fl4.saddr; 150 - flowi4_update_output(&fl4, 0, 0, daddr, fl4.saddr); 150 + flowi4_update_output(&fl4, 0, daddr, fl4.saddr); 151 151 loop = true; 152 152 goto retry; 153 153 }
+1 -3
net/sctp/protocol.c
··· 500 500 continue; 501 501 502 502 fl4->fl4_sport = laddr->a.v4.sin_port; 503 - flowi4_update_output(fl4, 504 - asoc->base.sk->sk_bound_dev_if, 505 - RT_CONN_FLAGS_TOS(asoc->base.sk, tos), 503 + flowi4_update_output(fl4, asoc->base.sk->sk_bound_dev_if, 506 504 daddr->v4.sin_addr.s_addr, 507 505 laddr->a.v4.sin_addr.s_addr); 508 506