On Fri, Feb 26, 2016 at 08:25:02PM +0100, Alexander Bluhm wrote:
> On Fri, Feb 26, 2016 at 04:56:49PM +0100, Mike Belopuhov wrote:
> > I think your revised diff should be committed.  Any objections?
> 
> OK bluhm@
> 
> > >           uh->uh_sum = 0;
> > > +#ifdef INET6
> > > +         if (tdb->tdb_dst.sa.sa_family == AF_INET6)
> > > +                 uh->uh_sum = in6_cksum(m, IPPROTO_UDP,
> > > +                     iphlen, m->m_pkthdr.len - iphlen);
> > > +#endif /* INET6 */
> 
> I think we should use hardware checksumming here.  But let's commit
> this fix first.
> 

bluhm proposed to add M_UDP_CSUM_OUT to the mbuf csum flags. I just
tried his proposal and it looks like the following diff works.

Patrick

diff --git sys/netinet/ipsec_output.c sys/netinet/ipsec_output.c
index 18a3f57..580329e 100644
--- sys/netinet/ipsec_output.c
+++ sys/netinet/ipsec_output.c
@@ -412,8 +412,7 @@ ipsp_process_done(struct mbuf *m, struct tdb *tdb)
                uh->uh_sum = 0;
 #ifdef INET6
                if (tdb->tdb_dst.sa.sa_family == AF_INET6)
-                       uh->uh_sum = in6_cksum(m, IPPROTO_UDP,
-                           iphlen, m->m_pkthdr.len - iphlen);
+                       m->m_pkthdr.csum_flags |= M_UDP_CSUM_OUT;
 #endif /* INET6 */
                espstat.esps_udpencout++;
        }

Reply via email to