diff mbox

ipvs: fix header inline net_ipvs function to work without CONFIG_IP_VS

Message ID 1427273637-29151-1-git-send-email-zajec5@gmail.com
State RFC
Delegated to: Pablo Neira
Headers show

Commit Message

Rafał Miłecki March 25, 2015, 8:53 a.m. UTC
Including net/ip_vs.h without CONFIG_IP_VS was causing:
include/net/ip_vs.h: In function 'net_ipvs':
include/net/ip_vs.h:35:12: error: 'struct net' has no member named 'ipvs'

Fixes: 8b4d14d8eb368 ("netns: exclude ipvs from struct net when IPVS disabled")
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 include/net/ip_vs.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicolas Dichtel March 25, 2015, 9:03 a.m. UTC | #1
Le 25/03/2015 09:53, Rafał Miłecki a écrit :
> Including net/ip_vs.h without CONFIG_IP_VS was causing:
> include/net/ip_vs.h: In function 'net_ipvs':
> include/net/ip_vs.h:35:12: error: 'struct net' has no member named 'ipvs'
>
> Fixes: 8b4d14d8eb368 ("netns: exclude ipvs from struct net when IPVS disabled")
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>   include/net/ip_vs.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index 615b20b..cd3942f 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -32,7 +32,10 @@
>   /* Generic access of ipvs struct */
>   static inline struct netns_ipvs *net_ipvs(struct net* net)
>   {
> +#if IS_ENABLED(CONFIG_IP_VS)
>   	return net->ipvs;
> +#endif
> +	return NULL;
>   }
This function is used only by the ipvs module, maybe it should be defined only
when CONFIG_IP_VS is set?

Anyway, it must not return NULL, all callers assume that the pointer is valid.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 615b20b..cd3942f 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -32,7 +32,10 @@ 
 /* Generic access of ipvs struct */
 static inline struct netns_ipvs *net_ipvs(struct net* net)
 {
+#if IS_ENABLED(CONFIG_IP_VS)
 	return net->ipvs;
+#endif
+	return NULL;
 }
 
 /* Get net ptr from skb in traffic cases