summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2008-12-17 12:52:34 +0000
committerbz <bz@FreeBSD.org>2008-12-17 12:52:34 +0000
commitea0d9d2e9af995a203d1871d5aded293a98f5d68 (patch)
tree062997817526e8ebb92f0a727bd3ebf774556ea8 /sys/netinet/tcp_subr.c
parentbaed8aaae54e47b5ef994a307febc994595b0e50 (diff)
downloadFreeBSD-src-ea0d9d2e9af995a203d1871d5aded293a98f5d68.zip
FreeBSD-src-ea0d9d2e9af995a203d1871d5aded293a98f5d68.tar.gz
Use inc_flags instead of the inc_isipv6 alias which so far
had been the only flag with random usage patterns. Switch inc_flags to be used as a real bit field by using INC_ISIPV6 with bitops to check for the 'isipv6' condition. While here fix a place or two where in case of v4 inc_flags were not properly initialized before.[1] Found by: rwatson during review [1] Discussed with: rwatson Reviewed by: rwatson MFC after: 4 weeks
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 2c22132..9cb941a 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1306,7 +1306,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
* value (if given) and then notify.
*/
bzero(&inc, sizeof(inc));
- inc.inc_flags = 0; /* IPv4 */
inc.inc_faddr = faddr;
inc.inc_fibnum =
inp->inp_inc.inc_fibnum;
@@ -1343,13 +1342,11 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
if (inp != NULL)
INP_WUNLOCK(inp);
} else {
+ bzero(&inc, sizeof(inc));
inc.inc_fport = th->th_dport;
inc.inc_lport = th->th_sport;
inc.inc_faddr = faddr;
inc.inc_laddr = ip->ip_src;
-#ifdef INET6
- inc.inc_isipv6 = 0;
-#endif
syncache_unreach(&inc, th);
}
INP_INFO_WUNLOCK(&V_tcbinfo);
@@ -1419,11 +1416,12 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
(struct sockaddr *)ip6cp->ip6c_src,
th.th_sport, cmd, NULL, notify);
+ bzero(&inc, sizeof(inc));
inc.inc_fport = th.th_dport;
inc.inc_lport = th.th_sport;
inc.inc6_faddr = ((struct sockaddr_in6 *)sa)->sin6_addr;
inc.inc6_laddr = ip6cp->ip6c_src->sin6_addr;
- inc.inc_isipv6 = 1;
+ inc.inc_flags |= INC_ISIPV6;
INP_INFO_WLOCK(&V_tcbinfo);
syncache_unreach(&inc, &th);
INP_INFO_WUNLOCK(&V_tcbinfo);
@@ -2263,7 +2261,7 @@ tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
strcat(s, "TCP: [");
sp = s + strlen(s);
- if (inc && inc->inc_isipv6 == 0) {
+ if (inc && ((inc->inc_flags & INC_ISIPV6) == 0)) {
inet_ntoa_r(inc->inc_faddr, sp);
sp = s + strlen(s);
sprintf(sp, "]:%i to [", ntohs(inc->inc_fport));
OpenPOWER on IntegriCloud