aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2026-07-15 18:46:05 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2026-07-15 19:07:48 +0000
commitca4eb3f3989b64dc371c2f114eecae28b25a6481 (patch)
tree0fb7b224f1351413113dccba814794bb3ab27dd3
parenta48a27532567b3ec2178110994f5cea245a54ac2 (diff)
inpcb: do not set INP_ANONPORT until successful operation
-rw-r--r--sys/netinet6/in6_pcb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 1b55a3425e59..b5859777eee9 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -132,8 +132,6 @@ in6_pcbsetport_locked(struct in6_addr *laddr, struct inpcb *inp,
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT|SO_REUSEPORT_LB)) == 0)
lookupflags = INPLOOKUP_WILDCARD;
- inp->inp_flags |= INP_ANONPORT;
-
error = in_pcb_lport(inp, NULL, &lport, cred, lookupflags);
if (error != 0)
return (error);
@@ -145,6 +143,8 @@ in6_pcbsetport_locked(struct in6_addr *laddr, struct inpcb *inp,
return (EAGAIN);
}
+ inp->inp_flags |= INP_ANONPORT;
+
return (0);
}