if a bridge checked the ipv4 checksum and it was good, we can avoid
checking it again in ip_input.
ok?
Index: ip_input.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.361
diff -u -p -r1.361 ip_input.c
--- ip_input.c 2 Jun 2021 00:09:57 -0000 1.361
+++ ip_input.c 2 Jun 2021 01:07:35 -0000
@@ -287,8 +287,8 @@ ipv4_check(struct ifnet *ifp, struct mbu
}
}
- if ((m->m_pkthdr.csum_flags & M_IPV4_CSUM_IN_OK) == 0) {
- if (m->m_pkthdr.csum_flags & M_IPV4_CSUM_IN_BAD) {
+ if (!ISSET(m->m_pkthdr.csum_flags, M_IPV4_CSUM_IN_OK)) {
+ if (ISSET(m->m_pkthdr.csum_flags, M_IPV4_CSUM_IN_BAD)) {
ipstat_inc(ips_badsum);
goto bad;
}
@@ -298,6 +298,8 @@ ipv4_check(struct ifnet *ifp, struct mbu
ipstat_inc(ips_badsum);
goto bad;
}
+
+ SET(m->m_pkthdr.csum_flags, M_IPV4_CSUM_IN_OK);
}
/* Retrieve the packet length. */