Commit 6ed03238 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[NET]: Device name changing via rtnetlink

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 625bd566
...@@ -677,6 +677,7 @@ extern int dev_ioctl(unsigned int cmd, void __user *); ...@@ -677,6 +677,7 @@ extern int dev_ioctl(unsigned int cmd, void __user *);
extern int dev_ethtool(struct ifreq *); extern int dev_ethtool(struct ifreq *);
extern unsigned dev_get_flags(const struct net_device *); extern unsigned dev_get_flags(const struct net_device *);
extern int dev_change_flags(struct net_device *, unsigned); extern int dev_change_flags(struct net_device *, unsigned);
extern int dev_change_name(struct net_device *, char *);
extern int dev_set_mtu(struct net_device *, int); extern int dev_set_mtu(struct net_device *, int);
extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev); extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
......
...@@ -3347,6 +3347,7 @@ EXPORT_SYMBOL(dev_remove_pack); ...@@ -3347,6 +3347,7 @@ EXPORT_SYMBOL(dev_remove_pack);
EXPORT_SYMBOL(dev_set_allmulti); EXPORT_SYMBOL(dev_set_allmulti);
EXPORT_SYMBOL(dev_set_promiscuity); EXPORT_SYMBOL(dev_set_promiscuity);
EXPORT_SYMBOL(dev_change_flags); EXPORT_SYMBOL(dev_change_flags);
EXPORT_SYMBOL(dev_change_name);
EXPORT_SYMBOL(dev_set_mtu); EXPORT_SYMBOL(dev_set_mtu);
EXPORT_SYMBOL(free_netdev); EXPORT_SYMBOL(free_netdev);
EXPORT_SYMBOL(netdev_boot_setup_check); EXPORT_SYMBOL(netdev_boot_setup_check);
......
...@@ -345,6 +345,23 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -345,6 +345,23 @@ static int do_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1])); dev->weight = *((u32 *) RTA_DATA(ida[IFLA_WEIGHT - 1]));
} }
if (ida[IFLA_IFNAME - 1]) {
char ifname[IFNAMSIZ];
if (ida[IFLA_IFNAME - 1]->rta_len > RTA_LENGTH(sizeof(ifname)))
goto out;
memset(ifname, 0, sizeof(ifname));
memcpy(ifname, RTA_DATA(ida[IFLA_IFNAME - 1]),
RTA_PAYLOAD(ida[IFLA_IFNAME - 1]));
ifname[IFNAMSIZ - 1] = '\0';
err = dev_change_name(dev, ifname);
if (err)
goto out;
}
err = 0; err = 0;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment