diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-06-23 17:44:27 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-06-23 17:44:27 +0000 |
commit | e071c166698f73e43ecf7c106b3899c0ea99e559 (patch) | |
tree | d85c0645874cf8863bf5a10150153d345d2f2288 /sys | |
parent | f4d67f070515aea9b806739c31a68a83a74664a3 (diff) | |
download | FreeBSD-src-e071c166698f73e43ecf7c106b3899c0ea99e559.zip FreeBSD-src-e071c166698f73e43ecf7c106b3899c0ea99e559.tar.gz |
Replace bzero() of struct ip with explicit zeroing of structure members,
which is faster.
Diffstat (limited to 'sys')
-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 331b6d5..a706056 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 331b6d5..a706056 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); } |