diff options
author | 2013-10-19 10:51:41 +0000 | |
---|---|---|
committer | 2013-10-19 10:51:41 +0000 | |
commit | 11d6b1fa159d5a62def7e06b9e612f9964a4b9ae (patch) | |
tree | d12eba59a3ba8432a14a71aa34a9c5a9177c9741 | |
parent | simplify: no need to muck with the pseudo hdr cksum any more (diff) | |
download | wireguard-openbsd-11d6b1fa159d5a62def7e06b9e612f9964a4b9ae.tar.xz wireguard-openbsd-11d6b1fa159d5a62def7e06b9e612f9964a4b9ae.zip |
simplify checksum handling. no need to compute the pseudo hdr cksum
in the v4 case any more, and computing the cksum in the v6 case isn't
needed either. ok florian lteo
-rw-r--r-- | sys/net/pipex.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c index 8f45fca944f..8d3ffaf5a94 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.44 2013/10/17 16:27:43 bluhm Exp $ */ +/* $OpenBSD: pipex.c,v 1.45 2013/10/19 10:51:41 henning Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -1976,7 +1976,9 @@ pipex_l2tp_output(struct mbuf *m0, struct pipex_session *session) udp->uh_sport = session->local.sin6.sin6_port; udp->uh_dport = session->peer.sin6.sin6_port; udp->uh_ulen = htons(plen); + udp->uh_sum = 0; + m0->m_pkthdr.csum_flags |= M_UDP_CSUM_OUT; m0->m_pkthdr.rcvif = session->pipex_iface->ifnet_this; #if NPF > 0 pf_pkt_addr_changed(m0); @@ -1991,13 +1993,6 @@ pipex_l2tp_output(struct mbuf *m0, struct pipex_session *session) ip->ip_ttl = MAXTTL; ip->ip_tos = 0; - if (udpcksum) { - udp->uh_sum = in_cksum_phdr(ip->ip_src.s_addr, - ip->ip_dst.s_addr, htons(plen + IPPROTO_UDP)); - m0->m_pkthdr.csum_flags |= M_UDP_CSUM_OUT; - } else - udp->uh_sum = 0; - if (ip_output(m0, NULL, NULL, IP_IPSECFLOW, NULL, NULL, session->proto.l2tp.ipsecflowinfo) != 0) { PIPEX_DBG((session, LOG_DEBUG, "ip_output failed.")); @@ -2017,10 +2012,6 @@ pipex_l2tp_output(struct mbuf *m0, struct pipex_session *session) &session->peer.sin6, NULL, NULL); /* ip6->ip6_plen will be filled in ip6_output. */ - udp->uh_sum = 0; - if ((udp->uh_sum = in6_cksum(m0, IPPROTO_UDP, - sizeof(struct ip6_hdr), plen)) == 0) - udp->uh_sum = 0xffff; if (ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL) != 0) { PIPEX_DBG((session, LOG_DEBUG, "ip6_output failed.")); goto drop; |