summaryrefslogtreecommitdiffstats
path: root/src/net/netdevice.c
diff options
context:
space:
mode:
authorMichael Brown2010-11-19 01:23:26 +0100
committerMichael Brown2010-11-20 17:52:04 +0100
commit6fd09b541fbc426057661c7e0da4f39000b6803e (patch)
tree042ecae7db862b934180566b16645969987343de /src/net/netdevice.c
parent[lotest] Fix endianness in status message (diff)
downloadipxe-6fd09b541fbc426057661c7e0da4f39000b6803e.tar.gz
ipxe-6fd09b541fbc426057661c7e0da4f39000b6803e.tar.xz
ipxe-6fd09b541fbc426057661c7e0da4f39000b6803e.zip
[vlan] Add support for IEEE 802.1Q VLANs
Originally-implemented-by: michael-dev@fami-braun.de Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r--src/net/netdevice.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 90dab8fb..37887073 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -405,8 +405,10 @@ int register_netdev ( struct net_device *netdev ) {
int rc;
/* Create device name */
- snprintf ( netdev->name, sizeof ( netdev->name ), "net%d",
- ifindex++ );
+ if ( netdev->name[0] == '\0' ) {
+ snprintf ( netdev->name, sizeof ( netdev->name ), "net%d",
+ ifindex++ );
+ }
/* Set initial link-layer address */
netdev->ll_protocol->init_addr ( netdev->hw_addr, netdev->ll_addr );
@@ -461,13 +463,13 @@ int netdev_open ( struct net_device *netdev ) {
DBGC ( netdev, "NETDEV %s opening\n", netdev->name );
+ /* Mark as opened */
+ netdev->state |= NETDEV_OPEN;
+
/* Open the device */
if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
return rc;
- /* Mark as opened */
- netdev->state |= NETDEV_OPEN;
-
/* Add to head of open devices list */
list_add ( &netdev->open_list, &open_net_devices );