From owner-freebsd-net@FreeBSD.ORG Thu Apr 19 09:38:57 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02AE416A401 for ; Thu, 19 Apr 2007 09:38:57 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id 539FC13C45B for ; Thu, 19 Apr 2007 09:38:56 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l3J9cmKo089623; Thu, 19 Apr 2007 13:38:48 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l3J9clIp089620; Thu, 19 Apr 2007 13:38:47 +0400 (MSD) (envelope-from yar) Date: Thu, 19 Apr 2007 13:38:47 +0400 From: Yar Tikhiy To: Alan Garfield Message-ID: <20070419093847.GC60301@comp.chem.msu.su> References: <1176861009.4426.21.camel@hiro.auspc.com.au> <20070418120622.GF40826@comp.chem.msu.su> <1176947814.4175.39.camel@hiro.auspc.com.au> <20070419073525.GA60301@comp.chem.msu.su> <1176972863.4177.7.camel@hiro.auspc.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1176972863.4177.7.camel@hiro.auspc.com.au> User-Agent: Mutt/1.5.9i Cc: freebsd-net@freebsd.org Subject: Re: rtentry and rtrequest X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2007 09:38:57 -0000 On Thu, Apr 19, 2007 at 06:54:23PM +1000, Alan Garfield wrote: > On Thu, 2007-04-19 at 11:35 +0400, Yar Tikhiy wrote: > > > > ... and I get these ARP errors. > > > > > > ---- > > > jnet0: port 0xa8,0xae-0xaf irq 19 on > > > acpi0 > > > jnet0: Ethernet address: 00:09:3d:00:00:03 > > > jnet0: jnet_start_locked() called. > > > jnet0: m == 0. > > > jnet0: RTM_ADD. > > > arplookup 169.254.101.2 failed: could not allocate llinfo > > > arpresolve: can't allocate route for 169.254.101.2 > > > ---- > > > > > > ... whenever I try and send anything. > > > > Did you set the maximum lengths for the output queue and the driver > > queue in the attach function? > > ---- > // Configure the structure for the device > ifp->if_softc = sc; > if_initname(ifp, device_get_name(dev), device_get_unit(dev)); > > // Function pointers > ifp->if_start = jnet_start; > ifp->if_ioctl = jnet_ioctl; > ifp->if_watchdog = jnet_watchdog; > ifp->if_init = jnet_init; > > // Interface specifics > ifp->if_flags = IFF_SIMPLEX; Try setting those flags to IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST I have no direct evidence, but ARP may have trouble operating on an interface w/o IFF_BROADCAST, as it utilizes broadcasts. Essentially, IFF_BROADCAST just means that the interface has a broadcast address, but there may be some indirect consequences via the routing table. Anyway, an Ethernet interface ought to have IFF_BROADCAST set on it because it's a broadcast interface. > IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); > ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; > IFQ_SET_READY(&ifp->if_snd); > ifp->if_timer = MAX_TIMEOUT; > > // Set our fake MAC address > bcopy(localMac, sc->enaddr, 6); Just a style note: the 6 should be ETHER_ADDR_LEN. We prefer ETHER_ADDR_LEN to sizeof(...) because sizeof returns size_t, while an int is sometimes needed. (int and size_t have different width on 64-bit architectures.) ETHER_ADDR_LEN expands to the constant 6, which gets the correct type provided that the function has been prototyped. > // Attach the ethernet interface > ether_ifattach(ifp, sc->enaddr); > > // Reset the mtu > ifp->if_mtu = JNET_MTU; > ---- > > I think so. :) > > I beginning to think the ARP issue is a symptom not the cause. The cause > may well be something is wrong with my initialisation of the output > queue and my handling of the de-queueing packets. I've looked at many > if_* drivers sources and they all seem very similar to what I've already > done. Please try fixing the interface flags. Could you also show output from "ifconfig jnetX" and "netstat -rn" after the interface has been configured (i.e., had IP assigned)? P.S. Was the name "jnet" inherited from the Linux driver? -- Yar