[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: Dynamic kernel module linking problem
From:       Robert Watson <rwatson () freebsd ! org>
Date:       2011-08-26 13:21:37
Message-ID: alpine.BSF.2.00.1108261419390.36226 () fledge ! watson ! org
[Download RAW message or body]


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"
>
_______________________________________________
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"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic