summaryrefslogtreecommitdiff
path: root/src/helpers/vyos_net_name
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2021-11-10 08:39:11 +0700
committerGitHub <noreply@github.com>2021-11-10 08:39:11 +0700
commit552ab74b49a44b6cd830fbdc13d40d1633f3c6cf (patch)
tree550eded1f03e3479231d9df89253f9debb392c43 /src/helpers/vyos_net_name
parent73be449b1cd09f3ca86400753630fb4804fbeca7 (diff)
parentee02ca93ec7be75edd0ec4c0e07fe5d51a45edc6 (diff)
downloadvyos-1x-552ab74b49a44b6cd830fbdc13d40d1633f3c6cf.tar.gz
vyos-1x-552ab74b49a44b6cd830fbdc13d40d1633f3c6cf.zip
Merge pull request #1067 from DmitriyEshenko/current-08112021-fix-net-names
interface-names: T3871: Add temporary interface names to properly ren…
Diffstat (limited to 'src/helpers/vyos_net_name')
-rwxr-xr-xsrc/helpers/vyos_net_name17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/helpers/vyos_net_name b/src/helpers/vyos_net_name
index 0652e98b1..5d9535cf0 100755
--- a/src/helpers/vyos_net_name
+++ b/src/helpers/vyos_net_name
@@ -77,10 +77,12 @@ def get_biosdevname(ifname: str) -> str:
XXX: This throws an error, and likely has for a long time, unnoticed
since vyatta_net_name redirected stderr to /dev/null.
"""
- if 'eth' not in ifname:
- return ifname
+ intf = f"eth{re.sub(r'[^0-9]', '', ifname)}" if 'e' == ifname[0] else ifname
+
+ if 'eth' not in intf:
+ return intf
if os.path.isdir('/proc/xen'):
- return ifname
+ return intf
time.sleep(1)
@@ -90,7 +92,7 @@ def get_biosdevname(ifname: str) -> str:
logging.error(f'biosdevname error: {e}')
biosname = ''
- return ifname if biosname == '' else biosname
+ return intf if biosname == '' else biosname
def leave_rescan_hint(intf_name: str, hwid: str):
"""Write interface information reported by udev
@@ -186,9 +188,9 @@ def on_boot_event(intf_name: str, hwid: str, predefined: str = '') -> str:
interfaces = get_configfile_interfaces()
logging.debug(f"config file interfaces are {interfaces}")
- if hwid in list(interfaces) and intf_name == interfaces[hwid]:
- logging.info(f"use mapping from config file: '{hwid}' -> '{intf_name}'")
- return intf_name
+ if hwid in list(interfaces):
+ logging.info(f"use mapping from config file: '{hwid}' -> '{interfaces[hwid]}'")
+ return interfaces[hwid]
add_assigned_interfaces(interfaces)
logging.debug(f"adding assigned interfaces: {interfaces}")
@@ -223,6 +225,7 @@ lock.acquire()
if not boot_configuration_complete():
res = on_boot_event(argv[1], argv[2], predefined=predef_name)
logging.debug(f"on boot, returned name is {res}")
+ print(res)
else:
logging.debug("boot configuration complete")
lock.release()