On 10/5/18 12:02 PM, Christian Brauner wrote:
quoted
+
+ err = nlmsg_parse(nlh, sizeof(struct ifaddrmsg), tb, IFA_MAX,
+ ifa_ipv4_policy, extack);
+ if (err < 0)
+ return err;
- tgt_net = rtnl_get_net_ns_capable(skb->sk,
- fillargs.netnsid);
- if (IS_ERR(tgt_net))
- return PTR_ERR(tgt_net);
+ for (i = 0; i <= IFA_MAX; ++i) {
+ if (!tb[i])
+ continue;
+ if (i == IFA_TARGET_NETNSID) {
Nit: For the sake of readability there could be an additional newline between the
"continue" and the next if () condition.
quoted
+ fillargs.netnsid = nla_get_s32(tb[i]);
+
+ tgt_net = rtnl_get_net_ns_capable(skb->sk,
+ fillargs.netnsid);
+ if (IS_ERR(tgt_net)) {
+ NL_SET_ERR_MSG(extack, "Invalid target namespace id");
Nit: Hm, maybe "Invalid target network namespace id" would be better.
You never know what namespace comes along some time later. :)
done.