From 3569d18f47f49c115d80033a3661ad31c13d06c9 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Sun, 30 Jan 2011 16:01:56 -0800 Subject: [PATCH] datapath: Avoid nla_parse_nested const warning on < 2.6.22. We mark our Netlink policies as const for safety but the argument to nla_parse_nested didn't become const until 2.6.22, which provokes warnings. This casts away the constness on affected kernels to avoid the warnings. Reported-by: Justin Pettit Signed-off-by: Jesse Gross --- datapath/linux-2.6/compat-2.6/include/net/netlink.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datapath/linux-2.6/compat-2.6/include/net/netlink.h b/datapath/linux-2.6/compat-2.6/include/net/netlink.h index f4fb8437..0f881f1c 100644 --- a/datapath/linux-2.6/compat-2.6/include/net/netlink.h +++ b/datapath/linux-2.6/compat-2.6/include/net/netlink.h @@ -111,7 +111,10 @@ static inline int nla_type(const struct nlattr *nla) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) +#define nla_parse_nested(tb, maxtype, nla, policy) \ + nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), (struct nla_policy *)(policy)) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) #define nla_parse_nested(tb, maxtype, nla, policy) \ nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), policy) #endif -- 2.30.2