Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet6/ip6_input.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet6/ip6_input.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.85 retrieving revision 1.89 diff -u -p -r1.85 -r1.89 --- src/sys/netinet6/ip6_input.c 2006/05/05 00:03:22 1.85 +++ src/sys/netinet6/ip6_input.c 2006/10/12 01:32:39 1.89 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.85 2006/05/05 00:03:22 rpaulo Exp $ */ +/* $NetBSD: ip6_input.c,v 1.89 2006/10/12 01:32:39 christos Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.85 2006/05/05 00:03:22 rpaulo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.89 2006/10/12 01:32:39 christos Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -189,8 +189,7 @@ ip6_init() } static void -ip6_init2(dummy) - void *dummy; +ip6_init2(void *dummy __unused) { /* nd6_timer_init */ @@ -410,6 +409,10 @@ ip6_input(m) * dst are the loopback address and the receiving interface * is not loopback. */ + if (__predict_false( + m_makewritable(&m, 0, sizeof(struct ip6_hdr), M_DONTWAIT))) + goto bad; + ip6 = mtod(m, struct ip6_hdr *); if (in6_clearscope(&ip6->ip6_src) || in6_clearscope(&ip6->ip6_dst)) { ip6stat.ip6s_badscope++; /* XXX */ goto bad; @@ -1048,6 +1051,11 @@ ip6_savecontrol(in6p, mp, ip6, m) mp = &(*mp)->m_next; } #endif + + /* some OSes call this logic with IPv4 packet, for SO_TIMESTAMP */ + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) + return; + /* RFC 2292 sec. 5 */ if ((in6p->in6p_flags & IN6P_PKTINFO) != 0) { struct in6_pktinfo pi6; @@ -1149,7 +1157,7 @@ ip6_savecontrol(in6p, mp, ip6, m) * Note that the order of the headers remains in * the chain of ancillary data. */ - while (1) { /* is explicit loop prevention necessary? */ + for (;;) { /* is explicit loop prevention necessary? */ struct ip6_ext *ip6e = NULL; int elen; struct mbuf *ext = NULL; @@ -1479,7 +1487,7 @@ ip6_lasthdr(m, off, proto, nxtp) nxt = -1; nxtp = &nxt; } - while (1) { + for (;;) { newoff = ip6_nexthdr(m, off, proto, nxtp); if (newoff < 0) return off;