Commit dc738dd8 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[DECNET]: Convert DECnet notifications to use rtnl_notify()

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8673311
...@@ -746,20 +746,23 @@ static int dn_dev_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa, ...@@ -746,20 +746,23 @@ static int dn_dev_fill_ifaddr(struct sk_buff *skb, struct dn_ifaddr *ifa,
static void rtmsg_ifa(int event, struct dn_ifaddr *ifa) static void rtmsg_ifa(int event, struct dn_ifaddr *ifa)
{ {
struct sk_buff *skb; struct sk_buff *skb;
int size = NLMSG_SPACE(sizeof(struct ifaddrmsg)+128); int payload = sizeof(struct ifaddrmsg) + 128;
int err = -ENOBUFS;
skb = alloc_skb(size, GFP_KERNEL); skb = alloc_skb(nlmsg_total_size(payload), GFP_KERNEL);
if (!skb) { if (skb == NULL)
netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, ENOBUFS); goto errout;
return;
} err = dn_dev_fill_ifaddr(skb, ifa, 0, 0, event, 0);
if (dn_dev_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) { if (err < 0) {
kfree_skb(skb); kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, EINVAL); goto errout;
return;
} }
NETLINK_CB(skb).dst_group = RTNLGRP_DECnet_IFADDR;
netlink_broadcast(rtnl, skb, 0, RTNLGRP_DECnet_IFADDR, GFP_KERNEL); err = rtnl_notify(skb, 0, RTNLGRP_DECnet_IFADDR, NULL, GFP_KERNEL);
errout:
if (err < 0)
rtnl_set_sk_err(RTNLGRP_DECnet_IFADDR, err);
} }
static int dn_dev_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) static int dn_dev_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
......
...@@ -333,24 +333,24 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id, ...@@ -333,24 +333,24 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
{ {
struct sk_buff *skb; struct sk_buff *skb;
u32 pid = req ? req->pid : 0; u32 pid = req ? req->pid : 0;
int size = NLMSG_SPACE(sizeof(struct rtmsg) + 256); int err = -ENOBUFS;
skb = alloc_skb(size, GFP_KERNEL); skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (!skb) if (skb == NULL)
return; goto errout;
if (dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id, err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id,
f->fn_type, f->fn_scope, &f->fn_key, z, f->fn_type, f->fn_scope, &f->fn_key, z,
DN_FIB_INFO(f), 0) < 0) { DN_FIB_INFO(f), 0);
if (err < 0) {
kfree_skb(skb); kfree_skb(skb);
return; goto errout;
} }
NETLINK_CB(skb).dst_group = RTNLGRP_DECnet_ROUTE;
if (nlh->nlmsg_flags & NLM_F_ECHO) err = rtnl_notify(skb, pid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL);
atomic_inc(&skb->users); errout:
netlink_broadcast(rtnl, skb, pid, RTNLGRP_DECnet_ROUTE, GFP_KERNEL); if (err < 0)
if (nlh->nlmsg_flags & NLM_F_ECHO) rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err);
netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
} }
static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment