rtnetlink.c (97676b6b5538b3e059d33b8338e7d5cc41c5f1f1) | rtnetlink.c (0ec6d3f467faeec5dd3b617959eb90e9d520113d) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 616 unchanged lines hidden (view full) --- 625 cb->family = idx; 626 627 return skb->len; 628} 629 630void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change) 631{ 632 struct sk_buff *skb; | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 616 unchanged lines hidden (view full) --- 625 cb->family = idx; 626 627 return skb->len; 628} 629 630void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change) 631{ 632 struct sk_buff *skb; |
633 int size = NLMSG_SPACE(sizeof(struct ifinfomsg) + 634 sizeof(struct rtnl_link_ifmap) + 635 sizeof(struct rtnl_link_stats) + 128); | 633 int err = -ENOBUFS; |
636 | 634 |
637 skb = nlmsg_new(size, GFP_KERNEL); 638 if (!skb) 639 return; | 635 skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 636 if (skb == NULL) 637 goto errout; |
640 | 638 |
641 if (rtnl_fill_ifinfo(skb, dev, NULL, 0, type, 0, 0, change, 0) < 0) { | 639 err = rtnl_fill_ifinfo(skb, dev, NULL, 0, type, 0, 0, change, 0); 640 if (err < 0) { |
642 kfree_skb(skb); | 641 kfree_skb(skb); |
643 return; | 642 goto errout; |
644 } | 643 } |
645 NETLINK_CB(skb).dst_group = RTNLGRP_LINK; 646 netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_KERNEL); | 644 645 err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_KERNEL); 646errout: 647 if (err < 0) 648 rtnl_set_sk_err(RTNLGRP_LINK, err); |
647} 648 649/* Protected by RTNL sempahore. */ 650static struct rtattr **rta_buf; 651static int rtattr_max; 652 653/* Process one rtnetlink message. */ 654 --- 195 unchanged lines hidden --- | 649} 650 651/* Protected by RTNL sempahore. */ 652static struct rtattr **rta_buf; 653static int rtattr_max; 654 655/* Process one rtnetlink message. */ 656 --- 195 unchanged lines hidden --- |