diff options
author | Thomas Graf <tgraf@suug.ch> | 2013-02-05 12:21:10 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-02-05 12:21:10 (GMT) |
commit | e5767684a6cae113c2fc4b1b16798a1b51595ab4 (patch) | |
tree | aecc09283b4911a7931215da711502d93af4feb0 /lib/route | |
parent | 2d36371aa1ff7d3ecf18e6ca93a8b5fd9c1e8f0e (diff) | |
download | libnl-e5767684a6cae113c2fc4b1b16798a1b51595ab4.zip libnl-e5767684a6cae113c2fc4b1b16798a1b51595ab4.tar.gz libnl-e5767684a6cae113c2fc4b1b16798a1b51595ab4.tar.bz2 |
link: Modify link policy on the stack
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/link.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/route/link.c b/lib/route/link.c index 752f63a..26bd3da 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -287,6 +287,9 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, struct nlattr *tb[IFLA_MAX+1]; struct rtnl_link_af_ops *af_ops = NULL; int err, family; + struct nla_policy real_link_policy[IFLA_MAX+1]; + + memcpy(&real_link_policy, link_policy, sizeof(link_policy)); link = rtnl_link_alloc(); if (link == NULL) { @@ -311,7 +314,7 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, if ((af_ops = af_lookup_and_alloc(link, family))) { if (af_ops->ao_protinfo_policy) { - memcpy(&link_policy[IFLA_PROTINFO], + memcpy(&real_link_policy[IFLA_PROTINFO], af_ops->ao_protinfo_policy, sizeof(struct nla_policy)); } @@ -319,7 +322,7 @@ static int link_msg_parser(struct nl_cache_ops *ops, struct sockaddr_nl *who, link->l_af_ops = af_ops; } - err = nlmsg_parse(n, sizeof(*ifi), tb, IFLA_MAX, link_policy); + err = nlmsg_parse(n, sizeof(*ifi), tb, IFLA_MAX, real_link_policy); if (err < 0) goto errout; |