linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] uapi glibc compat: fix outer guard of net device flags enum
@ 2016-12-03 16:31 Jonas Gorski
  2016-12-05 17:34 ` Mikko Rapeli
  0 siblings, 1 reply; 3+ messages in thread
From: Jonas Gorski @ 2016-12-03 16:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: David S. Miller, Mikko Rapeli, Zhang Shengju

Fix a wrong condition preventing the higher net device flags
IFF_LOWER_UP etc to be defined if net/if.h is included before
linux/if.h.

The comment makes it clear the intention was to allow partial
definition with either parts.

This fixes compilation of userspace programs trying to use
IFF_LOWER_UP, IFF_DORMANT or IFF_ECHO.

Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
Patch applies cleanly to both linus' HEAD and net-next. I wasn't sure
which one's the right one.

 include/uapi/linux/if.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index e601c8c..1158a04 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -31,7 +31,7 @@
 #include <linux/hdlc/ioctl.h>
 
 /* For glibc compatibility. An empty enum does not compile. */
-#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && \
+#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
     __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
 /**
  * enum net_device_flags - &struct net_device flags
@@ -99,7 +99,7 @@ enum net_device_flags {
 	IFF_ECHO			= 1<<18, /* volatile */
 #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
 };
-#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
+#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
 
 /* for compatibility with glibc net/if.h */
 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS
-- 
2.1.4

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

* Re: [PATCH] uapi glibc compat: fix outer guard of net device flags enum
  2016-12-03 16:31 [PATCH] uapi glibc compat: fix outer guard of net device flags enum Jonas Gorski
@ 2016-12-05 17:34 ` Mikko Rapeli
  2016-12-06 15:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Mikko Rapeli @ 2016-12-05 17:34 UTC (permalink / raw)
  To: Jonas Gorski; +Cc: linux-kernel, David S. Miller, Zhang Shengju

On Sat, Dec 03, 2016 at 05:31:45PM +0100, Jonas Gorski wrote:
> Fix a wrong condition preventing the higher net device flags
> IFF_LOWER_UP etc to be defined if net/if.h is included before
> linux/if.h.
> 
> The comment makes it clear the intention was to allow partial
> definition with either parts.
> 
> This fixes compilation of userspace programs trying to use
> IFF_LOWER_UP, IFF_DORMANT or IFF_ECHO.
> 
> Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h")
> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>

Reviewed-by: Mikko Rapeli <mikko.rapeli@iki.fi>

Yep, sorry about the logic error. Thanks for the fix!

-Mikko

> ---
> Patch applies cleanly to both linus' HEAD and net-next. I wasn't sure
> which one's the right one.
> 
>  include/uapi/linux/if.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
> index e601c8c..1158a04 100644
> --- a/include/uapi/linux/if.h
> +++ b/include/uapi/linux/if.h
> @@ -31,7 +31,7 @@
>  #include <linux/hdlc/ioctl.h>
>  
>  /* For glibc compatibility. An empty enum does not compile. */
> -#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && \
> +#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
>      __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
>  /**
>   * enum net_device_flags - &struct net_device flags
> @@ -99,7 +99,7 @@ enum net_device_flags {
>  	IFF_ECHO			= 1<<18, /* volatile */
>  #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */
>  };
> -#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
> +#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */
>  
>  /* for compatibility with glibc net/if.h */
>  #if __UAPI_DEF_IF_NET_DEVICE_FLAGS
> -- 
> 2.1.4
> 

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

* Re: [PATCH] uapi glibc compat: fix outer guard of net device flags enum
  2016-12-05 17:34 ` Mikko Rapeli
@ 2016-12-06 15:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2016-12-06 15:44 UTC (permalink / raw)
  To: mikko.rapeli; +Cc: jonas.gorski, linux-kernel, zhangshengju

From: Mikko Rapeli <mikko.rapeli@iki.fi>
Date: Mon, 5 Dec 2016 19:34:02 +0200

> On Sat, Dec 03, 2016 at 05:31:45PM +0100, Jonas Gorski wrote:
>> Fix a wrong condition preventing the higher net device flags
>> IFF_LOWER_UP etc to be defined if net/if.h is included before
>> linux/if.h.
>> 
>> The comment makes it clear the intention was to allow partial
>> definition with either parts.
>> 
>> This fixes compilation of userspace programs trying to use
>> IFF_LOWER_UP, IFF_DORMANT or IFF_ECHO.
>> 
>> Fixes: 4a91cb61bb99 ("uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h")
>> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
> 
> Reviewed-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> 
> Yep, sorry about the logic error. Thanks for the fix!

Applied.

Jonas, please properly put netdev@vger.kernel.org on the CC: for networking
patches in the future.

Thank you.

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

end of thread, other threads:[~2016-12-06 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03 16:31 [PATCH] uapi glibc compat: fix outer guard of net device flags enum Jonas Gorski
2016-12-05 17:34 ` Mikko Rapeli
2016-12-06 15:44   ` 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).