mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
Replace bzero() of struct ip with explicit zeroing of structure members,
which is faster.
This commit is contained in:
parent
f00f162a5f
commit
f962cba5c3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78671
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user