All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Subject: libmnl [PATCH 1/8] examples: set attr table
Date: Sat, 07 Dec 2013 20:21:34 +0900	[thread overview]
Message-ID: <87mwkcaou9.wl%chamaken@gmail.com> (raw)

Florian adviced rtnl-route-event.c has same problem

Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>

---
 examples/rtnl/rtnl-route-dump.c  | 4 ++++
 examples/rtnl/rtnl-route-event.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/examples/rtnl/rtnl-route-dump.c b/examples/rtnl/rtnl-route-dump.c
index 59e0a9d..33cb2df 100644
--- a/examples/rtnl/rtnl-route-dump.c
+++ b/examples/rtnl/rtnl-route-dump.c
@@ -13,6 +13,8 @@
 
 static int data_attr_cb2(const struct nlattr *attr, void *data)
 {
+	const struct nlattr **tb = data;
+
 	/* skip unsupported attribute in user-space */
 	if (mnl_attr_type_valid(attr, RTAX_MAX) < 0)
 		return MNL_CB_OK;
@@ -21,6 +23,8 @@ static int data_attr_cb2(const struct nlattr *attr, void *data)
 		perror("mnl_attr_validate");
 		return MNL_CB_ERROR;
 	}
+
+	tb[mnl_attr_get_type(attr)] = attr;
 	return MNL_CB_OK;
 }
 
diff --git a/examples/rtnl/rtnl-route-event.c b/examples/rtnl/rtnl-route-event.c
index 16d0563..badba2d 100644
--- a/examples/rtnl/rtnl-route-event.c
+++ b/examples/rtnl/rtnl-route-event.c
@@ -13,6 +13,8 @@
 
 static int data_attr_cb2(const struct nlattr *attr, void *data)
 {
+	const struct nlattr **tb = data;
+
 	/* skip unsupported attribute in user-space */
 	if (mnl_attr_type_valid(attr, RTAX_MAX) < 0)
 		return MNL_CB_OK;
@@ -21,6 +23,8 @@ static int data_attr_cb2(const struct nlattr *attr, void *data)
 		perror("mnl_attr_validate");
 		return MNL_CB_ERROR;
 	}
+
+	tb[mnl_attr_get_type(attr)] = attr;
 	return MNL_CB_OK;
 }
 
-- 
1.8.4.rc3


                 reply	other threads:[~2013-12-07 11:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwkcaou9.wl%chamaken@gmail.com \
    --to=chamaken@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.