[v2] socket: Do not use AF_NETLINK in __opensock

Message ID 87v90q4vh3.fsf@oldenburg.str.redhat.com
State Committed
Commit 3d981795cd00cc9b73c3ee5087c308361acd62e5
Headers
Series [v2] socket: Do not use AF_NETLINK in __opensock |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Florian Weimer Nov. 17, 2021, 4:07 p.m. UTC
  It is not possible to use interface ioctls with netlink sockets
in all Linux kernels.

---
v2: Comment updated.
 socket/opensock.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
  

Comments

Adhemerval Zanella Nov. 18, 2021, 7:28 p.m. UTC | #1
On 17/11/2021 13:07, Florian Weimer wrote:
> It is not possible to use interface ioctls with netlink sockets
> in all Linux kernels.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
> v2: Comment updated.
>  socket/opensock.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/socket/opensock.c b/socket/opensock.c
> index ff94d27a61..3e35821f91 100644
> --- a/socket/opensock.c
> +++ b/socket/opensock.c
> @@ -24,17 +24,10 @@
>  int
>  __opensock (void)
>  {
> -  /* SOCK_DGRAM is supported by all address families.  (Netlink does
> -     not support SOCK_STREAM.)  */
> +  /* SOCK_DGRAM is supported by all address families.  */
>    int type = SOCK_DGRAM | SOCK_CLOEXEC;
>    int fd;
>  
> -#ifdef AF_NETLINK
> -  fd = __socket (AF_NETLINK, type, 0);
> -  if (fd >= 0)
> -    return fd;
> -#endif
> -
>    fd = __socket (AF_UNIX, type, 0);
>    if (fd >= 0)
>      return fd;
>
  

Patch

diff --git a/socket/opensock.c b/socket/opensock.c
index ff94d27a61..3e35821f91 100644
--- a/socket/opensock.c
+++ b/socket/opensock.c
@@ -24,17 +24,10 @@ 
 int
 __opensock (void)
 {
-  /* SOCK_DGRAM is supported by all address families.  (Netlink does
-     not support SOCK_STREAM.)  */
+  /* SOCK_DGRAM is supported by all address families.  */
   int type = SOCK_DGRAM | SOCK_CLOEXEC;
   int fd;
 
-#ifdef AF_NETLINK
-  fd = __socket (AF_NETLINK, type, 0);
-  if (fd >= 0)
-    return fd;
-#endif
-
   fd = __socket (AF_UNIX, type, 0);
   if (fd >= 0)
     return fd;