From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20537 invoked by alias); 17 Jun 2005 12:53:56 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 20250 invoked by uid 22791); 17 Jun 2005 12:53:38 -0000 Received: from anchor-post-33.mail.demon.net (HELO anchor-post-33.mail.demon.net) (194.217.242.91) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 17 Jun 2005 12:53:38 +0000 Received: from calivar.demon.co.uk ([83.104.54.243] helo=xl5.calivar.com) by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) id 1DjGLl-000AiS-AR; Fri, 17 Jun 2005 12:53:33 +0000 Received: from xl5.calivar.com (localhost [127.0.0.1]) by xl5.calivar.com (Postfix) with ESMTP id 56B2B3B585; Fri, 17 Jun 2005 13:53:32 +0100 (BST) To: Andrew Lunn Cc: Sturle Mastberg , Gary Thomas , eCos Discussion References: <42B28F30.1070905@tandberg.net> <1119002495.13965.224.camel@hermes> <42B2ACAD.5030608@tandberg.net> <20050617112810.GA4982@lunn.ch> From: Nick Garnett Original-Sender: nickg@ecoscentric.com Date: Fri, 17 Jun 2005 12:53:00 -0000 In-Reply-To: <20050617112810.GA4982@lunn.ch> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [ECOS] Possible fix for duplicated ARP entries in the FreeBSD stack X-SW-Source: 2005-06/txt/msg00139.txt.bz2 Andrew Lunn writes: > On Fri, Jun 17, 2005 at 12:57:49PM +0200, Sturle Mastberg wrote: > > Gary Thomas wrote: > > >On Fri, 2005-06-17 at 10:52 +0200, Sturle Mastberg wrote: > > > > > >>Hello, > > >> > > >>For some time I've had problem with duplicated ARP entries that have > > >>caused all sorts of problems. I searched the archive and discovered that > > >>the problem had been reported before: > > >> > > >> > > >>http://sourceware.org/ml/ecos-discuss/2004-11/msg00097.html > > >> > > >> > > >>My proposal to a fix is to make the sockaddr_inarp struct > > >>(include/netinet/if_ether.h) equal in size to the sockaddr struct by > > >>padding it at the end. This is exactly what is done to the sockaddr_in > > >>struct (include/netinet/in.h) for different reasons. > > >> > > >> > > >>I reached this conclusion after I discovered that two virutally > > >>identical calls to rtalloc1 (net/route.c) returned different results. > > >>The first instance appears in arplookup (netinet/if_ether.c) where the > > >>first parameter to rtalloc1 is a struct sockaddr_inarp cast to a struct > > >>sockaddr. The second instance appears in ip_output (netinet/ip_output) > > >>via rtalloc_ign (net/route.c) where the first parameter to rtalloc1 is > > >>an actual struct sockaddr. The rtalloc1 function does a radix tree > > >>search with a call to the rn_match function (net/radix.c). A closer look > > >>at this code reveals that it does indeed depend on the size of the > > >>supplied struct. > > >> > > >> > > >>The only conclusion a can draw from this is that the three structs: > > >>sockaddr, sockaddr_in and sockaddr_inarp must all be of equal size. I > > >>have checked the FreeBSD source repository that this is the case for the > > >>original code. > > >> > > >> > > >>While browsing the FreeBSD source repository I discovered that the > > >>sa_data character array member of the sockaddr struct was increased in > > >>size in the eCos FreeBSD stack. Does anyone know why this increase was > > >>introduced in eCos? > > I beleave Nick did this for IPv6. This bigger size allows an IPv6 > address to be placed into a sockaddr which you cannot normally do. I thought that initially and had a look. The change I made was to struct sockaddr_in to make it match the increased sockaddr size so that some punned data structures would match. I think the change to struct sockaddr was done by Gary during the initial port to make IPv6 addresses fit correctly. I'm sure it all has something to do with the lack of user/kernel space and the fact that we don't copy things to and fro as much as the BSD kernel does. -- Nick Garnett eCos Kernel Architect http://www.ecoscentric.com The eCos and RedBoot experts -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss