core: Include <linux/if.h> instead of <net/if.h>

NM already includes <linux/if.h> in some places, f.e. nm-netlink-monitor and
we can't mix usage of the two. Stick to using <linux/if.h> as it provides
additional flag definitions such as operational link state and link mode.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
This commit is contained in:
Thomas Graf
2011-09-23 13:46:41 +02:00
committed by Dan Williams
parent 61099e30f6
commit 00f2b0a9bb
7 changed files with 15 additions and 22 deletions

View File

@@ -27,6 +27,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <linux/types.h> #include <linux/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <linux/if.h>
#include <wireless.h> #include <wireless.h>

View File

@@ -25,7 +25,6 @@
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <string.h> #include <string.h>
#include <net/if.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@@ -34,6 +33,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <fcntl.h> #include <fcntl.h>
#include <linux/if.h>
#include "nm-glib-compat.h" #include "nm-glib-compat.h"
#include "nm-device-interface.h" #include "nm-device-interface.h"

View File

@@ -40,7 +40,7 @@
#include <netdb.h> #include <netdb.h>
#include <glib.h> #include <glib.h>
#include <ctype.h> #include <ctype.h>
#include <net/if.h> #include <linux/if.h>
#include "nm-system.h" #include "nm-system.h"
#include "nm-device.h" #include "nm-device.h"

View File

@@ -32,7 +32,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <asm/types.h> #include <asm/types.h>
#include <net/if.h> #include <linux/if.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <linux/ppp_defs.h> #include <linux/ppp_defs.h>

View File

@@ -28,10 +28,10 @@
#include <ctype.h> #include <ctype.h>
#include <sys/inotify.h> #include <sys/inotify.h>
#include <errno.h> #include <errno.h>
#include <net/if.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h> #include <unistd.h>
#include <netinet/ether.h> #include <netinet/ether.h>
#include <linux/if.h>
#ifndef __user #ifndef __user
#define __user #define __user

View File

@@ -27,7 +27,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <net/if.h> #include <sys/socket.h>
#include <linux/if.h>
#include <glib.h> #include <glib.h>
@@ -1315,23 +1316,22 @@ void wmxsdk_unref(struct wmxsdk *wmxsdk)
static void iwmx_sdk_dev_add(unsigned idx, unsigned api_idx, const char *name) static void iwmx_sdk_dev_add(unsigned idx, unsigned api_idx, const char *name)
{ {
int ifindex;
struct wmxsdk *wmxsdk; struct wmxsdk *wmxsdk;
const char *s; const char *s;
if (idx >= IWMX_SDK_DEV_MAX) { if (idx >= IWMX_SDK_DEV_MAX) {
nm_log_err(LOGD_WIMAX, "BUG! idx (%u) >= IWMX_SDK_DEV_MAX (%u)", idx, IWMX_SDK_DEV_MAX); nm_log_err(LOGD_WIMAX, "BUG! idx (%u) >= IWMX_SDK_DEV_MAX (%u)", idx, IWMX_SDK_DEV_MAX);
goto error_bug; return;
} }
if (g_iwmx_sdk_devs[idx] != NULL) { if (g_iwmx_sdk_devs[idx] != NULL) {
nm_log_err(LOGD_WIMAX, "BUG! device index %u already enumerated?", idx); nm_log_err(LOGD_WIMAX, "BUG! device index %u already enumerated?", idx);
goto error_bug; return;
} }
wmxsdk = wmxsdk_new(); wmxsdk = wmxsdk_new();
if (wmxsdk == NULL) { if (wmxsdk == NULL) {
nm_log_err(LOGD_WIMAX, "Can't allocate %zu bytes", sizeof(*wmxsdk)); nm_log_err(LOGD_WIMAX, "Can't allocate %zu bytes", sizeof(*wmxsdk));
goto error_bug; return;
} }
/* /*
@@ -1344,23 +1344,17 @@ static void iwmx_sdk_dev_add(unsigned idx, unsigned api_idx, const char *name)
|| sscanf(s, "if:%15[^ \f\n\r\t\v]", wmxsdk->ifname) != 1) { || sscanf(s, "if:%15[^ \f\n\r\t\v]", wmxsdk->ifname) != 1) {
nm_log_err(LOGD_WIMAX, "Cannot extract network interface name off '%s'", nm_log_err(LOGD_WIMAX, "Cannot extract network interface name off '%s'",
name); name);
goto error_noifname; goto error;
} }
nm_log_dbg(LOGD_WIMAX, "network interface name: '%s'", wmxsdk->ifname); nm_log_dbg(LOGD_WIMAX, "network interface name: '%s'", wmxsdk->ifname);
ifindex = if_nametoindex(wmxsdk->ifname);
if (ifindex <= 0) {
nm_log_err(LOGD_WIMAX, "wxmsdk: %s: cannot find interface index", wmxsdk->ifname);
goto error_noifname;
}
strncpy(wmxsdk->name, name, sizeof(wmxsdk->name)); strncpy(wmxsdk->name, name, sizeof(wmxsdk->name));
wmxsdk->device_id.privilege = WIMAX_API_PRIVILEGE_READ_WRITE; wmxsdk->device_id.privilege = WIMAX_API_PRIVILEGE_READ_WRITE;
wmxsdk->device_id.deviceIndex = api_idx; wmxsdk->device_id.deviceIndex = api_idx;
if (iwmx_sdk_setup(wmxsdk) != 0) { if (iwmx_sdk_setup(wmxsdk) != 0) {
nm_log_err(LOGD_WIMAX, "wxmsdk: %s: cannot set up interface", wmxsdk->ifname); nm_log_err(LOGD_WIMAX, "wxmsdk: %s: cannot set up interface", wmxsdk->ifname);
goto error_setup; goto error;
} }
g_iwmx_sdk_devs[idx] = wmxsdk; g_iwmx_sdk_devs[idx] = wmxsdk;
@@ -1369,10 +1363,8 @@ static void iwmx_sdk_dev_add(unsigned idx, unsigned api_idx, const char *name)
iwmx_sdk_call_new_callbacks (wmxsdk); iwmx_sdk_call_new_callbacks (wmxsdk);
return; return;
error_setup: error:
error_noifname:
wmxsdk_unref(wmxsdk); wmxsdk_unref(wmxsdk);
error_bug:
return; return;
} }

View File

@@ -23,7 +23,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <net/ethernet.h> #include <net/ethernet.h>
#include <net/if.h> #include <sys/socket.h>
#include <linux/if.h>
#include <WiMaxAPI.h> #include <WiMaxAPI.h>
#include <WiMaxAPIEx.h> #include <WiMaxAPIEx.h>