Skip to contentSkip to conversation

libmnl [PATCH 3/8] examples: use mnl_nlmsg_get_payload()

PATCH Ken-ichirou MATSUZAWA 1 participant 1 message Dec 7, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

not increment (nlmsghdr) pointer

---
 examples/netfilter/nfct-create-batch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/netfilter/nfct-create-batch.c +1 -1
index 40cd2f6..a232991 100644
@@ -67,7 +67,7 @@ static void put_msg(char *buf, uint16_t i, int seq)
 
 static int cb_err(const struct nlmsghdr *nlh, void *data)
 {
-	struct nlmsgerr *err = (void *)(nlh + 1);
+	struct nlmsgerr *err = (void *)mnl_nlmsg_get_payload(nlh);
 	if (err->error != 0)
 		printf("message with seq %u has failed: %s\n",
 			nlh->nlmsg_seq, strerror(-err->error));
Signature · 1 line
1.8.4.rc3