summaryrefslogtreecommitdiff
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-06-25 02:06:41 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-06-25 02:06:41 +0000
commite46465bf6e0c31d911fa8d9621decec959759311 (patch)
treeedf51ca36fff7cdf62be11de9860fac82ebb1afa /sys/netinet/udp_usrreq.c
parente547143589c1411e818ef1cb8b14116f75ecca0a (diff)
Defer output checksumming until ip_output() or hardware.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index b4a899e594c..43119d66127 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.73 2001/06/25 00:11:58 angelos Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.74 2001/06/25 02:06:40 angelos Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -884,8 +884,6 @@ 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;
@@ -961,29 +959,16 @@ udp_output(m, va_alist)
ui->ui_ulen = ui->ui_len;
/*
- * Stuff checksum and output datagram.
+ * Compute the pseudo-header checksum; defer further checksumming
+ * until ip_output() or hardware (if it exists).
*/
-
- 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) &&
- ifp->if_bridge == NULL) {
- m->m_pkthdr.csum |= M_UDPV4_CSUM_OUT;
- udpstat.udps_outhwcsum++;
- ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,
- ui->ui_dst.s_addr, htons((u_int16_t)len +
- sizeof (struct udphdr) + IPPROTO_UDP));
- goto skipudpcsum;
- }
- }
- if ((ui->ui_sum = in_cksum(m, sizeof (struct udpiphdr) +
- len)) == 0)
- ui->ui_sum = 0xffff;
- skipudpcsum:
- }
+ m->m_pkthdr.csum |= M_UDPV4_CSUM_OUT;
+ ui->ui_sum = in_cksum_phdr(ui->ui_src.s_addr,
+ ui->ui_dst.s_addr, htons((u_int16_t)len +
+ sizeof (struct udphdr) + IPPROTO_UDP));
+ } else
+ ui->ui_sum = 0;
((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
((struct ip *)ui)->ip_ttl = inp->inp_ip.ip_ttl;
((struct ip *)ui)->ip_tos = inp->inp_ip.ip_tos;