summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJean Tourrilhes <jt@hpl.hp.com>2007-03-07 10:49:30 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 10:57:29 -0700
commitca2f37dbc5324c7278577731033a358f1f86050a (patch)
tree5085e9826220e047c1f53070355c4f194988241f /net
parent1b0b3b9980e482ab7c603430462538334f69f14a (diff)
Driver core: notify userspace of network device renames
Provide rename event for when we rename network devices. Signed-off-by: Jean Tourrilhes <jt@hpl.hp.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r--net/core/net-sysfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 221a64ab64f7..e441ec7988c1 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -424,6 +424,17 @@ static int netdev_uevent(struct device *d, char **envp,
if ((size <= 0) || (i >= num_envp))
return -ENOMEM;
+ /* pass ifindex to uevent.
+ * ifindex is useful as it won't change (interface name may change)
+ * and is what RtNetlink uses natively. */
+ envp[i++] = buf;
+ n = snprintf(buf, size, "IFINDEX=%d", dev->ifindex) + 1;
+ buf += n;
+ size -= n;
+
+ if ((size <= 0) || (i >= num_envp))
+ return -ENOMEM;
+
envp[i] = NULL;
return 0;
}