diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-23 05:36:09 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-06-23 05:36:09 +0000 |
commit | 6272e736471bec5a541944eb9a5658a0f86df5dd (patch) | |
tree | 7d7d0b33211a8ebe0fd137166c9c8b29640fcf2a /sys/netinet/udp_usrreq.c | |
parent | 6ef71fcb530fc9a775f3285bf915f49ee2794d45 (diff) |
TCP/UDP hardware checksumming. Untested, since txp dies when it tries
to compute the checksums. Still, it shouldn't affect anything.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 83e18106505..55ade377152 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.65 2001/06/23 03:42:10 angelos Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.66 2001/06/23 05:36:08 angelos Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -856,6 +856,8 @@ udp_output(m, va_alist) register int len = m->m_pkthdr.len; struct in_addr laddr; int s = 0, error = 0; + struct route *ro; + struct ifnet *ifp; va_list ap; int pcbflags = 0; @@ -936,9 +938,20 @@ udp_output(m, va_alist) ui->ui_sum = 0; if (udpcksum) { + ro = &inp->inp_route; + if (ro->ro_rt && (ro->ro_rt->rt_flags & RTF_UP)) { + ifp = ro->ro_rt->rt_ifp; + if (ifp->if_capabilities & IFCAP_CSUM_UDPv4) { + m->m_pkthdr.csum |= M_UDPV4_CSUM_OUT; + ui->ui_sum = in_cksum(m, + sizeof(struct udpiphdr)); + goto skipudpcsum; + } + } if ((ui->ui_sum = in_cksum(m, sizeof (struct udpiphdr) + len)) == 0) ui->ui_sum = 0xffff; + skipudpcsum: } ((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len; ((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl; |