rtnetlink.c (cbda10fa97d72c7a1923be4426171aa90e8c6dab) | rtnetlink.c (e7ed828f10bd89a28f821ae7f20e691704d61923) |
---|---|
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> --- 1544 unchanged lines hidden (view full) --- 1553 1554err_free: 1555 free_netdev(dev); 1556err: 1557 return ERR_PTR(err); 1558} 1559EXPORT_SYMBOL(rtnl_create_link); 1560 | 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> --- 1544 unchanged lines hidden (view full) --- 1553 1554err_free: 1555 free_netdev(dev); 1556err: 1557 return ERR_PTR(err); 1558} 1559EXPORT_SYMBOL(rtnl_create_link); 1560 |
1561static int rtnl_group_changelink(struct net *net, int group, 1562 struct ifinfomsg *ifm, 1563 struct nlattr **tb) 1564{ 1565 struct net_device *dev; 1566 int err; 1567 1568 for_each_netdev(net, dev) { 1569 if (dev->group == group) { 1570 err = do_setlink(dev, ifm, tb, NULL, 0); 1571 if (err < 0) 1572 return err; 1573 } 1574 } 1575 1576 return 0; 1577} 1578 |
|
1561static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 1562{ 1563 struct net *net = sock_net(skb->sk); 1564 const struct rtnl_link_ops *ops; 1565 struct net_device *dev; 1566 struct ifinfomsg *ifm; 1567 char kind[MODULE_NAME_LEN]; 1568 char ifname[IFNAMSIZ]; --- 11 unchanged lines hidden (view full) --- 1580 if (tb[IFLA_IFNAME]) 1581 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); 1582 else 1583 ifname[0] = '\0'; 1584 1585 ifm = nlmsg_data(nlh); 1586 if (ifm->ifi_index > 0) 1587 dev = __dev_get_by_index(net, ifm->ifi_index); | 1579static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 1580{ 1581 struct net *net = sock_net(skb->sk); 1582 const struct rtnl_link_ops *ops; 1583 struct net_device *dev; 1584 struct ifinfomsg *ifm; 1585 char kind[MODULE_NAME_LEN]; 1586 char ifname[IFNAMSIZ]; --- 11 unchanged lines hidden (view full) --- 1598 if (tb[IFLA_IFNAME]) 1599 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); 1600 else 1601 ifname[0] = '\0'; 1602 1603 ifm = nlmsg_data(nlh); 1604 if (ifm->ifi_index > 0) 1605 dev = __dev_get_by_index(net, ifm->ifi_index); |
1588 else if (ifname[0]) 1589 dev = __dev_get_by_name(net, ifname); 1590 else 1591 dev = NULL; | 1606 else { 1607 if (ifname[0]) 1608 dev = __dev_get_by_name(net, ifname); 1609 else if (tb[IFLA_GROUP]) 1610 return rtnl_group_changelink(net, 1611 nla_get_u32(tb[IFLA_GROUP]), 1612 ifm, tb); 1613 else 1614 dev = NULL; 1615 } |
1592 1593 err = validate_linkmsg(dev, tb); 1594 if (err < 0) 1595 return err; 1596 1597 if (tb[IFLA_LINKINFO]) { 1598 err = nla_parse_nested(linkinfo, IFLA_INFO_MAX, 1599 tb[IFLA_LINKINFO], ifla_info_policy); --- 356 unchanged lines hidden --- | 1616 1617 err = validate_linkmsg(dev, tb); 1618 if (err < 0) 1619 return err; 1620 1621 if (tb[IFLA_LINKINFO]) { 1622 err = nla_parse_nested(linkinfo, IFLA_INFO_MAX, 1623 tb[IFLA_LINKINFO], ifla_info_policy); --- 356 unchanged lines hidden --- |