Page MenuHomeFreeBSD

D57534.diff
No OneTemporary

D57534.diff

diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -465,25 +465,18 @@
bzero(&laddr6, sizeof(laddr6));
laddr6.sin6_family = AF_INET6;
- /*
- * Call inner routine, to assign local interface address.
- * in6_pcbladdr() may automatically fill in sin6_scope_id.
- */
INP_HASH_WLOCK(pcbinfo);
- if ((error = in6_pcbladdr(inp, sin6, &laddr6.sin6_addr,
- sas_required)) != 0) {
- INP_HASH_WUNLOCK(pcbinfo);
- return (error);
- }
-
- if (in6_pcblookup_internal(pcbinfo, &sin6->sin6_addr, sin6->sin6_port,
- IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) ?
- &laddr6.sin6_addr : &inp->in6p_laddr, inp->inp_lport, 0,
- M_NODOM, RT_ALL_FIBS) != NULL) {
- INP_HASH_WUNLOCK(pcbinfo);
- return (EADDRINUSE);
- }
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) {
+ /*
+ * Call inner routine, to assign local interface address.
+ * in6_pcbladdr() may automatically fill in sin6_scope_id.
+ */
+ error = in6_pcbladdr(inp, sin6, &laddr6.sin6_addr,
+ sas_required);
+ if (__predict_false(error)) {
+ INP_HASH_WUNLOCK(pcbinfo);
+ return (error);
+ }
if (inp->inp_lport == 0) {
error = in_pcb_lport_dest(inp,
(struct sockaddr *) &laddr6, &inp->inp_lport,
@@ -495,7 +488,14 @@
}
}
inp->in6p_laddr = laddr6.sin6_addr;
+ } else if (in6_pcblookup_internal(pcbinfo, &sin6->sin6_addr,
+ sin6->sin6_port, &inp->in6p_laddr, inp->inp_lport, 0,
+ M_NODOM, RT_ALL_FIBS) != NULL) {
+ INP_HASH_WUNLOCK(pcbinfo);
+ return (EADDRINUSE);
}
+ MPASS(inp->inp_lport != 0);
+ MPASS(!IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr));
inp->in6p_faddr = sin6->sin6_addr;
inp->inp_fport = sin6->sin6_port;
/* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */

File Metadata

Mime Type
text/plain
Expires
Sat, Jun 13, 2:27 PM (1 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33887470
Default Alt Text
D57534.diff (1 KB)

Event Timeline