Date: Sun, 6 Jan 2002 21:49:23 -0800 From: Marcel Moolenaar <marcel@xcllnt.net> To: Andrew Atrens <andrew_atrens@yahoo.ca> Cc: stable@freebsd.org Subject: Re: small fix for sys/compat/linux/linux_ioctl.c Message-ID: <20020106214923.A2879@dhcp01.pn.xcllnt.net> In-Reply-To: <20020107045140.16097.qmail@web11305.mail.yahoo.com> References: <20020107045140.16097.qmail@web11305.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020106214923.A2879>