Subject: Re: [PATCH net-next v1 resend 1/2] net: Update bhash2 when socket's rcv saddr changes

From: Jakub Kicinski <[email-masked]>
Date: Wed, 1 Jun 2022 18:13:04 -0700

On Wed, 1 Jun 2022 13:14:33 -0700 Joanne Koong wrote:
> From: Joanne Koong <[email-masked]>
> 
> Commit d5a42de8bdbe ("net: Add a second bind table hashed by port and
> address") added a second bind table, bhash2, that hashes by a socket's port
> and rcv address.
> 
> However, there are two cases where the socket's rcv saddr can change
> after it has been binded:
> 
> 1) The case where there is a bind() call on "::" (IPADDR_ANY) and then
> a connect() call. The kernel will assign the socket an address when it
> handles the connect()
> 
> 2) In inet_sk_reselect_saddr(), which is called when rerouting fails
> when rebuilding the sk header (invoked by inet_sk_rebuild_header)
> 
> In these two cases, we need to update the bhash2 table by removing the
> entry for the old address, and adding a new entry reflecting the updated
> address.
> 
> Reported-by: [email-masked]
> Fixes: d5a42de8bdbe ("net: Add a second bind table hashed by port and address")
> Signed-off-by: Joanne Koong <[email-masked]>
> Reviewed-by: Eric Dumazet <[email-masked]>

This one needs to be static:

net/ipv4/inet_hashtables.c:830:5: warning: no previous prototype for ‘__inet_bhash2_update_saddr’ [-Wmissing-prototypes]
  830 | int __inet_bhash2_update_saddr(struct sock *sk, struct inet_hashinfo *hinfo,