linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] netlabel: Fix build problems when IPv6 is not enabled
@ 2011-11-29 20:10 Paul Moore
  2011-11-29 22:00 ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2011-11-29 20:10 UTC (permalink / raw)
  To: netdev, rdunlap; +Cc: linux-next, linux-kernel

A recent fix to the the NetLabel code caused build problem with
configurations that did not have IPv6 enabled; see below:

 netlabel_kapi.c: In function 'netlbl_cfg_unlbl_map_add':
 netlabel_kapi.c:165:4:
  error: implicit declaration of function 'netlbl_af6list_add'

This patch fixes this problem by making the IPv6 specific code conditional
on the IPv6 configuration flags as we done in the rest of NetLabel and the
network stack as a whole.  We have to move some variable declarations
around as a result so things may not be quite as pretty, but at least it
builds cleanly now.

Some additional IPv6 conditionals were added to the NetLabel code as well
for the sake of consistency.

Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
 net/netlabel/netlabel_kapi.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 3735297..5952237 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
 	struct netlbl_domaddr_map *addrmap = NULL;
 	struct netlbl_domaddr4_map *map4 = NULL;
 	struct netlbl_domaddr6_map *map6 = NULL;
-	const struct in_addr *addr4, *mask4;
-	const struct in6_addr *addr6, *mask6;
 
 	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
 	if (entry == NULL)
@@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
 		INIT_LIST_HEAD(&addrmap->list6);
 
 		switch (family) {
-		case AF_INET:
-			addr4 = addr;
-			mask4 = mask;
+		case AF_INET: {
+			const struct in_addr *addr4 = addr;
+			const struct in_addr *mask4 = mask;
 			map4 = kzalloc(sizeof(*map4), GFP_ATOMIC);
 			if (map4 == NULL)
 				goto cfg_unlbl_map_add_failure;
@@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
 			if (ret_val != 0)
 				goto cfg_unlbl_map_add_failure;
 			break;
-		case AF_INET6:
-			addr6 = addr;
-			mask6 = mask;
+			}
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+		case AF_INET6: {
+			const struct in6_addr *addr6 = addr;
+			const struct in6_addr *mask6 = mask;
 			map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
 			if (map6 == NULL)
 				goto cfg_unlbl_map_add_failure;
@@ -167,6 +167,8 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
 			if (ret_val != 0)
 				goto cfg_unlbl_map_add_failure;
 			break;
+			}
+#endif /* IPv6 */
 		default:
 			goto cfg_unlbl_map_add_failure;
 			break;
@@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net,
 	case AF_INET:
 		addr_len = sizeof(struct in_addr);
 		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 	case AF_INET6:
 		addr_len = sizeof(struct in6_addr);
 		break;
+#endif /* IPv6 */
 	default:
 		return -EPFNOSUPPORT;
 	}
@@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net,
 	case AF_INET:
 		addr_len = sizeof(struct in_addr);
 		break;
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 	case AF_INET6:
 		addr_len = sizeof(struct in6_addr);
 		break;
+#endif /* IPv6 */
 	default:
 		return -EPFNOSUPPORT;
 	}

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

* Re: [PATCH v2] netlabel: Fix build problems when IPv6 is not enabled
  2011-11-29 22:00 ` Randy Dunlap
@ 2011-11-29 21:49   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2011-11-29 21:49 UTC (permalink / raw)
  To: rdunlap; +Cc: pmoore, netdev, linux-next, linux-kernel

From: Randy Dunlap <rdunlap@xenotime.net>
Date: Tue, 29 Nov 2011 14:00:04 -0800

> On 11/29/2011 12:10 PM, Paul Moore wrote:
>> A recent fix to the the NetLabel code caused build problem with
>> configurations that did not have IPv6 enabled; see below:
>> 
>>  netlabel_kapi.c: In function 'netlbl_cfg_unlbl_map_add':
>>  netlabel_kapi.c:165:4:
>>   error: implicit declaration of function 'netlbl_af6list_add'
>> 
>> This patch fixes this problem by making the IPv6 specific code conditional
>> on the IPv6 configuration flags as we done in the rest of NetLabel and the
>> network stack as a whole.  We have to move some variable declarations
>> around as a result so things may not be quite as pretty, but at least it
>> builds cleanly now.
>> 
>> Some additional IPv6 conditionals were added to the NetLabel code as well
>> for the sake of consistency.
>> 
>> Reported-by: Randy Dunlap <rdunlap@xenotime.net>
>> Signed-off-by: Paul Moore <pmoore@redhat.com>
> 
> Acked-by: Randy Dunlap <rdunlap@xenotime.net>

Applied, thanks everyone.

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

* Re: [PATCH v2] netlabel: Fix build problems when IPv6 is not enabled
  2011-11-29 20:10 [PATCH v2] netlabel: Fix build problems when IPv6 is not enabled Paul Moore
@ 2011-11-29 22:00 ` Randy Dunlap
  2011-11-29 21:49   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2011-11-29 22:00 UTC (permalink / raw)
  To: Paul Moore; +Cc: netdev, linux-next, linux-kernel

On 11/29/2011 12:10 PM, Paul Moore wrote:
> A recent fix to the the NetLabel code caused build problem with
> configurations that did not have IPv6 enabled; see below:
> 
>  netlabel_kapi.c: In function 'netlbl_cfg_unlbl_map_add':
>  netlabel_kapi.c:165:4:
>   error: implicit declaration of function 'netlbl_af6list_add'
> 
> This patch fixes this problem by making the IPv6 specific code conditional
> on the IPv6 configuration flags as we done in the rest of NetLabel and the
> network stack as a whole.  We have to move some variable declarations
> around as a result so things may not be quite as pretty, but at least it
> builds cleanly now.
> 
> Some additional IPv6 conditionals were added to the NetLabel code as well
> for the sake of consistency.
> 
> Reported-by: Randy Dunlap <rdunlap@xenotime.net>
> Signed-off-by: Paul Moore <pmoore@redhat.com>

Acked-by: Randy Dunlap <rdunlap@xenotime.net>

Thanks.

> ---
>  net/netlabel/netlabel_kapi.c |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
> index 3735297..5952237 100644
> --- a/net/netlabel/netlabel_kapi.c
> +++ b/net/netlabel/netlabel_kapi.c
> @@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
>  	struct netlbl_domaddr_map *addrmap = NULL;
>  	struct netlbl_domaddr4_map *map4 = NULL;
>  	struct netlbl_domaddr6_map *map6 = NULL;
> -	const struct in_addr *addr4, *mask4;
> -	const struct in6_addr *addr6, *mask6;
>  
>  	entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
>  	if (entry == NULL)
> @@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
>  		INIT_LIST_HEAD(&addrmap->list6);
>  
>  		switch (family) {
> -		case AF_INET:
> -			addr4 = addr;
> -			mask4 = mask;
> +		case AF_INET: {
> +			const struct in_addr *addr4 = addr;
> +			const struct in_addr *mask4 = mask;
>  			map4 = kzalloc(sizeof(*map4), GFP_ATOMIC);
>  			if (map4 == NULL)
>  				goto cfg_unlbl_map_add_failure;
> @@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
>  			if (ret_val != 0)
>  				goto cfg_unlbl_map_add_failure;
>  			break;
> -		case AF_INET6:
> -			addr6 = addr;
> -			mask6 = mask;
> +			}
> +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
> +		case AF_INET6: {
> +			const struct in6_addr *addr6 = addr;
> +			const struct in6_addr *mask6 = mask;
>  			map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
>  			if (map6 == NULL)
>  				goto cfg_unlbl_map_add_failure;
> @@ -167,6 +167,8 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
>  			if (ret_val != 0)
>  				goto cfg_unlbl_map_add_failure;
>  			break;
> +			}
> +#endif /* IPv6 */
>  		default:
>  			goto cfg_unlbl_map_add_failure;
>  			break;
> @@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net,
>  	case AF_INET:
>  		addr_len = sizeof(struct in_addr);
>  		break;
> +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
>  	case AF_INET6:
>  		addr_len = sizeof(struct in6_addr);
>  		break;
> +#endif /* IPv6 */
>  	default:
>  		return -EPFNOSUPPORT;
>  	}
> @@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net,
>  	case AF_INET:
>  		addr_len = sizeof(struct in_addr);
>  		break;
> +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
>  	case AF_INET6:
>  		addr_len = sizeof(struct in6_addr);
>  		break;
> +#endif /* IPv6 */
>  	default:
>  		return -EPFNOSUPPORT;
>  	}
> 


-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

end of thread, other threads:[~2011-11-29 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-29 20:10 [PATCH v2] netlabel: Fix build problems when IPv6 is not enabled Paul Moore
2011-11-29 22:00 ` Randy Dunlap
2011-11-29 21:49   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).