Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Sep 2003 15:06:16 -0700
From:      Jerry Toung <jtoung@arc.nasa.gov>
To:        Bruce M Simpson <bms@spc.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: if_gre, ip_gre and the like (pseudo-interfaces)
Message-ID:  <200309021506.16581.jtoung@arc.nasa.gov>
In-Reply-To: <20030902191213.GC29217@spc.org>
References:  <200308312303.40555.jtoung@arc.nasa.gov> <20030902191213.GC29217@spc.org>

next in thread | previous in thread | raw e-mail | index | archive | help
BMS,
please be patient. I guess I am still a little bit confuse as to how a
packet goes from a real NIC (i.e xl0) to the gre pseudo-device.
in if_gre.c, you define a new protocol switch in the inetdomain and
gre_input as the input processing function.
My understanding is that NIC receives a data, device driver unwraps it an=
d
places it in &ipintrq. Then (*inetsw[ip_protox[ip->ip_p]].pr_input) in=20
ip_input.c points to gre_input and that's how we land in the gre module.

gre_output on the other hand prepends or insert headers and make a call
to ip_output which I think will transmit the packet to the physical inter=
face=20
(i.e xl0).

With all respect, I don't see any call to IF_HANDOFF in the gre code. onl=
y in=20
if_gif that you also wrote.
which fit the explaination you gave previously. As for /dev/gre, we can i=
gnore=20
that statement.
Thanks lot,
Jerry.



On Tuesday 02 September 2003 12:12 pm, Bruce M Simpson wrote:
> On Sun, Aug 31, 2003 at 11:03:40PM -0700, Jerry Toung wrote:
> > My understanding is that gre_input is called by IP everytime it recei=
ves
> > a packet with a gre headers which after some processing performs
> > IF_ENQUEUE(ifq,m) to put it back on the IPqueue so that higher protoc=
ol
> > such TCP can do their thing. :-)
>
> Not quite correct. This is what my legacy GRE code does. The NetBSD-der=
ived
> if_gre in the tree passes the mbuf to netisr_dispatch(), which in turn
> calls if_handoff(), which does something similar.
>
> >  I don't see how /dev/gre is ever used on receiving or sending, throu=
gh
> > if_clone_attach??. Somebody educate me on my missing link.
>
> I don't see /dev/gre on my system.
>
> If you're referring to the line 'device gre' in the kernel configuratio=
n,
> that is there purely to ensure that the gre driver is statically linked
> into the kernel.
>
> BMS

--=20



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