Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Aug 2008 18:48:26 GMT
From:      Gleb Kurtsou <gk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 146645 for review
Message-ID:  <200808041848.m74ImQIw029149@repoman.freebsd.org>

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

Change 146645 by gk@gk_h1 on 2008/08/04 18:48:05

	no functional changes.
	do not mention args->L3offset
	document that args->m contains layer2 header when invoked from ether_*

Affected files ...

.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#14 edit

Differences ...

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#14 (text+ko) ====

@@ -752,18 +752,6 @@
 		 */
 		tcp_respond(NULL, ip6, tcp, m, ack, seq, flags);
 	} else if (code != ICMP6_UNREACH_RST) { /* Send an ICMPv6 unreach. */
-#if 0
-		/*
-		 * Unlike above, the mbufs need to line up with the ip6 hdr,
-		 * as the contents are read. We need to m_adj() the
-		 * needed amount.
-		 * The mbuf will however be thrown away so we can adjust it.
-		 * Remember we did an m_pullup on it already so we
-		 * can make some assumptions about contiguousness.
-		 */
-		if (args->L3offset)
-			m_adj(m, args->L3offset);
-#endif
 		icmp6_error(m, ICMP6_DST_UNREACH, code, 0);
 	} else
 		m_freem(m);
@@ -1732,16 +1720,6 @@
 send_reject(struct ip_fw_args *args, int code, int ip_len, struct ip *ip)
 {
 
-#if 0
-	/* XXX When ip is not guaranteed to be at mtod() we will
-	 * need to account for this */
-	 * The mbuf will however be thrown away so we can adjust it.
-	 * Remember we did an m_pullup on it already so we
-	 * can make some assumptions about contiguousness.
-	 */
-	if (args->L3offset)
-		m_adj(m, args->L3offset);
-#endif
 	if (code != ICMP_REJECT_RST) { /* Send an ICMP unreach */
 		icmp_error(args->m, ICMP_UNREACH, code, 0L, 0);
 	} else if (args->f_id.proto == IPPROTO_TCP) {
@@ -2112,10 +2090,9 @@
  * Parameters:
  *
  *	args->m	(in/out) The packet; we set to NULL when/if we nuke it.
- *		Starts with the IP header.
+ *		Starts with the IP header or with layer2 header if IP_FW_ARGS_LAYER2
+ *		is set in args->flags.
  *	args->eh (in)	ethernet header if present, or NULL for layer3 packet.
- *	args->L3offset	Number of bytes bypassed if we came from L2.
- *			e.g. often sizeof(eh)  ** NOTYET **
  *	args->oif	Outgoing interface, or NULL if packet is incoming.
  *		The incoming interface is in the mbuf. (in)
  *	args->divert_rule (in/out)
@@ -2126,6 +2103,7 @@
  *	args->next_hop	Socket we are forwarding to (out).
  *	args->f_id	Addresses grabbed from the packet (out)
  * 	args->cookie	a cookie depending on rule action
+ * 	args->flags	Flags
  *
  * Return value:
  *
@@ -2151,8 +2129,6 @@
 	 *
 	 * args->eh	The ethernet header. It is non-null for a layer2
 	 *	packet, it is NULL for a layer-3 packet.
-	 * **notyet**
-	 * args->L3offset Offset in the packet to the L3 (IP or equiv.) header.
 	 *
 	 * m | args->m	Pointer to the mbuf, as received from the caller.
 	 *	It may change if ipfw_chk() does an m_pullup, or if it
@@ -2160,8 +2136,6 @@
 	 *	XXX This has to change, so that ipfw_chk() never modifies
 	 *	or consumes the buffer.
 	 * ip	is the beginning of the ip(4 or 6) header.
-	 *	Calculated by adding the L3offset to the start of data.
-	 *	(Until we start using L3offset, the packet is
 	 *	supposed to start with the ip header).
 	 */
 	struct mbuf *m = args->m;



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