rtnetlink.c (e3c55d406bd8df1a878546002c93db90c42be10c) | rtnetlink.c (7f29405403d7c17f539c099987972b862e7e5255) |
---|---|
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> --- 1633 unchanged lines hidden (view full) --- 1642 old_flags = dev->flags; 1643 if (ifm && (ifm->ifi_flags || ifm->ifi_change)) { 1644 err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm)); 1645 if (err < 0) 1646 return err; 1647 } 1648 1649 dev->rtnl_link_state = RTNL_LINK_INITIALIZED; | 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> --- 1633 unchanged lines hidden (view full) --- 1642 old_flags = dev->flags; 1643 if (ifm && (ifm->ifi_flags || ifm->ifi_change)) { 1644 err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm)); 1645 if (err < 0) 1646 return err; 1647 } 1648 1649 dev->rtnl_link_state = RTNL_LINK_INITIALIZED; |
1650 rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U); | |
1651 | 1650 |
1652 __dev_notify_flags(dev, old_flags); | 1651 __dev_notify_flags(dev, old_flags, ~0U); |
1653 return 0; 1654} 1655EXPORT_SYMBOL(rtnl_configure_link); 1656 1657struct net_device *rtnl_create_link(struct net *net, 1658 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]) 1659{ 1660 int err; --- 319 unchanged lines hidden (view full) --- 1980 if (rtnl_msg_handlers[idx][type].dumpit(skb, cb)) 1981 break; 1982 } 1983 cb->family = idx; 1984 1985 return skb->len; 1986} 1987 | 1652 return 0; 1653} 1654EXPORT_SYMBOL(rtnl_configure_link); 1655 1656struct net_device *rtnl_create_link(struct net *net, 1657 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]) 1658{ 1659 int err; --- 319 unchanged lines hidden (view full) --- 1979 if (rtnl_msg_handlers[idx][type].dumpit(skb, cb)) 1980 break; 1981 } 1982 cb->family = idx; 1983 1984 return skb->len; 1985} 1986 |
1988void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change) | 1987void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, 1988 gfp_t flags) |
1989{ 1990 struct net *net = dev_net(dev); 1991 struct sk_buff *skb; 1992 int err = -ENOBUFS; 1993 size_t if_info_size; 1994 | 1989{ 1990 struct net *net = dev_net(dev); 1991 struct sk_buff *skb; 1992 int err = -ENOBUFS; 1993 size_t if_info_size; 1994 |
1995 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), GFP_KERNEL); | 1995 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), flags); |
1996 if (skb == NULL) 1997 goto errout; 1998 1999 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0, 0); 2000 if (err < 0) { 2001 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 2002 WARN_ON(err == -EMSGSIZE); 2003 kfree_skb(skb); 2004 goto errout; 2005 } | 1996 if (skb == NULL) 1997 goto errout; 1998 1999 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0, 0); 2000 if (err < 0) { 2001 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 2002 WARN_ON(err == -EMSGSIZE); 2003 kfree_skb(skb); 2004 goto errout; 2005 } |
2006 rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_KERNEL); | 2006 rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, flags); |
2007 return; 2008errout: 2009 if (err < 0) 2010 rtnl_set_sk_err(net, RTNLGRP_LINK, err); 2011} 2012EXPORT_SYMBOL(rtmsg_ifinfo); 2013 2014static int nlmsg_populate_fdb_fill(struct sk_buff *skb, --- 697 unchanged lines hidden (view full) --- 2712 case NETDEV_PRE_TYPE_CHANGE: 2713 case NETDEV_GOING_DOWN: 2714 case NETDEV_UNREGISTER: 2715 case NETDEV_UNREGISTER_FINAL: 2716 case NETDEV_RELEASE: 2717 case NETDEV_JOIN: 2718 break; 2719 default: | 2007 return; 2008errout: 2009 if (err < 0) 2010 rtnl_set_sk_err(net, RTNLGRP_LINK, err); 2011} 2012EXPORT_SYMBOL(rtmsg_ifinfo); 2013 2014static int nlmsg_populate_fdb_fill(struct sk_buff *skb, --- 697 unchanged lines hidden (view full) --- 2712 case NETDEV_PRE_TYPE_CHANGE: 2713 case NETDEV_GOING_DOWN: 2714 case NETDEV_UNREGISTER: 2715 case NETDEV_UNREGISTER_FINAL: 2716 case NETDEV_RELEASE: 2717 case NETDEV_JOIN: 2718 break; 2719 default: |
2720 rtmsg_ifinfo(RTM_NEWLINK, dev, 0); | 2720 rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL); |
2721 break; 2722 } 2723 return NOTIFY_DONE; 2724} 2725 2726static struct notifier_block rtnetlink_dev_notifier = { 2727 .notifier_call = rtnetlink_event, 2728}; --- 55 unchanged lines hidden --- | 2721 break; 2722 } 2723 return NOTIFY_DONE; 2724} 2725 2726static struct notifier_block rtnetlink_dev_notifier = { 2727 .notifier_call = rtnetlink_event, 2728}; --- 55 unchanged lines hidden --- |