]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/net/if_pflog.c
xnu-2782.30.5.tar.gz
[apple/xnu.git] / bsd / net / if_pflog.c
index 8e7480911edb4270ee40f4e2e7ccc9a21a150327..3bc86c8209cd2eb6dc6f2ee04e0b02e7f53099ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2007-2013 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -68,6 +68,7 @@
 #include <sys/proc_internal.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#include <sys/mcache.h>
 
 #include <net/if.h>
 #include <net/if_var.h>
@@ -124,10 +125,6 @@ pfloginit(void)
 {
        int i;
 
-       if (pf_perim_lock == NULL || pf_lock == NULL) {
-               panic("%s: called before PF is initialized", __func__);
-               /* NOTREACHED */
-       }
        LIST_INIT(&pflogif_list);
        for (i = 0; i < PFLOGIFS_MAX; i++)
                pflogifs[i] = NULL;
@@ -225,8 +222,7 @@ pflog_clone_destroy(struct ifnet *ifp)
 static errno_t
 pflogoutput(struct ifnet *ifp, struct mbuf *m)
 {
-       printf("%s: freeing data for %s%d\n", __func__, ifp->if_name,
-           ifp->if_unit);
+       printf("%s: freeing data for %s\n", __func__, if_name(ifp));
        m_freem(m);
        return (ENOTSUP);
 }
@@ -256,8 +252,7 @@ static errno_t
 pflogdemux(struct ifnet *ifp, struct mbuf *m, char *h, protocol_family_t *ppf)
 {
 #pragma unused(h, ppf)
-       printf("%s: freeing data for %s%d\n", __func__, ifp->if_name,
-           ifp->if_unit);
+       printf("%s: freeing data for %s\n", __func__, if_name(ifp));
        m_freem(m);
        return (EJUSTRETURN);
 }
@@ -344,8 +339,8 @@ pflog_packet(struct pfi_kif *kif, struct mbuf *m, sa_family_t af, u_int8_t dir,
        }
 #endif /* INET */
 
-       ifn->if_opackets++;
-       ifn->if_obytes += m->m_pkthdr.len;
+       atomic_add_64(&ifn->if_opackets, 1);
+       atomic_add_64(&ifn->if_obytes, m->m_pkthdr.len);
 
        switch (dir) {
        case PF_IN: