Skip to contentSkip to conversation

ipvs: fix header inline net_ipvs function to work without CONFIG_IP_VS

PATCH In review Rafał Miłecki 3 participants 8 messages Mar 25, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipvs: fix header inline net_ipvs function to work without CONFIG_IP_VS

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")
---
 include/net/ip_vs.h | 3 +++
 1 file changed, 3 insertions(+)
include/net/ip_vs.h +3 -0
index 615b20b..cd3942f 100644
@@ -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
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 15 lines · Rafał Miłecki

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")
---
  include/net/ip_vs.h | 3 +++
  1 file changed, 3 insertions(+)
include/net/ip_vs.h +0 -0
index 615b20b..cd3942f 100644

include/net/ip_vs.h line 39

Quoted 8 lines
include/net/ip_vs.h +3 -0
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH v2 1/1 ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

In reply to Rafał Miłecki

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")

---
V2: Disable function totally instead of returning NULL.

---
 include/net/ip_vs.h | 2 ++
 1 file changed, 2 insertions(+)
include/net/ip_vs.h +2 -0
index 615b20b..e6f2f2a 100644
@@ -29,11 +29,13 @@
 #endif
 #include <net/net_namespace.h>		/* Netw namespace */
 
+#if IS_ENABLED(CONFIG_IP_VS)
 /* Generic access of ipvs struct */
 static inline struct netns_ipvs *net_ipvs(struct net* net)
 {
 	return net->ipvs;
 }
+#endif
 
 /* Get net ptr from skb in traffic cases
  * use skb_sknet when call is from userland (ioctl or netlink)
Signature · 6 lines
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

Re: [PATCH V2] ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

Quoted 17 lines · Rafał Miłecki

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")

---
V2: Disable function totally instead of returning NULL.

---
  include/net/ip_vs.h | 2 ++
  1 file changed, 2 insertions(+)
include/net/ip_vs.h +0 -0
index 615b20b..e6f2f2a 100644

include/net/ip_vs.h line 38

Quoted 10 lines
include/net/ip_vs.h +2 -0
@@ -29,11 +29,13 @@
  #endif
  #include <net/net_namespace.h>		/* Netw namespace */
 
+#if IS_ENABLED(CONFIG_IP_VS)
  /* Generic access of ipvs struct */
  static inline struct netns_ipvs *net_ipvs(struct net* net)
  {
  	return net->ipvs;
  }
+#endif

Ok, but this fix nothing, there is no bug upstream. This file is only included by ipvs module files.
For me, it's a bit strange to have '#ifdef CONFIG_IP_VS' in a file specific to this module. This just fix your third party module.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH V2] ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

Quoted 23 lines · Nicolas Dichtel
Quoted 22 lines · Rafał Miłecki

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")

---
V2: Disable function totally instead of returning NULL.

---
  include/net/ip_vs.h | 2 ++
  1 file changed, 2 insertions(+)
include/net/ip_vs.h +0 -0
index 615b20b..e6f2f2a 100644
@@ -29,11 +29,13 @@
  #endif
  #include <net/net_namespace.h>                /* Netw namespace */
 
Quoted 11 lines

include/net/ip_vs.h line 38

Quoted 7 lines
include/net/ip_vs.h +2 -0
+#if IS_ENABLED(CONFIG_IP_VS)
  /* Generic access of ipvs struct */
  static inline struct netns_ipvs *net_ipvs(struct net* net)
  {
        return net->ipvs;
  }
+#endif

Ok, but this fix nothing, there is no bug upstream. This file is only included
by ipvs module files.

So maybe it should be moved to net/netfilter/ipvs/?

Quoted 3 lines

For me, it's a bit strange to have '#ifdef CONFIG_IP_VS' in a file specific to
this module. This just fix your third party module.

Will do. I was just thinking this header doesn't follow headers logic well and wanted to help.

Signature · 5 lines
Rafał
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

Re: [PATCH V2] ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

Quoted 1 line · Rafał Miłecki

On 25 March 2015 at 11:25, Nicolas Dichtel <[email protected]> wrote:

[snip]

Quoted 7 lines
Quoted 3 lines

For me, it's a bit strange to have '#ifdef CONFIG_IP_VS' in a file specific to
this module. This just fix your third party module.

Will do. I was just thinking this header doesn't follow headers logic well and wanted to help.

The logic is to fix bug that are in-tree ;-)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw

Re: [PATCH V2] ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

In reply to Julian Anastasov
Quoted 14 lines · Julian Anastasov

Hello,

Quoted 8 lines · Rafał Miłecki

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")

---
V2: Disable function totally instead of returning NULL.

Quoted 4 lines

While this version is better, the commit message
looks scary, it should explain that problem happens only for modules out of kernel tree, we do not want other admins to wonder whether they need this commit for their trees.

OK, I just need some decision if you want/need this patch at all and if I should send another version.

Quoted 2 lines

And of course, it is better to implement your
own ip_vs_check_diff4 version, it is some inline stuff...

I did.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#6 lore raw

Re: [PATCH V2] ipvs: disable inline net_ipvs function with CONFIG_IP_VS not being set

In reply to Rafał Miłecki

Hello,

Quoted 8 lines · Rafał Miłecki

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")

---
V2: Disable function totally instead of returning NULL.

While this version is better, the commit message
looks scary, it should explain that problem happens only for modules out of kernel tree, we do not want other admins to wonder whether they need this commit for their trees.

And of course, it is better to implement your
own ip_vs_check_diff4 version, it is some inline stuff...

Quoted 24 lines
---
 include/net/ip_vs.h | 2 ++
 1 file changed, 2 insertions(+)
include/net/ip_vs.h +2 -0
index 615b20b..e6f2f2a 100644
@@ -29,11 +29,13 @@
 #endif
 #include <net/net_namespace.h>		/* Netw namespace */
 
+#if IS_ENABLED(CONFIG_IP_VS)
 /* Generic access of ipvs struct */
 static inline struct netns_ipvs *net_ipvs(struct net* net)
 {
 	return net->ipvs;
 }
+#endif
 
 /* Get net ptr from skb in traffic cases
  * use skb_sknet when call is from userland (ioctl or netlink)
Signature · 1 line
1.8.4.5

Regards

--
Julian Anastasov <[email protected]>