Hi, I would like to check in the following diff against FreeBSD-CURRENT and to get feedback from the Kame folks on the general usefulness of these fixes. All changes are against icmp6.c.
The first part of the diff removes dead code as I suspect MCLBYTES, the size of a cluster, will never be less than 48, which is the size of maxlen set above those lines. The second part checks for error returns from the duplication of the packets before starting to copy things around. Thanks, George Index: icmp6.c =================================================================== RCS file: /Volumes/exported/FreeBSD-CVS/src/sys/netinet6/icmp6.c,v retrieving revision 1.60 diff -u -r1.60 icmp6.c --- icmp6.c 2 Mar 2005 05:14:15 -0000 1.60 +++ icmp6.c 7 Apr 2005 15:26:28 -0000 @@ -524,15 +524,6 @@ const int maxlen = sizeof(*nip6) + sizeof(*nicmp6); int n0len; - /* - * Prepare an internal mbuf. m_pullup() doesn't - * always copy the length we specified. - */ - if (maxlen >= MCLBYTES) { - /* Give up remote */ - m_freem(n0); - break; - } MGETHDR(n, M_DONTWAIT, n0->m_type); n0len = n0->m_pkthdr.len; /* save for use below */ if (n) @@ -1943,9 +1934,14 @@ m->m_len <= MHLEN) { MGET(n, M_DONTWAIT, m->m_type); if (n != NULL) { - m_dup_pkthdr(n, m, M_NOWAIT); - bcopy(m->m_data, n->m_data, m->m_len); - n->m_len = m->m_len; + if (m_dup_pkthdr(n, m, M_NOWAIT)) { + bcopy(m->m_data, n->m_data, + m->m_len); + n->m_len = m->m_len; + } else { + m_free(n); + n = NULL; + } } } if (n != NULL || @@ -1983,12 +1979,16 @@ MGET(n, M_DONTWAIT, m->m_type); if (n != NULL) { - m_dup_pkthdr(n, m, M_NOWAIT); - bcopy(m->m_data, n->m_data, m->m_len); - n->m_len = m->m_len; - - m_freem(m); - m = n; + if (m_dup_pkthdr(n, m, M_NOWAIT)) { + bcopy(m->m_data, n->m_data, m->m_len); + n->m_len = m->m_len; + + m_freem(m); + m = n; + } else { + m_freem(n); + n = NULL; + } } } if (sbappendaddr(&last->in6p_socket->so_rcv, _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"