From owner-freebsd-emulation Sun Dec 2 22:44:58 2001 Delivered-To: freebsd-emulation@freebsd.org Received: from kayak.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by hub.freebsd.org (Postfix) with ESMTP id F33A637B41A for ; Sun, 2 Dec 2001 22:44:47 -0800 (PST) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by kayak.xcllnt.net (8.11.6/8.11.4) with ESMTP id fB36ilQ98471; Sun, 2 Dec 2001 22:44:47 -0800 (PST) (envelope-from marcel@kayak.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.11.6/8.11.6) id fB36imV04555; Sun, 2 Dec 2001 22:44:48 -0800 (PST) (envelope-from marcel) Date: Sun, 2 Dec 2001 22:44:48 -0800 From: Marcel Moolenaar To: Glenn Johnson Cc: emulation@FreeBSD.ORG Subject: Re: SIOCGIFHWADDR ioctl fails [was: Re: problem with the new linux module] Message-ID: <20011202224448.A4448@dhcp01.pn.xcllnt.net> References: <20011130102101.A5245@node7.cluster.srrc.usda.gov> <20011202180007.A2618@dhcp01.pn.xcllnt.net> <20011203034308.GA643@gforce.johnson.home> <20011202205417.A3522@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="/9DWx/yDrRhgMJTb" Content-Disposition: inline In-Reply-To: <20011202205417.A3522@dhcp01.pn.xcllnt.net> User-Agent: Mutt/1.3.21i Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Dec 02, 2001 at 08:54:17PM -0800, Marcel Moolenaar wrote: > > 692 lmutil CALL linux_ioctl(0x3,SIOCGIFHWADDR,0xbfbff614) > > 692 lmutil RET linux_ioctl -1 errno 22 Invalid argument > > 692 lmutil CALL close(0x3) > > 692 lmutil RET close 0 > > 692 lmutil CALL write(0x1,0x280ad000,0x29) > > 692 lmutil GIO fd 1 wrote 41 bytes > > "The FLEXlm host ID of this machine is "" > > " > > 692 lmutil RET write 41/0x29 Can you try the attached patch. Note that the patch is against -current. If it doesn't apply cleanly to -stable, let me know. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net --/9DWx/yDrRhgMJTb Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ioctl.diff" Index: linux_ioctl.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_ioctl.c,v retrieving revision 1.76 diff -u -r1.76 linux_ioctl.c --- linux_ioctl.c 19 Nov 2001 15:43:45 -0000 1.76 +++ linux_ioctl.c 3 Dec 2001 06:17:55 -0000 @@ -1793,6 +1793,7 @@ struct ifnet *ifp; int len, unit; char *ep; + int is_eth, index; for (len = 0; len < LINUX_IFNAMSIZ; ++len) if (!isalpha(lxname[len])) @@ -1802,13 +1803,18 @@ unit = (int)strtoul(lxname + len, &ep, 10); if (ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) return (NULL); + index = 0; + is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; TAILQ_FOREACH(ifp, &ifnet, if_link) { - /* allow Linux programs to use FreeBSD names */ + /* + * Allow Linux programs to use FreeBSD names. Don't presume + * we never have an interface named "eth", so don't make + * the test optional based on is_eth. + */ if (ifp->if_unit == unit && ifp->if_name[len] == '\0' && strncmp(ifp->if_name, lxname, len) == 0) break; - if (ifp->if_index == unit && IFP_IS_ETH(ifp) && - strncmp(lxname, "eth", len) == 0) + if (is_eth && IFP_IS_ETH(ifp) && unit == index++) break; } if (ifp != NULL) --/9DWx/yDrRhgMJTb-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message