summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen-ichirou MATSUZAWA <chamaken@gmail.com>2013-12-07 20:21:34 +0900
committerFlorian Westphal <fw@strlen.de>2013-12-07 12:53:46 +0100
commitc7a66dd8c1cc25889fdb91c5ef92e92d55119497 (patch)
tree59b17603858dc05045c129ba408140ef10afea4e
parent97d1ff851f00fb7caec35f51d43b1ea53e80d9f9 (diff)
examples: set attr table
Florian adviced rtnl-route-event.c has same problem Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp> Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r--examples/rtnl/rtnl-route-dump.c4
-rw-r--r--examples/rtnl/rtnl-route-event.c4
2 files changed, 8 insertions, 0 deletions
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;
}