The proper fix for the delayed SCTP checksum is to
have the delayed function take an argument as to the offset to the SCTP header. This allows it to work for V4 and V6. This of course means changing all callers of the function to either pass the header len, if they have it, or create it (ip_hl << 2 or sizeof(ip6_hdr)). PR: 144529 MFC after: 2 weeks
This commit is contained in:
parent
41ecefa550
commit
1966e5b5a1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205104
@ -302,7 +302,7 @@ fixup_checksum(struct mbuf *m)
|
||||
m->m_pkthdr.csum_flags &= ~CSUM_TCP;
|
||||
#ifdef SCTP
|
||||
} else if (sw_csum & CSUM_SCTP) {
|
||||
sctp_delayed_cksum(m);
|
||||
sctp_delayed_cksum(m, iphlen);
|
||||
sw_csum &= ~CSUM_SCTP;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -227,7 +227,7 @@ divert_packet(struct mbuf *m, int incoming)
|
||||
#ifdef SCTP
|
||||
if (m->m_pkthdr.csum_flags & CSUM_SCTP) {
|
||||
ip->ip_len = ntohs(ip->ip_len);
|
||||
sctp_delayed_cksum(m);
|
||||
sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
|
||||
m->m_pkthdr.csum_flags &= ~CSUM_SCTP;
|
||||
ip->ip_len = htons(ip->ip_len);
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ ip_ipsec_output(struct mbuf **m, struct inpcb *inp, int *flags, int *error)
|
||||
}
|
||||
#ifdef SCTP
|
||||
if ((*m)->m_pkthdr.csum_flags & CSUM_SCTP) {
|
||||
sctp_delayed_cksum(*m);
|
||||
sctp_delayed_cksum(*m, (uint32_t)(ip->ip_hl << 2));
|
||||
(*m)->m_pkthdr.csum_flags &= ~CSUM_SCTP;
|
||||
}
|
||||
#endif
|
||||
|
@ -583,7 +583,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags,
|
||||
}
|
||||
#ifdef SCTP
|
||||
if (sw_csum & CSUM_SCTP) {
|
||||
sctp_delayed_cksum(m);
|
||||
sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2));
|
||||
sw_csum &= ~CSUM_SCTP;
|
||||
}
|
||||
#endif
|
||||
@ -725,7 +725,7 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
|
||||
#ifdef SCTP
|
||||
if (m0->m_pkthdr.csum_flags & CSUM_SCTP &&
|
||||
(if_hwassist_flags & CSUM_IP_FRAGS) == 0) {
|
||||
sctp_delayed_cksum(m0);
|
||||
sctp_delayed_cksum(m0, hlen);
|
||||
m0->m_pkthdr.csum_flags &= ~CSUM_SCTP;
|
||||
}
|
||||
#endif
|
||||
|
@ -127,14 +127,12 @@ sctp_calculate_cksum(struct mbuf *m, uint32_t offset)
|
||||
|
||||
|
||||
void
|
||||
sctp_delayed_cksum(struct mbuf *m)
|
||||
sctp_delayed_cksum(struct mbuf *m, uint32_t offset)
|
||||
{
|
||||
struct ip *ip;
|
||||
uint32_t checksum;
|
||||
uint32_t offset;
|
||||
|
||||
ip = mtod(m, struct ip *);
|
||||
offset = ip->ip_hl << 2;
|
||||
checksum = sctp_calculate_cksum(m, offset);
|
||||
SCTP_STAT_DECR(sctps_sendhwcrc);
|
||||
SCTP_STAT_INCR(sctps_sendswcrc);
|
||||
|
@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
|
||||
#if defined(_KERNEL) || defined(__Userspace__)
|
||||
|
||||
uint32_t sctp_calculate_cksum(struct mbuf *, uint32_t);
|
||||
void sctp_delayed_cksum(struct mbuf *);
|
||||
void sctp_delayed_cksum(struct mbuf *, uint32_t offset);
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
|
@ -872,7 +872,7 @@ skip_ipsec2:;
|
||||
#ifdef SCTP
|
||||
sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_hwassist;
|
||||
if (sw_csum & CSUM_SCTP) {
|
||||
sctp_delayed_cksum(m);
|
||||
sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
|
||||
sw_csum &= ~CSUM_SCTP;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user