summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2006-11-30 10:54:54 +0000
committerrwatson <rwatson@FreeBSD.org>2006-11-30 10:54:54 +0000
commit12d8083335fc9e137442e485b0e9d38a72a70f80 (patch)
tree29db2fe187f3e4812af6dff233f408ad3c4187dc /sys/netinet/in_pcb.c
parent29a6b4a0eb224e61fc5685128b8e502266e86652 (diff)
downloadFreeBSD-src-12d8083335fc9e137442e485b0e9d38a72a70f80.zip
FreeBSD-src-12d8083335fc9e137442e485b0e9d38a72a70f80.tar.gz
Consistently use #ifdef INET6 rather than mixing and matching with
#if defined(INET6). Don't comment the end of short #ifdef blocks. Comment cleanup. Line wrap.
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 9028712..8817ad8 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -202,7 +202,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo)
if (error != 0)
goto out;
#endif /*IPSEC*/
-#if defined(INET6)
+#ifdef INET6
if (INP_SOCKAF(so) == AF_INET6) {
inp->inp_vflag |= INP_IPV6PROTO;
if (ip6_v6only)
@@ -375,14 +375,14 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
return (EADDRINUSE);
} else if (t &&
(reuseport & t->inp_socket->so_options) == 0) {
-#if defined(INET6)
+#ifdef INET6
if (ntohl(sin->sin_addr.s_addr) !=
INADDR_ANY ||
ntohl(t->inp_laddr.s_addr) !=
INADDR_ANY ||
INP_SOCKAF(so) ==
INP_SOCKAF(t->inp_socket))
-#endif /* defined(INET6) */
+#endif
return (EADDRINUSE);
}
}
@@ -1027,7 +1027,8 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
/*
* First look for an exact match.
*/
- head = &pcbinfo->hashbase[INP_PCBHASH(faddr.s_addr, lport, fport, pcbinfo->hashmask)];
+ head = &pcbinfo->hashbase[INP_PCBHASH(faddr.s_addr, lport, fport,
+ pcbinfo->hashmask)];
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
@@ -1036,20 +1037,21 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
if (inp->inp_faddr.s_addr == faddr.s_addr &&
inp->inp_laddr.s_addr == laddr.s_addr &&
inp->inp_fport == fport &&
- inp->inp_lport == lport) {
- /*
- * Found.
- */
+ inp->inp_lport == lport)
return (inp);
- }
}
+
+ /*
+ * Then look for a wildcard match, if requested.
+ */
if (wildcard) {
struct inpcb *local_wild = NULL;
-#if defined(INET6)
+#ifdef INET6
struct inpcb *local_wild_mapped = NULL;
-#endif /* defined(INET6) */
+#endif
- head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0, pcbinfo->hashmask)];
+ head = &pcbinfo->hashbase[INP_PCBHASH(INADDR_ANY, lport, 0,
+ pcbinfo->hashmask)];
LIST_FOREACH(inp, head, inp_hash) {
#ifdef INET6
if ((inp->inp_vflag & INP_IPV4) == 0)
@@ -1063,26 +1065,22 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in_addr faddr,
if (inp->inp_laddr.s_addr == laddr.s_addr)
return (inp);
else if (inp->inp_laddr.s_addr == INADDR_ANY) {
-#if defined(INET6)
+#ifdef INET6
if (INP_CHECK_SOCKAF(inp->inp_socket,
AF_INET6))
local_wild_mapped = inp;
else
-#endif /* defined(INET6) */
- local_wild = inp;
+#endif
+ local_wild = inp;
}
}
}
-#if defined(INET6)
+#ifdef INET6
if (local_wild == NULL)
return (local_wild_mapped);
-#endif /* defined(INET6) */
+#endif
return (local_wild);
}
-
- /*
- * Not found.
- */
return (NULL);
}
OpenPOWER on IntegriCloud