From 7f717f905b0bb847fd490819fbd0d2d580dbbb6b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 9 Mar 2012 12:20:42 -0600 Subject: [PATCH] build: make VLAN code compatible with older kernels Apparently VLAN_FLAG_LOOSE_BINDING isn't in older kernels like 2.6.32. --- configure.ac | 22 ++++++++++++++++++++++ src/nm-system.c | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac index 06b344118c..9a3f4df86e 100644 --- a/configure.ac +++ b/configure.ac @@ -261,6 +261,28 @@ if test "$ac_have_nl80211" = no; then AC_MSG_ERROR(Linux kernel development header linux/nl80211.h not installed or not functional) fi +dnl +dnl Default to using WEXT but allow it to be disabled +dnl +AC_MSG_CHECKING([Linux kernel VLAN_FLAG_LOOSE_BINDING enum value]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#ifndef __user + #define __user + #endif + #include + #include + #include ]], + [[unsigned int a = VLAN_FLAG_LOOSE_BINDING;]])], + [ac_have_vlan_flag_loose_binding=yes], + [ac_have_vlan_flag_loose_binding=no]) +AC_MSG_RESULT($ac_have_vlan_flag_loose_binding) +if test "$ac_have_vlan_flag_loose_binding" = yes; then + AC_DEFINE(HAVE_VLAN_FLAG_LOOSE_BINDING, 1, [Define if you have VLAN_FLAG_LOOSE_BINDING]) +else + AC_DEFINE(HAVE_VLAN_FLAG_LOOSE_BINDING, 0, [Define if you have VLAN_FLAG_LOOSE_BINDING]) +fi + dnl dnl Checks for libm - needed for pow() dnl diff --git a/src/nm-system.c b/src/nm-system.c index 877c95d37e..e15b85b227 100644 --- a/src/nm-system.c +++ b/src/nm-system.c @@ -65,6 +65,11 @@ #include #endif +#if !HAVE_VLAN_FLAG_LOOSE_BINDING +/* Older kernels don't have this flag */ +#define VLAN_FLAG_LOOSE_BINDING 0x04 +#endif + static void nm_system_device_set_priority (int ifindex, NMIP4Config *config, int priority);