netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* libmnl [PATCH 1/8] examples: set attr table
@ 2013-12-07 11:21 Ken-ichirou MATSUZAWA
  0 siblings, 0 replies; only message in thread
From: Ken-ichirou MATSUZAWA @ 2013-12-07 11:21 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo Neira Ayuso

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-07 11:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 11:21 libmnl [PATCH 1/8] examples: set attr table Ken-ichirou MATSUZAWA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).