Search Linux Wireless

[PATCH] iw: add kernel version checks for pending upstream kernel features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add checks for kernel version to enable features in the iw tool.  This
allows packagers to get pre-package the tool without requiring precise
timing to stage the tool into their distributions.

Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>
---
 info.c |    4 ++++
 reg.c  |    6 ++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/info.c b/info.c
index 0dc05c1..4b7d191 100644
--- a/info.c
+++ b/info.c
@@ -1,4 +1,5 @@
 #include <errno.h>
+#include <linux/version.h>
 #include <linux/nl80211.h>
 #include <net/if.h>
 
@@ -105,12 +106,15 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 		}
 	}
 
+/* This funcionality first appears "officially" in 2.6.28... */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
 	if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES])
 		return NL_SKIP;
 
 	printf("\tSupported interface modes:\n");
 	nla_for_each_nested(nl_mode, tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES], rem_mode)
 		printf("\t\t * %s\n", iftype_name(nl_mode->nla_type));
+#endif
 
 	return NL_SKIP;
 }
diff --git a/reg.c b/reg.c
index 2892117..ce039ae 100644
--- a/reg.c
+++ b/reg.c
@@ -1,3 +1,4 @@
+#include <linux/version.h>
 #include <linux/nl80211.h>
 #include <net/if.h>
 #include <errno.h>
@@ -11,6 +12,9 @@
 
 #include "iw.h"
 
+/* This funcionality first appears "officially" in 2.6.28... */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
+
 int isalpha_upper(char letter)
 {
 	if (letter >= 65 && letter <= 90)
@@ -67,3 +71,5 @@ static int handle_reg_set(struct nl_cb *cb,
 }
 COMMAND(reg, set, "<ISO/IEC 3166-1 alpha2>",
 	NL80211_CMD_REQ_SET_REG, 0, CIB_NONE, handle_reg_set);
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28) */
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux