From owner-freebsd-current@FreeBSD.ORG Thu Aug 12 07:59:34 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B50516A4CE for ; Thu, 12 Aug 2004 07:59:34 +0000 (GMT) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF17143D2F for ; Thu, 12 Aug 2004 07:59:32 +0000 (GMT) (envelope-from glebius@freebsd.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.11/8.12.8) with ESMTP id i7C7xSYK021250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 12 Aug 2004 11:59:29 +0400 (MSD) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.sick.ru (8.12.11/8.12.11/Submit) id i7C7xS27021249 for current@freebsd.org; Thu, 12 Aug 2004 11:59:28 +0400 (MSD) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@freebsd.org using -f Date: Thu, 12 Aug 2004 11:59:28 +0400 From: Gleb Smirnoff To: current@freebsd.org Message-ID: <20040812075928.GA21205@cell.sick.ru> References: <20040812075053.GA21129@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20040812075053.GA21129@cell.sick.ru> User-Agent: Mutt/1.5.6i Subject: if_index in struct ifnet broken in recent CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 07:59:34 -0000 Hmm, some more information: actually if_index is broken not only in in mbuf packet headers. This code with different addresses: bzero((caddr_t)&ro, sizeof(ro)); sin = (struct sockaddr_in *)&ro.ro_dst; sin->sin_len = sizeof(*sin); sin->sin_family = AF_INET; sin->sin_addr = \\some address\\; rtalloc_ign(&ro, RTF_CLONING); if (ro.ro_rt != NULL) { struct rtentry *rt = ro.ro_rt; printf("rt idx %d, name %s\n", rt->rt_ifp->if_index, rt->rt_ifp->if_xname); produces rt idx 0, name fxp0 rt idx 0, name lo0 On Thu, Aug 12, 2004 at 11:50:53AM +0400, Gleb Smirnoff wrote: T> I can see this at least in fxp driver: if I capture packets using T> ng_ether(4), and check interface name like this T> T> printf("idx %d, name %s\n", T> (*m)->m_pkthdr.rcvif->if_index, T> (*m)->m_pkthdr.rcvif->if_xname); T> I get on console: T> T> idx 0, name fxp0 T> T> Really fxp's index is 1 (AFAIK if_index must be > 0), I have checked this T> using if_nametoindex() from userland. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE