diff options
author | Jonathan Lemon <jlemon@FreeBSD.org> | 2001-06-23 17:44:27 +0000 |
---|---|---|
committer | Jonathan Lemon <jlemon@FreeBSD.org> | 2001-06-23 17:44:27 +0000 |
commit | f962cba5c374e3e3de5c0bdd875235cea9c94fe1 (patch) | |
tree | d85c0645874cf8863bf5a10150153d345d2f2288 | |
parent | f00f162a5fc3b2baa748308be22ddc1440b5e0bc (diff) | |
download | src-f962cba5c374e3e3de5c0bdd875235cea9c94fe1.tar.gz src-f962cba5c374e3e3de5c0bdd875235cea9c94fe1.zip |
Replace bzero() of struct ip with explicit zeroing of structure members,
which is faster.
Notes
Notes:
svn path=/head/; revision=78671
-rw-r--r-- | sys/netinet/tcp_subr.c | 8 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 331b6d5142b5..a706056a24a7 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -250,8 +250,13 @@ tcp_fillheaders(tp, ip_ptr, tcp_ptr) { struct ip *ip = (struct ip *) ip_ptr; - bzero(ip, sizeof(struct ip)); /* XXX overkill? */ ip->ip_vhl = IP_VHL_BORING; + ip->ip_tos = 0; + ip->ip_len = 0; + ip->ip_id = 0; + ip->ip_off = 0; + ip->ip_ttl = 0; + ip->ip_sum = 0; ip->ip_p = IPPROTO_TCP; ip->ip_src = inp->inp_laddr; ip->ip_dst = inp->inp_faddr; @@ -1372,7 +1377,6 @@ ipsec_hdrsiz_tcp(tp) th = (struct tcphdr *)(ip + 1); m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr); tcp_fillheaders(tp, ip, th); - ip->ip_vhl = IP_VHL_BORING; hdrsiz = ipsec4_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp); } diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 331b6d5142b5..a706056a24a7 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -250,8 +250,13 @@ tcp_fillheaders(tp, ip_ptr, tcp_ptr) { struct ip *ip = (struct ip *) ip_ptr; - bzero(ip, sizeof(struct ip)); /* XXX overkill? */ ip->ip_vhl = IP_VHL_BORING; + ip->ip_tos = 0; + ip->ip_len = 0; + ip->ip_id = 0; + ip->ip_off = 0; + ip->ip_ttl = 0; + ip->ip_sum = 0; ip->ip_p = IPPROTO_TCP; ip->ip_src = inp->inp_laddr; ip->ip_dst = inp->inp_faddr; @@ -1372,7 +1377,6 @@ ipsec_hdrsiz_tcp(tp) th = (struct tcphdr *)(ip + 1); m->m_pkthdr.len = m->m_len = sizeof(struct tcpiphdr); tcp_fillheaders(tp, ip, th); - ip->ip_vhl = IP_VHL_BORING; hdrsiz = ipsec4_hdrsiz(m, IPSEC_DIR_OUTBOUND, inp); } |