Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2001 11:00:40 -0400 (EDT)
From:      Robert Watson <rwatson@freebsd.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        hackers@freebsd.org
Subject:   Re: Fwd: error in ip_checkinterface code?
Message-ID:  <Pine.NEB.3.96L.1010814105749.65192E-100000@fledge.watson.org>
In-Reply-To: <20010813143116.A13647@Odin.AC.HMC.Edu>

next in thread | previous in thread | raw e-mail | index | archive | help

Well, the BPF code relies on the ifnet pointer being set or not to
determine if a packet is "locally sourced".  This permits userland
programs to differentiate packets targeted at a local ethernet address but
remotely sourced (i.e., looped back) when bridging.  "locally sourced"
becomes sort of fuzzy in the face of a variety of less traditional packet
sources, but is useful.  I'd prefer it if non-local packets always had an
ifnet defined--could you describe the circumstances where that is not the
case in a little more detail? 

Robert N M Watson             FreeBSD Core Team, TrustedBSD Project
robert@fledge.watson.org      NAI Labs, Safeport Network Services

On Mon, 13 Aug 2001, Brooks Davis wrote:

> I sent the following to net a while back and got a whole one responce.
> Anyone else have any thoughts?  Unless someone has a good reason not to,
> I'd like to commit the attached patch.
> 
> -- Brooks
> 
> ----- Forwarded message from Brooks Davis <brooks@one-eyed-alien.net> -----
> 
> From: Brooks Davis <brooks@one-eyed-alien.net>
> Date: Mon, 23 Jul 2001 18:44:18 -0700
> To: net@FreeBSD.ORG
> Subject: error in ip_checkinterface code?
> 
> I just ran into what appears to be a bug in the ip_checkinterface code.
> The problem is that is assumes m->m_pkthdr.rcvif is non-NULL.
> Apparently this is normally true, but I have some netgraph code that
> processes it's processes in such a way that they lose their interface
> pointer which means that when I stick them back into the ip_stack get a
> panic.  A quick patch that fixes the problem is included below.  Is
> this fix correct?
> 
> -- Brooks
> 
> Index: ip_input.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v
> retrieving revision 1.174
> diff -u -r1.174 ip_input.c
> --- ip_input.c	2001/06/23 17:17:58	1.174
> +++ ip_input.c	2001/07/24 01:46:22
> @@ -559,6 +559,7 @@
>  	 * the packets are received.
>  	 */
>  	checkif = ip_checkinterface && (ipforwarding == 0) && 
> +	    m->m_pkthdr.rcvif != NULL &&
>  	    ((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) &&
>  	    (ip_fw_fwd_addr == NULL);
>  
> -- 
> Any statement of the form "X is the one, true Y" is FALSE.
> PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
> 
> 
> 
> ----- End forwarded message -----
> -- 
> Any statement of the form "X is the one, true Y" is FALSE.
> PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1010814105749.65192E-100000>