if_gre, ip_gre and the like (pseudo-interfaces)

Bruce M Simpson bms at spc.org
Tue Sep 2 16:04:30 PDT 2003


[Redirected to -net as more appropriate]

On Tue, Sep 02, 2003 at 03:06:16PM -0700, Jerry Toung wrote:
> 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.

No problem. :-)

> 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 and
> places it in &ipintrq. Then (*inetsw[ip_protox[ip->ip_p]].pr_input) in 
> ip_input.c points to gre_input and that's how we land in the gre module.

Yes, that is broadly how it works on the inbound path.

> 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 interface 
> (i.e xl0).

That is also broadly how it works on the outbound path.

> With all respect, I don't see any call to IF_HANDOFF in the gre code. only in 
> if_gif that you also wrote.

I didn't write if_gif, it came from KAME. :-)

Also I should add I'm looking at my own tree (which is closer to 5.1-RELEASE
than -CURRENT right now), you probably want to browse source in cvsweb to
get an up-to-date picture of things.

BMS


More information about the freebsd-net mailing list