diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-08-15 03:33:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-22 17:54:52 -0400 |
commit | dc738dd83e88c3c5de55431f8cfb758de5d4df48 (patch) | |
tree | bf82bfdb484002d72a2bf2e568514e58b5f397c3 /net | |
parent | b8673311804ca29680dd584bd08352001fcbe2f8 (diff) |
[DECNET]: Convert DECnet notifications to use rtnl_notify()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/decnet/dn_dev.c | 25 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 28 |
2 files changed, 28 insertions, 25 deletions
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 88ea7a13bb24..01861feb608d 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -746,20 +746,23 @@ rtattr_failure: | |||
746 | static void rtmsg_ifa(int event, struct dn_ifaddr *ifa) | 746 | static void rtmsg_ifa(int event, struct dn_ifaddr *ifa) |
747 | { | 747 | { |
748 | struct sk_buff *skb; | 748 | struct sk_buff *skb; |
749 | int size = NLMSG_SPACE(sizeof(struct ifaddrmsg)+128); | 749 | int payload = sizeof(struct ifaddrmsg) + 128; |
750 | int err = -ENOBUFS; | ||
750 | 751 | ||
751 | skb = alloc_skb(size, GFP_KERNEL); | 752 | skb = alloc_skb(nlmsg_total_size(payload), GFP_KERNEL); |
752 | if (!skb) { | 753 | if (skb == NULL) |
753 | netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, ENOBUFS); | 754 | goto errout; |
754 | return; | 755 | |
755 | } | 756 | err = dn_dev_fill_ifaddr(skb, ifa, 0, 0, event, 0); |
756 | if (dn_dev_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) { | 757 | if (err < 0) { |
757 | kfree_skb(skb); | 758 | kfree_skb(skb); |
758 | netlink_set_err(rtnl, 0, RTNLGRP_DECnet_IFADDR, EINVAL); | 759 | goto errout; |
759 | return; | ||
760 | } | 760 | } |
761 | NETLINK_CB(skb).dst_group = RTNLGRP_DECnet_IFADDR; | 761 | |
762 | netlink_broadcast(rtnl, skb, 0, RTNLGRP_DECnet_IFADDR, GFP_KERNEL); | 762 | err = rtnl_notify(skb, 0, RTNLGRP_DECnet_IFADDR, NULL, GFP_KERNEL); |
763 | errout: | ||
764 | if (err < 0) | ||
765 | rtnl_set_sk_err(RTNLGRP_DECnet_IFADDR, err); | ||
763 | } | 766 | } |
764 | 767 | ||
765 | static int dn_dev_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | 768 | static int dn_dev_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 10e87262b6fb..317904bb5896 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -333,24 +333,24 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id, | |||
333 | { | 333 | { |
334 | struct sk_buff *skb; | 334 | struct sk_buff *skb; |
335 | u32 pid = req ? req->pid : 0; | 335 | u32 pid = req ? req->pid : 0; |
336 | int size = NLMSG_SPACE(sizeof(struct rtmsg) + 256); | 336 | int err = -ENOBUFS; |
337 | 337 | ||
338 | skb = alloc_skb(size, GFP_KERNEL); | 338 | skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); |
339 | if (!skb) | 339 | if (skb == NULL) |
340 | return; | 340 | goto errout; |
341 | 341 | ||
342 | if (dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id, | 342 | err = dn_fib_dump_info(skb, pid, nlh->nlmsg_seq, event, tb_id, |
343 | f->fn_type, f->fn_scope, &f->fn_key, z, | 343 | f->fn_type, f->fn_scope, &f->fn_key, z, |
344 | DN_FIB_INFO(f), 0) < 0) { | 344 | DN_FIB_INFO(f), 0); |
345 | if (err < 0) { | ||
345 | kfree_skb(skb); | 346 | kfree_skb(skb); |
346 | return; | 347 | goto errout; |
347 | } | 348 | } |
348 | NETLINK_CB(skb).dst_group = RTNLGRP_DECnet_ROUTE; | 349 | |
349 | if (nlh->nlmsg_flags & NLM_F_ECHO) | 350 | err = rtnl_notify(skb, pid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL); |
350 | atomic_inc(&skb->users); | 351 | errout: |
351 | netlink_broadcast(rtnl, skb, pid, RTNLGRP_DECnet_ROUTE, GFP_KERNEL); | 352 | if (err < 0) |
352 | if (nlh->nlmsg_flags & NLM_F_ECHO) | 353 | rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err); |
353 | netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT); | ||
354 | } | 354 | } |
355 | 355 | ||
356 | static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, | 356 | static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, |