Mon Apr 25 22:12:43 2011 UTC ()
tcp_input: simplify redundant assignment.  no functional changes.


(yamt)
diff -r1.310 -r1.311 src/sys/netinet/tcp_input.c

cvs diff -r1.310 -r1.311 src/sys/netinet/tcp_input.c (expand / switch to unified diff)

--- src/sys/netinet/tcp_input.c 2011/04/20 14:08:07 1.310
+++ src/sys/netinet/tcp_input.c 2011/04/25 22:12:43 1.311
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tcp_input.c,v 1.310 2011/04/20 14:08:07 wiz Exp $ */ 1/* $NetBSD: tcp_input.c,v 1.311 2011/04/25 22:12:43 yamt Exp $ */
2 2
3/* 3/*
4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 4 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -135,27 +135,27 @@ @@ -135,27 +135,27 @@
135 */ 135 */
136 136
137/* 137/*
138 * TODO list for SYN cache stuff: 138 * TODO list for SYN cache stuff:
139 * 139 *
140 * Find room for a "state" field, which is needed to keep a 140 * Find room for a "state" field, which is needed to keep a
141 * compressed state for TIME_WAIT TCBs. It's been noted already 141 * compressed state for TIME_WAIT TCBs. It's been noted already
142 * that this is fairly important for very high-volume web and 142 * that this is fairly important for very high-volume web and
143 * mail servers, which use a large number of short-lived 143 * mail servers, which use a large number of short-lived
144 * connections. 144 * connections.
145 */ 145 */
146 146
147#include <sys/cdefs.h> 147#include <sys/cdefs.h>
148__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.310 2011/04/20 14:08:07 wiz Exp $"); 148__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.311 2011/04/25 22:12:43 yamt Exp $");
149 149
150#include "opt_inet.h" 150#include "opt_inet.h"
151#include "opt_ipsec.h" 151#include "opt_ipsec.h"
152#include "opt_inet_csum.h" 152#include "opt_inet_csum.h"
153#include "opt_tcp_debug.h" 153#include "opt_tcp_debug.h"
154 154
155#include <sys/param.h> 155#include <sys/param.h>
156#include <sys/systm.h> 156#include <sys/systm.h>
157#include <sys/malloc.h> 157#include <sys/malloc.h>
158#include <sys/mbuf.h> 158#include <sys/mbuf.h>
159#include <sys/protosw.h> 159#include <sys/protosw.h>
160#include <sys/socket.h> 160#include <sys/socket.h>
161#include <sys/socketvar.h> 161#include <sys/socketvar.h>
@@ -996,27 +996,28 @@ tcp_input(struct mbuf *m, ...) @@ -996,27 +996,28 @@ tcp_input(struct mbuf *m, ...)
996 struct tcphdr *th; 996 struct tcphdr *th;
997 struct ip *ip; 997 struct ip *ip;
998 struct inpcb *inp; 998 struct inpcb *inp;
999#ifdef INET6 999#ifdef INET6
1000 struct ip6_hdr *ip6; 1000 struct ip6_hdr *ip6;
1001 struct in6pcb *in6p; 1001 struct in6pcb *in6p;
1002#endif 1002#endif
1003 u_int8_t *optp = NULL; 1003 u_int8_t *optp = NULL;
1004 int optlen = 0; 1004 int optlen = 0;
1005 int len, tlen, toff, hdroptlen = 0; 1005 int len, tlen, toff, hdroptlen = 0;
1006 struct tcpcb *tp = 0; 1006 struct tcpcb *tp = 0;
1007 int tiflags; 1007 int tiflags;
1008 struct socket *so = NULL; 1008 struct socket *so = NULL;
1009 int todrop, dupseg, acked, ourfinisacked, needoutput = 0; 1009 int todrop, acked, ourfinisacked, needoutput = 0;
 1010 bool dupseg;
1010#ifdef TCP_DEBUG 1011#ifdef TCP_DEBUG
1011 short ostate = 0; 1012 short ostate = 0;
1012#endif 1013#endif
1013 u_long tiwin; 1014 u_long tiwin;
1014 struct tcp_opt_info opti; 1015 struct tcp_opt_info opti;
1015 int off, iphlen; 1016 int off, iphlen;
1016 va_list ap; 1017 va_list ap;
1017 int af; /* af on the wire */ 1018 int af; /* af on the wire */
1018 struct mbuf *tcp_saveti = NULL; 1019 struct mbuf *tcp_saveti = NULL;
1019 uint32_t ts_rtt; 1020 uint32_t ts_rtt;
1020 uint8_t iptos; 1021 uint8_t iptos;
1021 uint64_t *tcps; 1022 uint64_t *tcps;
1022 1023
@@ -1047,35 +1048,34 @@ tcp_input(struct mbuf *m, ...) @@ -1047,35 +1048,34 @@ tcp_input(struct mbuf *m, ...)
1047 } 1048 }
1048#ifdef INET6 1049#ifdef INET6
1049 if (m->m_flags & M_ANYCAST6) { 1050 if (m->m_flags & M_ANYCAST6) {
1050 /* XXX stat */ 1051 /* XXX stat */
1051 goto drop; 1052 goto drop;
1052 } 1053 }
1053#endif 1054#endif
1054 1055
1055 /* 1056 /*
1056 * Get IP and TCP header. 1057 * Get IP and TCP header.
1057 * Note: IP leaves IP header in first mbuf. 1058 * Note: IP leaves IP header in first mbuf.
1058 */ 1059 */
1059 ip = mtod(m, struct ip *); 1060 ip = mtod(m, struct ip *);
1060#ifdef INET6 
1061 ip6 = NULL; 
1062#endif 
1063 switch (ip->ip_v) { 1061 switch (ip->ip_v) {
1064#ifdef INET 1062#ifdef INET
1065 case 4: 1063 case 4:
 1064#ifdef INET6
 1065 ip6 = NULL;
 1066#endif
1066 af = AF_INET; 1067 af = AF_INET;
1067 iphlen = sizeof(struct ip); 1068 iphlen = sizeof(struct ip);
1068 ip = mtod(m, struct ip *); 
1069 IP6_EXTHDR_GET(th, struct tcphdr *, m, toff, 1069 IP6_EXTHDR_GET(th, struct tcphdr *, m, toff,
1070 sizeof(struct tcphdr)); 1070 sizeof(struct tcphdr));
1071 if (th == NULL) { 1071 if (th == NULL) {
1072 TCP_STATINC(TCP_STAT_RCVSHORT); 1072 TCP_STATINC(TCP_STAT_RCVSHORT);
1073 return; 1073 return;
1074 } 1074 }
1075 /* We do the checksum after PCB lookup... */ 1075 /* We do the checksum after PCB lookup... */
1076 len = ntohs(ip->ip_len); 1076 len = ntohs(ip->ip_len);
1077 tlen = len - toff; 1077 tlen = len - toff;
1078 iptos = ip->ip_tos; 1078 iptos = ip->ip_tos;
1079 break; 1079 break;
1080#endif 1080#endif
1081#ifdef INET6 1081#ifdef INET6