Skip to contentSkip to conversation

netlink: Allow NLM_F_DUMP on netlink requests

PATCH In review Patrik Flykt 2 participants 3 messages Sep 24, 2014 – Sep 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: Allow NLM_F_DUMP on netlink requests

NLM_F_DUMP needs to be specified in cases where all existing network interfaces are requested. As NLM_F_DUMP happens to be covered by the current check for valid flags, update the check to allow the flag being set by the caller.

---
 ell/netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ell/netlink.c +1 -1
index d247173..79a2a00 100644
@@ -396,7 +396,7 @@ LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink,
 						!netlink->command_lookup)
 		return 0;
 
-	if (flags & 0xff)
+	if (flags & 0xff & ~NLM_F_DUMP)
 		return 0;
 
 	if (function)
Signature · 1 line
1.9.1
#1 lore raw

Hi Patrik,

Quoted 13 lines · Patrik Flykt

NLM_F_DUMP needs to be specified in cases where all existing network interfaces are requested. As NLM_F_DUMP happens to be covered by the current check for valid flags, update the check to allow the flag being set by the caller.

---
  ell/netlink.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
ell/netlink.c +0 -0
index d247173..79a2a00 100644

ell/netlink.c LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink, · line 400

Quoted 6 lines
ell/netlink.c +1 -1
@@ -396,7 +396,7 @@ LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink,
  						!netlink->command_lookup)
  		return 0;
 
-	if (flags & 0xff)
+	if (flags & 0xff & ~NLM_F_DUMP)
  		return 0;

Maybe a nitpick, but should this be simply:

if (flags & ~NLM_F_DUMP)

?

ell/netlink.c LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink, · line 402

Quoted 3 lines
ell/netlink.c +0 -0
  	if (function)
 

Regards,
-Denis

#2 lore raw
Quoted 7 lines · Denis Kenzior

ell/netlink.c LIB_EXPORT unsigned int l_netlink_send(struct l_netlink *netlink, · line 400

Quoted 3 lines
ell/netlink.c +1 -1
-     if (flags & 0xff)
+     if (flags & 0xff & ~NLM_F_DUMP)
              return 0;

Maybe a nitpick, but should this be simply:

if (flags & ~NLM_F_DUMP)

Oh, I misread netlink.h on this one!

NLM_F_DUMP has a value of 0x300 (and not 16, that's actually NLM_F_DUMP_INTR) so it is not affected by the mask. Let's NACK this patch instead.

Cheers,

Patrik