mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
netinet: provide "at offset" variant of the in_delayed_cksum() API
The need for such a variant comes from the fact that we need to re-calculate checksum aftet ng_nat(4) transformations while getting mbufs from the layer 2 (ethernet) directly. Reviewed by: markj, tuexen Approved by: tuexen Sponsored by: Sippy Software, Inc. Differential Revision: https://reviews.freebsd.org/D49677 MFC After: 2 weeks
This commit is contained in:
parent
7df90d9590
commit
5feb38e378
2 changed files with 11 additions and 3 deletions
|
|
@ -1044,14 +1044,14 @@ done:
|
|||
}
|
||||
|
||||
void
|
||||
in_delayed_cksum(struct mbuf *m)
|
||||
in_delayed_cksum_o(struct mbuf *m, uint16_t iph_offset)
|
||||
{
|
||||
struct ip *ip;
|
||||
struct udphdr *uh;
|
||||
uint16_t cklen, csum, offset;
|
||||
|
||||
ip = mtod(m, struct ip *);
|
||||
offset = ip->ip_hl << 2 ;
|
||||
ip = (struct ip *)mtodo(m, iph_offset);
|
||||
offset = iph_offset + (ip->ip_hl << 2);
|
||||
|
||||
if (m->m_pkthdr.csum_flags & CSUM_UDP) {
|
||||
/* if udp header is not in the first mbuf copy udplen */
|
||||
|
|
@ -1078,6 +1078,13 @@ in_delayed_cksum(struct mbuf *m)
|
|||
*(u_short *)mtodo(m, offset) = csum;
|
||||
}
|
||||
|
||||
void
|
||||
in_delayed_cksum(struct mbuf *m)
|
||||
{
|
||||
|
||||
in_delayed_cksum_o(m, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* IP socket option processing.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ VNET_DECLARE(struct pfil_head *, inet_local_pfil_head);
|
|||
#define PFIL_INET_LOCAL_NAME "inet-local"
|
||||
|
||||
void in_delayed_cksum(struct mbuf *m);
|
||||
void in_delayed_cksum_o(struct mbuf *m, uint16_t o);
|
||||
|
||||
/* Hooks for ipfw, dummynet, divert etc. Most are declared in raw_ip.c */
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue