From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 26 13:21:38 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F0971065670 for ; Fri, 26 Aug 2011 13:21:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 77EC48FC16 for ; Fri, 26 Aug 2011 13:21:38 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id D624146B0D; Fri, 26 Aug 2011 09:21:37 -0400 (EDT) Date: Fri, 26 Aug 2011 14:21:37 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Monthadar Al Jaberi In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: Dynamic kernel module linking problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2011 13:21:38 -0000 On Fri, 26 Aug 2011, Monthadar Al Jaberi wrote: > I have written a dynamic loadable module using DECLARE_MODULE in > FreeBSD-Current. > > And I want to iterate through the ifnet list using following code snippet: If this is on a recent version of FreeBSD (8.x and later), then you probably mean to be using V_ifnet, and you should include if_var.h rather than using an extern in order to ensure virtualisation is handled properly. Robert > > extern struct ifnethead ifnet; > ... > struct ifnet *ifp, *ifp_temp; > TAILQ_FOREACH_SAFE(ifp, &ifnet, if_link, ifp_temp) { > printf("%s\n", ifp->if_dname); > } > > Compilation is fine, but when I load the module I get the following error: > > ... > /sbin/kldload -v module.ko > link_elf: symbol ifnet undefined > ... > > What am I doing wrong? Shouldn't kernel be able to link it on its own? > > Grateful for any advice. > -- > //Monthadar Al Jaberi > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >