Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Jul 2008 19:54:16 GMT
From:      Gleb Kurtsou <gk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 145386 for review
Message-ID:  <200807171954.m6HJsGhU017592@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=145386

Change 145386 by gk@gk_h1 on 2008/07/17 19:53:19

	Use mtag_ether_header in pf. support inet4 only for now

Affected files ...

.. //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_ioctl.c#2 edit

Differences ...

==== //depot/projects/soc2008/gk_l2filter/sys-pf/net/pf_ioctl.c#2 (text+ko) ====

@@ -111,6 +111,7 @@
 
 #ifdef __FreeBSD__
 #include <sys/md5.h>
+#include <net/ethernet.h>
 #else
 #include <dev/rndvar.h>
 #include <crypto/md5.h>
@@ -3636,6 +3637,7 @@
 	 * byte order. 
 	 */
 	struct ip *h = NULL;
+	struct m_tag *tag_ether_hdr;
 	int chk;
 
 	if ((*m)->m_pkthdr.len >= (int)sizeof(struct ip)) {
@@ -3644,7 +3646,10 @@
 	        HTONS(h->ip_len);
 	        HTONS(h->ip_off);
 	}
-	chk = pf_test(PF_IN, ifp, m, NULL, inp);
+	tag_ether_hdr = m_tag_locate(*m, MTAG_ETHER, MTAG_ETHER_HEADER, NULL);
+	chk = pf_test(PF_IN, ifp, m, 
+			tag_ether_hdr ? (struct ether_header *)(tag_ether_hdr + 1) : NULL, 
+			inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;
@@ -3671,6 +3676,7 @@
 	 * byte order. 
 	 */
 	struct ip *h = NULL;
+	struct m_tag *tag_ether_hdr;
 	int chk;
 
 	/* We need a proper CSUM befor we start (s. OpenBSD ip_output) */
@@ -3684,7 +3690,10 @@
 	        HTONS(h->ip_len);
 	        HTONS(h->ip_off);
 	}
-	chk = pf_test(PF_OUT, ifp, m, NULL, inp);
+	tag_ether_hdr = m_tag_locate(*m, MTAG_ETHER, MTAG_ETHER_HEADER, NULL);
+	chk = pf_test(PF_OUT, ifp, m, 
+			tag_ether_hdr ? (struct ether_header *)(tag_ether_hdr + 1) : NULL, 
+			inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807171954.m6HJsGhU017592>