[PATCH]Remove unneeded header inclusion
Thomas Graf
tgraf at infradead.org
Tue Apr 24 05:51:38 EDT 2012
On Mon, Apr 23, 2012 at 03:57:00PM +0200, Nicolas CARRIER wrote:
> By digging in the mailing list archive, I found that I erroneously posted a patch into a non-related discussion.
> Hence I start a new thread to give it more visibility.
> Please forgive me for the inconvenience,
>
> Here comes the original message :
>
> Hello,
> When using libnl, one can't include both netlink/route/link.h and net/if.h because it leads to structure redefinitions :
> ...
> /usr/include/linux/if.h:137:8: error: redefinition of 'struct ifmap'
> /usr/include/net/if.h:112:8: note: originally defined here
> ...
>
> The attached patch removes the unneeded linux/if.h inclusion from netlink/route/link.h and fixed the problem for me.
> It should apply to the current master's HEAD.
>
> Note that I'm no libnl specialist and hence not sure this is the right way to achieve it...
This is an known problem. The problem is that <net/if.h> does not
provide all the flag definitions that <linux/if.h> provides.
Seeing all the trouble it causes, it would be wise to remove the
include and make the application responsible for including the
approporiate header file.
The problem with doing so is that it might break existing code which
relies on that include.
More information about the libnl
mailing list