git: d62e8c5c6fdc - main - inpcb: update inpcb multipath routing information only on success
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 May 2026 05:05:36 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=d62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51
commit d62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-05-26 16:02:06 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-05-28 04:46:38 +0000
inpcb: update inpcb multipath routing information only on success
This is very similar to IPv4 change 24e5c2ee2a18. Don't modify inpcb
until we are sure connect(2) will be successful.
Fixes: 0c325f53f16731f608919a4489f96fbbe28d2344
---
sys/netinet6/in6_pcb.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 8132899bb0d9..0cf6be2f9b33 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -465,15 +465,6 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred,
bzero(&laddr6, sizeof(laddr6));
laddr6.sin6_family = AF_INET6;
- if (V_fib_hash_outbound) {
- uint32_t hash_type, hash_val;
-
- hash_val = fib6_calc_software_hash(&inp->in6p_laddr,
- &sin6->sin6_addr, 0, sin6->sin6_port,
- inp->inp_socket->so_proto->pr_protocol, &hash_type);
- inp->inp_flowid = hash_val;
- inp->inp_flowtype = hash_type;
- }
/*
* Call inner routine, to assign local interface address.
* in6_pcbladdr() may automatically fill in sin6_scope_id.
@@ -520,6 +511,16 @@ in6_pcbconnect(struct inpcb *inp, struct sockaddr_in6 *sin6, struct ucred *cred,
in_pcbrehash(inp);
INP_HASH_WUNLOCK(pcbinfo);
+ if (V_fib_hash_outbound) {
+ uint32_t hash_type, hash_val;
+
+ hash_val = fib6_calc_software_hash(&inp->in6p_laddr,
+ &sin6->sin6_addr, 0, sin6->sin6_port,
+ inp->inp_socket->so_proto->pr_protocol, &hash_type);
+ inp->inp_flowid = hash_val;
+ inp->inp_flowtype = hash_type;
+ }
+
return (0);
}