From owner-freebsd-hackers@FreeBSD.ORG Tue Sep 2 15:06:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D97E516A4BF for ; Tue, 2 Sep 2003 15:06:46 -0700 (PDT) Received: from pony2pub.arc.nasa.gov (pony2pub.arc.nasa.gov [128.102.31.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D83C43FE1 for ; Tue, 2 Sep 2003 15:06:40 -0700 (PDT) (envelope-from jtoung@arc.nasa.gov) Received: from nren-194.arc.nasa.gov ([128.102.196.194] verified) by pony2pub.arc.nasa.gov (CommuniGate Pro SMTP 4.1.3) with ESMTP id 2598771; Tue, 02 Sep 2003 15:06:40 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Jerry Toung To: Bruce M Simpson Date: Tue, 2 Sep 2003 15:06:16 -0700 User-Agent: KMail/1.4.3 References: <200308312303.40555.jtoung@arc.nasa.gov> <20030902191213.GC29217@spc.org> In-Reply-To: <20030902191213.GC29217@spc.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200309021506.16581.jtoung@arc.nasa.gov> cc: freebsd-hackers@freebsd.org Subject: Re: if_gre, ip_gre and the like (pseudo-interfaces) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: jtoung@arc.nasa.gov List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Sep 2003 22:06:47 -0000 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