From owner-freebsd-stable Sun Jan 6 21:50:10 2002 Delivered-To: freebsd-stable@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 68DB937B405 for ; Sun, 6 Jan 2002 21:49:01 -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 g075n0Q86695; Sun, 6 Jan 2002 21:49:00 -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 g075nNE02906; Sun, 6 Jan 2002 21:49:23 -0800 (PST) (envelope-from marcel) Date: Sun, 6 Jan 2002 21:49:23 -0800 From: Marcel Moolenaar To: Andrew Atrens Cc: stable@freebsd.org Subject: Re: small fix for sys/compat/linux/linux_ioctl.c Message-ID: <20020106214923.A2879@dhcp01.pn.xcllnt.net> References: <20020107045140.16097.qmail@web11305.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020107045140.16097.qmail@web11305.mail.yahoo.com> User-Agent: Mutt/1.3.21i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Jan 06, 2002 at 11:51:40PM -0500, Andrew Atrens wrote: > All, > > A recent commit has broken Clearcase4 client support on -stable. This > small change appears to fix it. I've been using a kernel built with > this > fix for the last 30+ days without incident. Unfortunately I have only > one box here to test on. Hi Andrew, The patch is not correct. The interface index (ifp->if_index) has no relation to the ith ethernet interface. The latter is what the index variable is keeping track of. Take for example the case where a Linux program uses interface "eth0" and the first interface (ifp->if_index == 0) is not an ethernet i/f. With your patch the ioctl will fail due to there not being an eth. i/f with index 0. The original code will work as it will return the first ethernet i/f. This all assume there's ar least one ethernet i/f. Can you tell me what's causing the original code to fail in your case, or why you thought it needed fixing? > --- linux_ioctl.c.orig Sun Jan 6 21:40:10 2002 > +++ linux_ioctl.c Sun Jan 6 21:40:45 2002 > @@ -1381,7 +1381,7 @@ > struct ifnet *ifp; > int len, unit; > char *ep; > - int is_eth, index; > + int is_eth; > > for (len = 0; len < LINUX_IFNAMSIZ; ++len) > if (!isalpha(lxname[len])) > @@ -1391,7 +1391,6 @@ > 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) { > /* > @@ -1402,7 +1401,7 @@ > if (ifp->if_unit == unit && ifp->if_name[len] == '\0' > && > strncmp(ifp->if_name, lxname, len) == 0) > break; > - if (is_eth && IFP_IS_ETH(ifp) && unit == index++) > + if (is_eth && IFP_IS_ETH(ifp) && unit == ifp->if_index) > break; > } > if (ifp != NULL) -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message