summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_divert.c2
-rw-r--r--sys/netinet/ip_ipsec.c5
-rw-r--r--sys/netinet/ip_mroute.c3
-rw-r--r--sys/netinet/ip_output.c5
4 files changed, 9 insertions, 6 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 99d598c..4f5f1b3 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -208,10 +208,8 @@ divert_packet(struct mbuf *m, int incoming)
/* Delayed checksums are currently not compatible with divert. */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- ip->ip_len = ntohs(ip->ip_len);
in_delayed_cksum(m);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
- ip->ip_len = htons(ip->ip_len);
}
#ifdef SCTP
if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
diff --git a/sys/netinet/ip_ipsec.c b/sys/netinet/ip_ipsec.c
index 389b74e..7fc4c3f 100644
--- a/sys/netinet/ip_ipsec.c
+++ b/sys/netinet/ip_ipsec.c
@@ -332,6 +332,9 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
}
}
+ ip->ip_len = htons(ip->ip_len);
+ ip->ip_off = htons(ip->ip_off);
+
/*
* Do delayed checksums now because we send before
* this is done in the normal processing path.
@@ -346,8 +349,6 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
(*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP;
}
#endif
- ip->ip_len = htons(ip->ip_len);
- ip->ip_off = htons(ip->ip_off);
/* NB: callee frees mbuf */
*error = ipsec4_process_packet(*m, sp->req, *flags, 0);
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 9250be5..c52332d 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -2376,7 +2376,10 @@ pim_register_prepare(struct ip *ip, struct mbuf *m)
/* Take care of delayed checksums */
if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
+ /* XXX: in_delayed_cksum() expects net byte order */
+ ip->ip_len = htons(ip->ip_len);
in_delayed_cksum(m);
+ ip->ip_len = ntohs(ip->ip_len);
m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
}
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 6ea9827..e82a0ac 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -882,11 +882,12 @@ void
in_delayed_cksum(struct mbuf *m)
{
struct ip *ip;
- u_short csum, offset;
+ uint16_t csum, offset, ip_len;
ip = mtod(m, struct ip *);
offset = ip->ip_hl << 2 ;
- csum = in_cksum_skip(m, ip->ip_len, offset);
+ ip_len = ntohs(ip->ip_len);
+ csum = in_cksum_skip(m, ip_len, offset);
if (m->m_pkthdr.csum_flags & CSUM_UDP && csum == 0)
csum = 0xffff;
offset += m->m_pkthdr.csum_data; /* checksum offset */
OpenPOWER on IntegriCloud