core: Include <linux/if.h> instead of <net/if.h>
authorThomas Graf <tgraf@redhat.com>
Fri, 23 Sep 2011 11:46:41 +0000 (13:46 +0200)
committerDan Williams <dcbw@redhat.com>
Fri, 30 Sep 2011 05:18:24 +0000 (00:18 -0500)
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>

include/wireless-helper.h
src/nm-device.c
src/nm-system.c
src/ppp-manager/nm-ppp-manager.c
src/settings/plugins/ifcfg-rh/reader.c
src/wimax/iwmxsdk.c
src/wimax/nm-device-wimax.c

index d150ef7..2e4509a 100644 (file)
@@ -27,6 +27,6 @@
 #include <sys/types.h>
 #include <linux/types.h>
 #include <sys/socket.h>
-#include <net/if.h>
+#include <linux/if.h>
 #include <wireless.h>
 
index c0b1b87..559606c 100644 (file)
@@ -25,7 +25,6 @@
 #include <dbus/dbus.h>
 #include <netinet/in.h>
 #include <string.h>
-#include <net/if.h>
 #include <unistd.h>
 #include <errno.h>
 #include <sys/ioctl.h>
@@ -34,6 +33,7 @@
 #include <sys/wait.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
+#include <linux/if.h>
 
 #include "nm-glib-compat.h"
 #include "nm-device-interface.h"
index 0b29468..473fcec 100644 (file)
@@ -40,7 +40,7 @@
 #include <netdb.h>
 #include <glib.h>
 #include <ctype.h>
-#include <net/if.h>
+#include <linux/if.h>
 
 #include "nm-system.h"
 #include "nm-device.h"
index 522c075..3546f8d 100644 (file)
@@ -32,7 +32,7 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <asm/types.h>
-#include <net/if.h>
+#include <linux/if.h>
 #include <sys/stat.h>
 
 #include <linux/ppp_defs.h>
index 691a176..910cca3 100644 (file)
 #include <ctype.h>
 #include <sys/inotify.h>
 #include <errno.h>
-#include <net/if.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <netinet/ether.h>
+#include <linux/if.h>
 
 #ifndef __user
 #define __user
index ff6b553..9c3a78b 100644 (file)
@@ -27,7 +27,8 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <net/if.h>
+#include <sys/socket.h>
+#include <linux/if.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)
 {
-       int ifindex;
        struct wmxsdk *wmxsdk;
        const char *s;
 
        if (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) {
                nm_log_err(LOGD_WIMAX, "BUG! device index %u already enumerated?", idx);
-               goto error_bug;
+               return;
        }
 
        wmxsdk = wmxsdk_new();
        if (wmxsdk == NULL) {
                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) {
                nm_log_err(LOGD_WIMAX, "Cannot extract network interface name off '%s'",
                              name);
-               goto error_noifname;
+               goto error;
        }
        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));
        wmxsdk->device_id.privilege = WIMAX_API_PRIVILEGE_READ_WRITE;
        wmxsdk->device_id.deviceIndex = api_idx;
 
        if (iwmx_sdk_setup(wmxsdk) != 0) {
                nm_log_err(LOGD_WIMAX, "wxmsdk: %s: cannot set up interface", wmxsdk->ifname);
-               goto error_setup;
+               goto error;
        }
 
        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);
        return;
 
-error_setup:
-error_noifname:
+error:
        wmxsdk_unref(wmxsdk);
-error_bug:
        return;
 }
 
index b6afc27..6654140 100644 (file)
@@ -23,7 +23,8 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <net/ethernet.h>
-#include <net/if.h>
+#include <sys/socket.h>
+#include <linux/if.h>
 
 #include <WiMaxAPI.h>
 #include <WiMaxAPIEx.h>