aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-05-26 16:02:06 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-05-28 04:46:38 +0000
commitd62e8c5c6fdc9e3b006bf126e1fb863e8bdd6c51 (patch)
tree3de314513b86ab8f60ee352a02151e6253b23a29
parentca91300c074923cecfe197de16a3318b06876134 (diff)
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
-rw-r--r--sys/netinet6/in6_pcb.c19
1 files 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);
}