summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/net/netdevice.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 7c40a2ac8..b834c3cd9 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -675,6 +675,14 @@ int register_netdev ( struct net_device *netdev ) {
goto err_duplicate;
}
+ /* Reject named network devices that already exist */
+ if ( netdev->name[0] && ( duplicate = find_netdev ( netdev->name ) ) ) {
+ DBGC ( netdev, "NETDEV rejecting duplicate name %s\n",
+ duplicate->name );
+ rc = -EEXIST;
+ goto err_duplicate;
+ }
+
/* Record device index and create device name */
if ( netdev->name[0] == '\0' ) {
snprintf ( netdev->name, sizeof ( netdev->name ), "net%d",