}
}
-static void rtnl_net_notifyid(struct net *net, struct net *peer, int cmd,
- int id);
+static void rtnl_net_notifyid(struct net *net, int cmd, int id);
static int alloc_netid(struct net *net, struct net *peer, int reqid)
{
int min = 0, max = 0, id;
id = idr_alloc(&net->netns_ids, peer, min, max, GFP_KERNEL);
if (id >= 0)
- rtnl_net_notifyid(net, peer, RTM_NEWNSID, id);
+ rtnl_net_notifyid(net, RTM_NEWNSID, id);
return id;
}
int id = __peernet2id(tmp, net, false);
if (id >= 0) {
- rtnl_net_notifyid(tmp, net, RTM_DELNSID, id);
+ rtnl_net_notifyid(tmp, RTM_DELNSID, id);
idr_remove(&tmp->netns_ids, id);
}
}
}
static int rtnl_net_fill(struct sk_buff *skb, u32 portid, u32 seq, int flags,
- int cmd, struct net *net, struct net *peer,
- int nsid)
+ int cmd, struct net *net, int nsid)
{
struct nlmsghdr *nlh;
struct rtgenmsg *rth;
- int id;
-
- ASSERT_RTNL();
nlh = nlmsg_put(skb, portid, seq, cmd, sizeof(*rth), flags);
if (!nlh)
rth = nlmsg_data(nlh);
rth->rtgen_family = AF_UNSPEC;
- if (nsid >= 0)
- id = nsid;
- else
- id = __peernet2id(net, peer, false);
- if (nla_put_s32(skb, NETNSA_NSID, id))
+ if (nla_put_s32(skb, NETNSA_NSID, nsid))
goto nla_put_failure;
nlmsg_end(skb, nlh);
struct nlattr *tb[NETNSA_MAX + 1];
struct sk_buff *msg;
struct net *peer;
- int err;
+ int err, id;
err = nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, NETNSA_MAX,
rtnl_net_policy);
goto out;
}
+ id = __peernet2id(net, peer, false);
err = rtnl_net_fill(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq, 0,
- RTM_GETNSID, net, peer, -1);
+ RTM_GETNSID, net, id);
if (err < 0)
goto err_out;
ret = rtnl_net_fill(net_cb->skb, NETLINK_CB(net_cb->cb->skb).portid,
net_cb->cb->nlh->nlmsg_seq, NLM_F_MULTI,
- RTM_NEWNSID, net_cb->net, peer, id);
+ RTM_NEWNSID, net_cb->net, id);
if (ret < 0)
return ret;
return skb->len;
}
-static void rtnl_net_notifyid(struct net *net, struct net *peer, int cmd,
- int id)
+static void rtnl_net_notifyid(struct net *net, int cmd, int id)
{
struct sk_buff *msg;
int err = -ENOMEM;
if (!msg)
goto out;
- err = rtnl_net_fill(msg, 0, 0, 0, cmd, net, peer, id);
+ err = rtnl_net_fill(msg, 0, 0, 0, cmd, net, id);
if (err < 0)
goto err_out;