Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159299378
D57534.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57534.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D57534: netinet6: refactor in6_pcbconnect()
Attached
Detach File
Event Timeline
Log In to Comment