MCPcopy Create free account
hub / github.com/F-Stack/f-stack / in_delayed_cksum

Function in_delayed_cksum

freebsd/netinet/ip_output.c:1058–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1056}
1057
1058void
1059in_delayed_cksum(struct mbuf *m)
1060{
1061 struct ip *ip;
1062 struct udphdr *uh;
1063 uint16_t cklen, csum, offset;
1064
1065 ip = mtod(m, struct ip *);
1066 offset = ip->ip_hl << 2 ;
1067
1068 if (m->m_pkthdr.csum_flags & CSUM_UDP) {
1069 /* if udp header is not in the first mbuf copy udplen */
1070 if (offset + sizeof(struct udphdr) > m->m_len) {
1071 m_copydata(m, offset + offsetof(struct udphdr,
1072 uh_ulen), sizeof(cklen), (caddr_t)&cklen);
1073 cklen = ntohs(cklen);
1074 } else {
1075 uh = (struct udphdr *)mtodo(m, offset);
1076 cklen = ntohs(uh->uh_ulen);
1077 }
1078 csum = in_cksum_skip(m, cklen + offset, offset);
1079 if (csum == 0)
1080 csum = 0xffff;
1081 } else {
1082 cklen = ntohs(ip->ip_len);
1083 csum = in_cksum_skip(m, cklen, offset);
1084 }
1085 offset += m->m_pkthdr.csum_data; /* checksum offset */
1086
1087 if (offset + sizeof(csum) > m->m_len)
1088 m_copyback(m, offset, sizeof(csum), (caddr_t)&csum);
1089 else
1090 *(u_short *)mtodo(m, offset) = csum;
1091}
1092
1093/*
1094 * IP socket option processing.

Callers 12

ipf_checkFunction · 0.85
pf_routeFunction · 0.85
ipfw_natFunction · 0.85
nat64_do_handle_ip4Function · 0.85
divert_packetFunction · 0.85
ip_outputFunction · 0.85
ip_fragmentFunction · 0.85
ip_mloopbackFunction · 0.85
pim_register_prepareFunction · 0.85
ng_nat_rcvdataFunction · 0.85
udp_ipsec_adjust_cksumFunction · 0.85
ipsec4_common_outputFunction · 0.85

Calls 3

m_copydataFunction · 0.85
m_copybackFunction · 0.85
in_cksum_skipFunction · 0.50

Tested by

no test coverage detected