[PATCH v2 1/1] netlink: fix neigh lladdr decoder

Jamal Hadi Salim jhs at mojatatu.com
Sat Sep 1 18:11:08 UTC 2018


From: Jamal Hadi Salim <jhs at mojatatu.com>

Fixes: 19abd528fbba ("rtnl_neigh: decode ndmsg netlink attributes")
signed-off-by: Jamal Hadi Salim <jhs at mojatatu.com>
---
 rtnl_neigh.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/rtnl_neigh.c b/rtnl_neigh.c
index 31087748..c1dd3d1c 100644
--- a/rtnl_neigh.c
+++ b/rtnl_neigh.c
@@ -56,6 +56,22 @@ decode_neigh_addr(struct tcb *const tcp,
 }
 
 static bool
+decode_neigh_lladdr(struct tcb *const tcp,
+		    const kernel_ulong_t addr,
+		    const unsigned int len,
+		    const void *const opaque_data)
+{
+	uint8_t maddr[6];
+
+	if (len < sizeof(maddr))
+		return false;
+	else if (!umove_or_printaddr(tcp, addr, &maddr))
+		print_mac_addr("",  maddr, sizeof(maddr));
+
+	return true;
+}
+
+static bool
 decode_nda_cacheinfo(struct tcb *const tcp,
 		     const kernel_ulong_t addr,
 		     const unsigned int len,
@@ -78,7 +94,7 @@ decode_nda_cacheinfo(struct tcb *const tcp,
 
 static const nla_decoder_t ndmsg_nla_decoders[] = {
 	[NDA_DST]		= decode_neigh_addr,
-	[NDA_LLADDR]		= decode_neigh_addr,
+	[NDA_LLADDR]		= decode_neigh_lladdr,
 	[NDA_CACHEINFO]		= decode_nda_cacheinfo,
 	[NDA_PROBES]		= decode_nla_u32,
 	[NDA_VLAN]		= decode_nla_u16,
-- 
2.11.0



More information about the Strace-devel mailing list