Date: Mon, 17 Feb 2025 23:31:03 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 24e5c2ee2a18 - main - inpcb: update inpcb multipath routing information only on success Message-ID: <202502172331.51HNV30h067170@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=24e5c2ee2a185bb0e6e69c0e55341eed5d23c141 commit 24e5c2ee2a185bb0e6e69c0e55341eed5d23c141 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2025-02-17 23:28:52 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2025-02-17 23:28:52 +0000 inpcb: update inpcb multipath routing information only on success The in_pcbconnect_setup() function is not supposed to modify inpcb. It may be entered with read-only lock via UDP path. Also at this point we aren't yet sure that the binding is going to be successful. Thus, update the multipath routing information only at the end of a succesful in_pcbconnect(). Fixes: 0c325f53f16731f608919a4489f96fbbe28d2344 --- sys/netinet/in_pcb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 18f92cdffc53..c34b4594c9b9 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1121,7 +1121,18 @@ in_pcbconnect(struct inpcb *inp, struct sockaddr_in *sin, struct ucred *cred) else in_pcbinshash(inp); } +#ifdef ROUTE_MPATH + if (CALC_FLOWID_OUTBOUND) { + uint32_t hash_val, hash_type; + + hash_val = fib4_calc_software_hash(inp->inp_laddr, + inp->inp_faddr, 0, fport, + inp->inp_socket->so_proto->pr_protocol, &hash_type); + inp->inp_flowid = hash_val; + inp->inp_flowtype = hash_type; + } +#endif if (anonport) inp->inp_flags |= INP_ANONPORT; return (0); @@ -1377,17 +1388,6 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr_in *sin, lport = *lportp; faddr = sin->sin_addr; fport = sin->sin_port; -#ifdef ROUTE_MPATH - if (CALC_FLOWID_OUTBOUND) { - uint32_t hash_val, hash_type; - - hash_val = fib4_calc_software_hash(laddr, faddr, 0, fport, - inp->inp_socket->so_proto->pr_protocol, &hash_type); - - inp->inp_flowid = hash_val; - inp->inp_flowtype = hash_type; - } -#endif if (V_connect_inaddr_wild && !CK_STAILQ_EMPTY(&V_in_ifaddrhead)) { /* * If the destination address is INADDR_ANY,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502172331.51HNV30h067170>