Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2008 18:08:21 GMT
From:      Gleb Kurtsou <gk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 145645 for review
Message-ID:  <200807221808.m6MI8Ld8010772@repoman.freebsd.org>

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

Change 145645 by gk@gk_h1 on 2008/07/22 18:08:09

	enable support for INET6. minor style fixup

Affected files ...

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

Differences ...

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

@@ -7306,6 +7306,12 @@
 	pd.tos = 0;
 	pd.tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr);
 	pd.eh = eh;
+	if (eh) {
+		memcpy(pd.src_ether.octet, eh->ether_shost, ETHER_ADDR_LEN);
+		pd.src_ether.flags = PFAE_CHECK;
+		memcpy(pd.dst_ether.octet, eh->ether_dhost, ETHER_ADDR_LEN);
+		pd.dst_ether.flags = PFAE_CHECK;
+	}
 
 	off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr);
 	pd.proto = h->ip6_nxt;

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

@@ -3648,8 +3648,8 @@
 	}
 	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);
+	    tag_ether_hdr ? (struct ether_header *)(tag_ether_hdr + 1) : NULL, 
+	    inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;
@@ -3692,8 +3692,8 @@
 	}
 	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);
+	    tag_ether_hdr ? (struct ether_header *)(tag_ether_hdr + 1) : NULL, 
+	    inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;
@@ -3715,6 +3715,7 @@
 	/*
 	 * IPv6 is not affected by ip_len/ip_off byte order changes.
 	 */
+	struct m_tag *tag_ether_hdr;
 	int chk;
 
 	/*
@@ -3722,8 +3723,10 @@
 	 * order to support scoped addresses. In order to support stateful
 	 * filtering we have change this to lo0 as it is the case in IPv4.
 	 */
+	tag_ether_hdr = m_tag_locate(*m, MTAG_ETHER, MTAG_ETHER_HEADER, NULL);
 	chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &loif[0] : ifp, m,
-	    NULL, inp);
+	    tag_ether_hdr ? (struct ether_header *)(tag_ether_hdr + 1) : NULL, 
+	    inp);
 	if (chk && *m) {
 		m_freem(*m);
 		*m = NULL;
@@ -3738,6 +3741,7 @@
 	/*
 	 * IPv6 does not affected ip_len/ip_off byte order changes.
 	 */
+	struct m_tag *tag_ether_hdr;
 	int chk;
 
 	/* We need a proper CSUM befor we start (s. OpenBSD ip_output) */
@@ -3745,7 +3749,10 @@
 		in_delayed_cksum(*m);
 		(*m)->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
 	}
-	chk = pf_test6(PF_OUT, ifp, m, NULL, inp);
+	tag_ether_hdr = m_tag_locate(*m, MTAG_ETHER, MTAG_ETHER_HEADER, NULL);
+	chk = pf_test6(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?200807221808.m6MI8Ld8010772>