build: avoid header conflict for <linux/if.h> and <net/if.h> with "nm-platform.h"

In the past, the headers "linux/if.h" and "net/if.h" were incompatible.
That means, we can either include one or the other, but not both.
This is fixed in the meantime, however the issue still exists when
building against older kernel/glibc.

That means, including one of these headers from a header file
is problematic. In particular if it's a header like "nm-platform.h",
which itself is dragged in by many other headers.

Avoid that by not including these headers from "platform.h", but instead
from the source files where needed (or possibly from less popular header
files).

Currently there is no problem. However, this allows an unknowing user to
include <net/if.h> at the same time with "nm-platform.h", which is easy
to get wrong.
This commit is contained in:
Thomas Haller
2018-11-12 15:23:36 +01:00
parent 45e54840db
commit 37e47fbdab
16 changed files with 29 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
#include <netdb.h>
#include <string.h>
#include <linux/ip.h>
#include <linux/if.h>
#include <linux/if_tun.h>
#include <linux/if_tunnel.h>
#include <linux/rtnetlink.h>