rtnetlink.c (dba0a918722ee0f0ba3442575e4448c3ab622be4) | rtnetlink.c (d314774cf2cd5dfeb39a00d37deee65d4c627927) |
---|---|
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> --- 748 unchanged lines hidden (view full) --- 757 } 758 759 return 0; 760} 761 762static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, 763 struct nlattr **tb, char *ifname, int modified) 764{ | 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> --- 748 unchanged lines hidden (view full) --- 757 } 758 759 return 0; 760} 761 762static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm, 763 struct nlattr **tb, char *ifname, int modified) 764{ |
765 const struct net_device_ops *ops = dev->netdev_ops; |
|
765 int send_addr_notify = 0; 766 int err; 767 768 if (tb[IFLA_NET_NS_PID]) { 769 struct net *net; 770 net = get_net_ns_by_pid(nla_get_u32(tb[IFLA_NET_NS_PID])); 771 if (IS_ERR(net)) { 772 err = PTR_ERR(net); --- 5 unchanged lines hidden (view full) --- 778 goto errout; 779 modified = 1; 780 } 781 782 if (tb[IFLA_MAP]) { 783 struct rtnl_link_ifmap *u_map; 784 struct ifmap k_map; 785 | 766 int send_addr_notify = 0; 767 int err; 768 769 if (tb[IFLA_NET_NS_PID]) { 770 struct net *net; 771 net = get_net_ns_by_pid(nla_get_u32(tb[IFLA_NET_NS_PID])); 772 if (IS_ERR(net)) { 773 err = PTR_ERR(net); --- 5 unchanged lines hidden (view full) --- 779 goto errout; 780 modified = 1; 781 } 782 783 if (tb[IFLA_MAP]) { 784 struct rtnl_link_ifmap *u_map; 785 struct ifmap k_map; 786 |
786 if (!dev->set_config) { | 787 if (!ops->ndo_set_config) { |
787 err = -EOPNOTSUPP; 788 goto errout; 789 } 790 791 if (!netif_device_present(dev)) { 792 err = -ENODEV; 793 goto errout; 794 } 795 796 u_map = nla_data(tb[IFLA_MAP]); 797 k_map.mem_start = (unsigned long) u_map->mem_start; 798 k_map.mem_end = (unsigned long) u_map->mem_end; 799 k_map.base_addr = (unsigned short) u_map->base_addr; 800 k_map.irq = (unsigned char) u_map->irq; 801 k_map.dma = (unsigned char) u_map->dma; 802 k_map.port = (unsigned char) u_map->port; 803 | 788 err = -EOPNOTSUPP; 789 goto errout; 790 } 791 792 if (!netif_device_present(dev)) { 793 err = -ENODEV; 794 goto errout; 795 } 796 797 u_map = nla_data(tb[IFLA_MAP]); 798 k_map.mem_start = (unsigned long) u_map->mem_start; 799 k_map.mem_end = (unsigned long) u_map->mem_end; 800 k_map.base_addr = (unsigned short) u_map->base_addr; 801 k_map.irq = (unsigned char) u_map->irq; 802 k_map.dma = (unsigned char) u_map->dma; 803 k_map.port = (unsigned char) u_map->port; 804 |
804 err = dev->set_config(dev, &k_map); | 805 err = ops->ndo_set_config(dev, &k_map); |
805 if (err < 0) 806 goto errout; 807 808 modified = 1; 809 } 810 811 if (tb[IFLA_ADDRESS]) { 812 struct sockaddr *sa; 813 int len; 814 | 806 if (err < 0) 807 goto errout; 808 809 modified = 1; 810 } 811 812 if (tb[IFLA_ADDRESS]) { 813 struct sockaddr *sa; 814 int len; 815 |
815 if (!dev->set_mac_address) { | 816 if (!ops->ndo_set_mac_address) { |
816 err = -EOPNOTSUPP; 817 goto errout; 818 } 819 820 if (!netif_device_present(dev)) { 821 err = -ENODEV; 822 goto errout; 823 } 824 825 len = sizeof(sa_family_t) + dev->addr_len; 826 sa = kmalloc(len, GFP_KERNEL); 827 if (!sa) { 828 err = -ENOMEM; 829 goto errout; 830 } 831 sa->sa_family = dev->type; 832 memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]), 833 dev->addr_len); | 817 err = -EOPNOTSUPP; 818 goto errout; 819 } 820 821 if (!netif_device_present(dev)) { 822 err = -ENODEV; 823 goto errout; 824 } 825 826 len = sizeof(sa_family_t) + dev->addr_len; 827 sa = kmalloc(len, GFP_KERNEL); 828 if (!sa) { 829 err = -ENOMEM; 830 goto errout; 831 } 832 sa->sa_family = dev->type; 833 memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]), 834 dev->addr_len); |
834 err = dev->set_mac_address(dev, sa); | 835 err = ops->ndo_set_mac_address(dev, sa); |
835 kfree(sa); 836 if (err) 837 goto errout; 838 send_addr_notify = 1; 839 modified = 1; 840 } 841 842 if (tb[IFLA_MTU]) { --- 587 unchanged lines hidden --- | 836 kfree(sa); 837 if (err) 838 goto errout; 839 send_addr_notify = 1; 840 modified = 1; 841 } 842 843 if (tb[IFLA_MTU]) { --- 587 unchanged lines hidden --- |