All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tunnels: correct conditional build of MPLS
@ 2016-07-10  0:20 Simon Horman
  2016-07-10  1:12 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Horman @ 2016-07-10  0:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Simon Horman

* If MPLS is not enabled then err_mpls is not needed
* If IPV6 is not enabled then unregistering IPPROTO_IPV6 is not
  needed in the error path and err_ipv6 is not needed
* When unregistering IPPROTO_IPV6 the tunnel64_protocol structure
  rather than the tunnel4_protocol structure should be used.
* If neither MPLS nor IPV6 are enabled then unregistering IPPROTO_IPIP
  is not needed in the error path

Fixes: 8afe97e5d416 ("tunnels: support MPLS over IPv4 tunnels")
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
 net/ipv4/tunnel4.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index 45cd4253583a..1dd098b890a7 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -219,12 +219,16 @@ static int __init tunnel4_init(void)
 #endif
 	return 0;
 
-#if IS_ENABLED(CONFIG_IPV6)
+#if IS_ENABLED(CONFIG_MPLS)
 err_mpls:
-	inet_del_protocol(&tunnel4_protocol, IPPROTO_IPV6);
 #endif
+#if IS_ENABLED(CONFIG_IPV6)
+	inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6);
 err_ipv6:
+#endif
+#if IS_ENABLED(CONFIG_MPLS) || IS_ENABLED(CONFIG_IPV6)
 	inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP);
+#endif
 err_ipip:
 	pr_err("%s: can't add protocol\n", __func__);
 	return -EAGAIN;
-- 
2.7.0.rc3.207.g0ac5344

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tunnels: correct conditional build of MPLS
  2016-07-10  0:20 [PATCH] tunnels: correct conditional build of MPLS Simon Horman
@ 2016-07-10  1:12 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2016-07-10  1:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Sun, Jul 10, 2016 at 09:20:54AM +0900, Simon Horman wrote:
> * If MPLS is not enabled then err_mpls is not needed
> * If IPV6 is not enabled then unregistering IPPROTO_IPV6 is not
>   needed in the error path and err_ipv6 is not needed
> * When unregistering IPPROTO_IPV6 the tunnel64_protocol structure
>   rather than the tunnel4_protocol structure should be used.
> * If neither MPLS nor IPV6 are enabled then unregistering IPPROTO_IPIP
>   is not needed in the error path
> 
> Fixes: 8afe97e5d416 ("tunnels: support MPLS over IPv4 tunnels")
> Signed-off-by: Simon Horman <simon.horman@netronome.com>

I realised this still has some problems. I will send v2.

> ---
>  net/ipv4/tunnel4.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
> index 45cd4253583a..1dd098b890a7 100644
> --- a/net/ipv4/tunnel4.c
> +++ b/net/ipv4/tunnel4.c
> @@ -219,12 +219,16 @@ static int __init tunnel4_init(void)
>  #endif
>  	return 0;
>  
> -#if IS_ENABLED(CONFIG_IPV6)
> +#if IS_ENABLED(CONFIG_MPLS)
>  err_mpls:
> -	inet_del_protocol(&tunnel4_protocol, IPPROTO_IPV6);
>  #endif
> +#if IS_ENABLED(CONFIG_IPV6)
> +	inet_del_protocol(&tunnel64_protocol, IPPROTO_IPV6);
>  err_ipv6:
> +#endif
> +#if IS_ENABLED(CONFIG_MPLS) || IS_ENABLED(CONFIG_IPV6)
>  	inet_del_protocol(&tunnel4_protocol, IPPROTO_IPIP);
> +#endif
>  err_ipip:
>  	pr_err("%s: can't add protocol\n", __func__);
>  	return -EAGAIN;
> -- 
> 2.7.0.rc3.207.g0ac5344
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-10  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-10  0:20 [PATCH] tunnels: correct conditional build of MPLS Simon Horman
2016-07-10  1:12 ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.