[RTNETLINK]: Use rtnl_unicast() for rtnetlink unicasts

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Thomas Graf 2006-08-15 00:30:25 -07:00 коммит произвёл David S. Miller
Родитель f8d8fda54a
Коммит 2942e90050
8 изменённых файлов: 20 добавлений и 24 удалений

Просмотреть файл

@ -584,6 +584,7 @@ struct rtnetlink_link
extern struct rtnetlink_link * rtnetlink_links[NPROTO]; extern struct rtnetlink_link * rtnetlink_links[NPROTO];
extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data); extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);

Просмотреть файл

@ -166,6 +166,11 @@ int rtnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
return err; return err;
} }
int rtnl_unicast(struct sk_buff *skb, u32 pid)
{
return nlmsg_unicast(rtnl, skb, pid);
}
int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics) int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics)
{ {
struct rtattr *mx = (struct rtattr*)skb->tail; struct rtattr *mx = (struct rtattr*)skb->tail;
@ -574,9 +579,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
goto errout; goto errout;
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(skb).pid, MSG_DONTWAIT); err = rtnl_unicast(skb, NETLINK_CB(skb).pid);
if (err > 0)
err = 0;
errout: errout:
kfree(iw_buf); kfree(iw_buf);
dev_put(dev); dev_put(dev);
@ -825,3 +828,4 @@ EXPORT_SYMBOL(rtnl);
EXPORT_SYMBOL(rtnl_lock); EXPORT_SYMBOL(rtnl_lock);
EXPORT_SYMBOL(rtnl_trylock); EXPORT_SYMBOL(rtnl_trylock);
EXPORT_SYMBOL(rtnl_unlock); EXPORT_SYMBOL(rtnl_unlock);
EXPORT_SYMBOL(rtnl_unicast);

Просмотреть файл

@ -1611,9 +1611,7 @@ int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
goto out_free; goto out_free;
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); return rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
return err;
out_free: out_free:
kfree_skb(skb); kfree_skb(skb);

Просмотреть файл

@ -312,7 +312,8 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
e = NLMSG_DATA(nlh); e = NLMSG_DATA(nlh);
e->error = -ETIMEDOUT; e->error = -ETIMEDOUT;
memset(&e->msg, 0, sizeof(e->msg)); memset(&e->msg, 0, sizeof(e->msg));
netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT);
rtnl_unicast(skb, NETLINK_CB(skb).pid);
} else } else
kfree_skb(skb); kfree_skb(skb);
} }
@ -512,7 +513,6 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
while((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) { while((skb=__skb_dequeue(&uc->mfc_un.unres.unresolved))) {
if (skb->nh.iph->version == 0) { if (skb->nh.iph->version == 0) {
int err;
struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr)); struct nlmsghdr *nlh = (struct nlmsghdr *)skb_pull(skb, sizeof(struct iphdr));
if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) { if (ipmr_fill_mroute(skb, c, NLMSG_DATA(nlh)) > 0) {
@ -525,7 +525,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
e->error = -EMSGSIZE; e->error = -EMSGSIZE;
memset(&e->msg, 0, sizeof(e->msg)); memset(&e->msg, 0, sizeof(e->msg));
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(skb).dst_pid, MSG_DONTWAIT);
rtnl_unicast(skb, NETLINK_CB(skb).pid);
} else } else
ip_mr_forward(skb, c, 0); ip_mr_forward(skb, c, 0);
} }

Просмотреть файл

@ -2809,10 +2809,9 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
goto out_free; goto out_free;
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
if (err > 0) out:
err = 0; return err;
out: return err;
out_free: out_free:
kfree_skb(skb); kfree_skb(skb);

Просмотреть файл

@ -3268,9 +3268,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb,
goto out_free; goto out_free;
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
if (err > 0)
err = 0;
out: out:
in6_ifa_put(ifa); in6_ifa_put(ifa);
return err; return err;

Просмотреть файл

@ -2044,9 +2044,7 @@ int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
goto out_free; goto out_free;
} }
err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
if (err > 0)
err = 0;
out: out:
return err; return err;
out_free: out_free:

Просмотреть файл

@ -459,7 +459,6 @@ static int
act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event) act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
{ {
struct sk_buff *skb; struct sk_buff *skb;
int err = 0;
skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
if (!skb) if (!skb)
@ -468,10 +467,8 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
kfree_skb(skb); kfree_skb(skb);
return -EINVAL; return -EINVAL;
} }
err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
if (err > 0) return rtnl_unicast(skb, pid);
err = 0;
return err;
} }
static struct tc_action * static struct tc_action *