mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-26 11:19:17 +00:00
[settings] Add automagic "netX" settings block for last opened netdev
A script loaded via autoboot may want to get some of the settings (MAC address, IP address, et cetera) for the interface via which it was loaded, in order to pass them to the operating system. Previously such a script had no way to determine what to put in the X of ${netX/foo}. Solve this problem by transparently forwarding accesses to the real settings associated with the most recently opened network device, so scripts in this situation can say literally ${netX/foo} and get the foo setting they want. Signed-off-by: Marty Connor <mdc@etherboot.org>
This commit is contained in:
parent
06a8398422
commit
ef9d1a32c6
@ -328,11 +328,20 @@ parse_settings_name ( const char *name,
|
||||
|
||||
/* Parse each name component in turn */
|
||||
while ( remainder ) {
|
||||
struct net_device *netdev;
|
||||
|
||||
subname = remainder;
|
||||
remainder = strchr ( subname, '.' );
|
||||
if ( remainder )
|
||||
*(remainder++) = '\0';
|
||||
settings = get_child ( settings, subname );
|
||||
|
||||
/* Special case "netX" root settings block */
|
||||
if ( ( subname == name_copy ) && ! strcmp ( subname, "netX" ) &&
|
||||
( ( netdev = last_opened_netdev() ) != NULL ) )
|
||||
settings = get_child ( settings, netdev->name );
|
||||
else
|
||||
settings = get_child ( settings, subname );
|
||||
|
||||
if ( ! settings )
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user