Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net/npf - npf_cache_ip: re-fetch IPv6 header since nbufs...



details:   https://anonhg.NetBSD.org/src/rev/e0af1bcb7749
branches:  trunk
changeset: 789584:e0af1bcb7749
user:      rmind <rmind%NetBSD.org@localhost>
date:      Fri Aug 23 10:37:03 2013 +0000

description:
- npf_cache_ip: re-fetch IPv6 header since nbufs might have been reallocated.
- npf_cache_all: clear NBUF_DATAREF_RESET since npf_cache_ip() handles it.

diffstat:

 sys/net/npf/npf_inet.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 9c4b9a5bd59a -r e0af1bcb7749 sys/net/npf/npf_inet.c
--- a/sys/net/npf/npf_inet.c    Fri Aug 23 07:15:08 2013 +0000
+++ b/sys/net/npf/npf_inet.c    Fri Aug 23 10:37:03 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_inet.c,v 1.22 2013/06/02 02:20:04 rmind Exp $      */
+/*     $NetBSD: npf_inet.c,v 1.23 2013/08/23 10:37:03 rmind Exp $      */
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.22 2013/06/02 02:20:04 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.23 2013/08/23 10:37:03 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -391,8 +391,12 @@
                        npc->npc_hlen += hlen;
                }
 
-               /* Restore the offset. */
+               /*
+                * Re-fetch the header pointers (nbufs might have been
+                * reallocated).  Restore the original offset (if any).
+                */
                nbuf_reset(nbuf);
+               ip6 = nbuf_dataptr(nbuf);
                if (off) {
                        nbuf_advance(nbuf, off, 0);
                }
@@ -437,6 +441,7 @@
         */
        flags = npf_cache_ip(npc, nbuf);
        if ((flags & NPC_IP46) == 0 || (flags & NPC_IPFRAG) != 0) {
+               nbuf_unset_flag(nbuf, NBUF_DATAREF_RESET);
                npc->npc_info |= flags;
                return flags;
        }



Home | Main Index | Thread Index | Old Index