[PATCH v2] genl: modify genl_ctrl_resolve and friends to allow for module auto-loading

Neil Horman nhorman at tuxdriver.com
Sun Jun 3 12:29:17 EDT 2012


On Sun, Jun 03, 2012 at 07:59:59AM -0400, Thomas Graf wrote:
> On Fri, Jun 01, 2012 at 12:59:24PM -0400, Neil Horman wrote:
> > Generic netlink has the ability to autoload modules in response to a request for
> > a family.  Currently libnl uses a GETFAMILY call with the NLM_F_DUMP flag to
> > list all the available families, but doing so neglects the possibility of an
> > autoloaded module.  This patch modifies the genl code to probe the kernel for a
> > specific family rather than dumping a list of all the currenlty available ones,
> > making autoload work properly.
> 
> Applied, thanks Neil!
> 
> I took the liberty to slightly modify the patch. I hope you don't mind.
> 
> I changed genl_ctrl_probe_by_name() to create a clone of the socket cb
> structure instead of modying it directly. This avoids overwriting the
> NL_CB_VALID callback a user might have set on the socket.
> 
> I moved the mcast parsing code into its own function to share it with
> the msg_parser() function.
> 
> I added a small test case to tests/test-genl.c to run genl_ctrl_resolve()
> and make sure it works.
> 
> Maybe you can have a quick look over the new patch and yell if you
> disagree with anything
> 
Ack, thanks Thomas, this looks great to me.  I hadn't considered the possibility
of sharing code with msg_parser or overwriting the callback structs.

Thanks!
Neil



More information about the libnl mailing list