auto-t: replacing ifconfig with ip commands
Torsten Schmitz
PATCH 1/1 auto-t: replacing ifconfig with ip commands
ifconfig and the rest of net-tools has been deprecated by many distributions. Use iproute2 instead.
--- autotests/testFILS/fils_256_test.py | 2 +- autotests/testFILS/fils_384_test.py | 2 +- .../testFT-8021x-roam/connection_test.py | 18 +++++++------ autotests/testFT-FILS/connection_test.py | 18 ++++++------- autotests/testNetconfig/connection_test.py | 3 +-- autotests/testNetconfig/static_test.py | 3 +-- autotests/testP2P/connection_test.py | 2 +- autotests/testPSK-roam/connection_test.py | 16 +++++------ autotests/testPreauth-roam/connection_test.py | 2 +- autotests/testSAE-roam/connection_test.py | 27 ++++++++++--------- doc/test-runner.txt | 2 +- tools/test-runner | 6 ++--- 12 files changed, 52 insertions(+), 49 deletions(-)
autotests/testFILS/fils_256_test.py +1 -1
@@ -62,7 +62,7 @@ class Test(unittest.TestCase): @classmethod def setUpClass(cls): IWD.copy_to_storage('ssidFILS-256.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') pass @classmethod
autotests/testFILS/fils_384_test.py +1 -1
@@ -62,7 +62,7 @@ class Test(unittest.TestCase): @classmethod def setUpClass(cls): IWD.copy_to_storage('ssidFILS-384.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') pass @classmethod
autotests/testFT-8021x-roam/connection_test.py +10 -8
@@ -54,10 +54,10 @@ class Test(unittest.TestCase): (self.bss_hostapd[0].ifname, device.name, True, True)) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') @classmethod def setUpClass(cls):
@@ -67,10 +67,12 @@ class Test(unittest.TestCase): HostapdCLI(config='ft-eap-ccmp-2.conf') ] # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + \ + '" address 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + \ + '" address 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testFT-FILS/connection_test.py +9 -9
@@ -124,24 +124,24 @@ class Test(unittest.TestCase): self.validate_connection(wd) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') @classmethod def setUpClass(cls): - os.system('ifconfig lo up') + os.system('ip link set lo up') IWD.copy_to_storage('TestFT.8021x') cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'), HostapdCLI(config='ft-eap-ccmp-2.conf') ] # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testNetconfig/connection_test.py +1 -2
@@ -59,8 +59,7 @@ class Test(unittest.TestCase): # TODO: This could be moved into test-runner itself if other tests ever # require this functionality (p2p, FILS, etc.). Since its simple # enough it can stay here for now. - ctx.start_process(['ifconfig', hapd.ifname, '192.168.1.1', - 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr','add', 'dev', hapd.ifname, '192.168.1.1/255.255.255.0']).wait() ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait() cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcpd.leases',
autotests/testNetconfig/static_test.py +1 -2
@@ -86,8 +86,7 @@ class Test(unittest.TestCase): # TODO: This could be moved into test-runner itself if other tests ever # require this functionality (p2p, FILS, etc.). Since its simple # enough it can stay here for now. - ctx.start_process(['ifconfig', hapd.ifname, '192.168.1.1', - 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr','add', hapd.ifname, '192.168.1.1/255.255.255.0']).wait() ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait() cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcpd.leases',
autotests/testP2P/connection_test.py +1 -1
@@ -93,7 +93,7 @@ class Test(unittest.TestCase): self.assertEqual(wpas.p2p_group['role'], 'GO' if not go else 'client') if not go: - ctx.start_process(['ifconfig', peer_ifname, '192.168.1.20', 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr', 'add','dev', peer_ifname, '192.168.1.20/255.255.255.0']).wait() os.system('> /tmp/dhcp.leases') dhcp = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcp.leases', peer_ifname]) self.dhcp = dhcp
autotests/testPSK-roam/connection_test.py +8 -8
@@ -150,10 +150,10 @@ class Test(unittest.TestCase): self.validate_connection(wd) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') self.rule0.enabled = False
@@ -175,10 +175,10 @@ class Test(unittest.TestCase): cls.rule0.drop = True # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testPreauth-roam/connection_test.py +1 -1
@@ -86,7 +86,7 @@ class Test(unittest.TestCase): def setUpClass(cls): IWD.copy_to_storage('TestPreauth.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') @classmethod def tearDownClass(cls):
autotests/testSAE-roam/connection_test.py +15 -12
@@ -111,12 +111,12 @@ class Test(unittest.TestCase): self.validate_connection(wd, False) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[2].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[2].ifname + '" up') @classmethod def setUpClass(cls):
@@ -124,12 +124,15 @@ class Test(unittest.TestCase): HostapdCLI(config='ft-sae-2.conf'), HostapdCLI(config='ft-psk-3.conf') ] - ctx.start_process(['ifconfig', cls.bss_hostapd[0].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:01', 'up']).wait() - ctx.start_process(['ifconfig', cls.bss_hostapd[1].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:02', 'up']).wait() - ctx.start_process(['ifconfig', cls.bss_hostapd[2].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:03', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, \ + 'addr', '12:00:00:00:00:01', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, \ + 'addr', '12:00:00:00:00:02', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, \ + 'adrr', '12:00:00:00:00:03', 'up']).wait() # Set interface addresses to those expected by hostapd config files cls.bss_hostapd[0].reload()
doc/test-runner.txt +1 -1
@@ -19,7 +19,7 @@ OS: 1. qemu 2.4.1 2. Linux kernel 4.20+ 3. dbus-daemon 1.11.18 - 4. ifconfig 2.10-alpha + 4. iproute2 5. iw 3.17 6. python 2.7 7. haveged no ver. avail.
tools/test-runner +3 -3
@@ -361,7 +361,7 @@ class Interface: Process(['iw', 'dev', self.name, 'del']).wait() def set_interface_state(self, state): - Process(['ifconfig', self.name, state]).wait() + Process(['ip', 'link', 'set', self.name, state]).wait() class Radio: def __init__(self, name):
@@ -971,7 +971,7 @@ class TestContext(Namespace): print("Ofono or Phonesim not found, skipping test") return - Process(['ifconfig', 'lo', 'up']).wait() + Process(['ip', 'link', 'set', 'lo', 'up']).wait() os.environ['OFONO_PHONESIM_CONFIG'] = '/tmp/phonesim.conf'
@@ -1358,7 +1358,7 @@ def post_test(ctx, to_copy): else: os.remove('/tmp/' + f) - Process(['ifconfig', 'lo', 'down']).wait() + Process(['ip', 'link', 'set', 'lo', 'down']).wait() except Exception as e: print("Exception thrown in post_test") finally:
Signature · 1 line
2.33.1
Torsten Schmitz
PATCH v2 1/1 auto-t: replace ifconfig with ip commands
ifconfig has long been deprecated in favor of ip from iproute2. It is usually no longer installed by default.
---
changes from v1:
remove ifconfig introduced in commmit d30fc978 fix typo adrr
changed commit message
--- autotests/testFILS/fils_256_test.py | 2 +- autotests/testFILS/fils_384_test.py | 2 +- .../testFT-8021x-roam/connection_test.py | 18 +++++++------ autotests/testFT-FILS/connection_test.py | 18 ++++++------- autotests/testNetconfig/connection_test.py | 8 +++--- autotests/testNetconfig/static_test.py | 3 +-- autotests/testP2P/connection_test.py | 2 +- autotests/testPSK-roam/connection_test.py | 16 +++++------ autotests/testPreauth-roam/connection_test.py | 2 +- autotests/testSAE-roam/connection_test.py | 27 ++++++++++--------- doc/test-runner.txt | 2 +- tools/test-runner | 6 ++--- 12 files changed, 55 insertions(+), 51 deletions(-)
autotests/testFILS/fils_256_test.py +1 -1
@@ -62,7 +62,7 @@ class Test(unittest.TestCase): @classmethod def setUpClass(cls): IWD.copy_to_storage('ssidFILS-256.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') pass @classmethod
autotests/testFILS/fils_384_test.py +1 -1
@@ -62,7 +62,7 @@ class Test(unittest.TestCase): @classmethod def setUpClass(cls): IWD.copy_to_storage('ssidFILS-384.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') pass @classmethod
autotests/testFT-8021x-roam/connection_test.py +10 -8
@@ -54,10 +54,10 @@ class Test(unittest.TestCase): (self.bss_hostapd[0].ifname, device.name, True, True)) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') @classmethod def setUpClass(cls):
@@ -67,10 +67,12 @@ class Test(unittest.TestCase): HostapdCLI(config='ft-eap-ccmp-2.conf') ] # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + \ + '" address 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + \ + '" address 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testFT-FILS/connection_test.py +9 -9
@@ -124,24 +124,24 @@ class Test(unittest.TestCase): self.validate_connection(wd) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') @classmethod def setUpClass(cls): - os.system('ifconfig lo up') + os.system('ip link set lo up') IWD.copy_to_storage('TestFT.8021x') cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'), HostapdCLI(config='ft-eap-ccmp-2.conf') ] # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testNetconfig/connection_test.py +4 -4
@@ -69,15 +69,15 @@ class Test(unittest.TestCase): # TODO: This could be moved into test-runner itself if other tests ever # require this functionality (p2p, FILS, etc.). Since its simple # enough it can stay here for now. - ctx.start_process(['ifconfig', hapd.ifname, '192.168.1.1', - 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr','add','dev', hapd.ifname, + '192.168.1.1/255.255.255.0']).wait() ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait() cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcpd.leases', hapd.ifname], cleanup=remove_lease4) - ctx.start_process(['ifconfig', hapd.ifname, 'inet6', - 'add', '3ffe:501:ffff:100::1/64']).wait() + ctx.start_process(['ip', 'addr', 'add', 'dev', hapd.ifname, + '3ffe:501:ffff:100::1/64']).wait() ctx.start_process(['touch', '/tmp/dhcpd6.leases']).wait() cls.dhcpd6_pid = ctx.start_process(['dhcpd', '-6', '-f', '-cf', '/tmp/dhcpd-v6.conf', '-lf', '/tmp/dhcpd6.leases',
autotests/testNetconfig/static_test.py +1 -2
@@ -86,8 +86,7 @@ class Test(unittest.TestCase): # TODO: This could be moved into test-runner itself if other tests ever # require this functionality (p2p, FILS, etc.). Since its simple # enough it can stay here for now. - ctx.start_process(['ifconfig', hapd.ifname, '192.168.1.1', - 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr','add', hapd.ifname, '192.168.1.1/255.255.255.0']).wait() ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait() cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcpd.leases',
autotests/testP2P/connection_test.py +1 -1
@@ -93,7 +93,7 @@ class Test(unittest.TestCase): self.assertEqual(wpas.p2p_group['role'], 'GO' if not go else 'client') if not go: - ctx.start_process(['ifconfig', peer_ifname, '192.168.1.20', 'netmask', '255.255.255.0']).wait() + ctx.start_process(['ip', 'addr', 'add','dev', peer_ifname, '192.168.1.20/255.255.255.0']).wait() os.system('> /tmp/dhcp.leases') dhcp = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf', '-lf', '/tmp/dhcp.leases', peer_ifname]) self.dhcp = dhcp
autotests/testPSK-roam/connection_test.py +8 -8
@@ -150,10 +150,10 @@ class Test(unittest.TestCase): self.validate_connection(wd) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') self.rule0.enabled = False
@@ -175,10 +175,10 @@ class Test(unittest.TestCase): cls.rule0.drop = True # Set interface addresses to those expected by hostapd config files - os.system('ifconfig "' + cls.bss_hostapd[0].ifname + - '" down hw ether 12:00:00:00:00:01 up') - os.system('ifconfig "' + cls.bss_hostapd[1].ifname + - '" down hw ether 12:00:00:00:00:02 up') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down') + os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up') cls.bss_hostapd[0].reload() cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
autotests/testPreauth-roam/connection_test.py +1 -1
@@ -86,7 +86,7 @@ class Test(unittest.TestCase): def setUpClass(cls): IWD.copy_to_storage('TestPreauth.8021x') - os.system('ifconfig lo up') + os.system('ip link set lo up') @classmethod def tearDownClass(cls):
autotests/testSAE-roam/connection_test.py +15 -12
@@ -111,12 +111,12 @@ class Test(unittest.TestCase): self.validate_connection(wd, False) def tearDown(self): - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" down') - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up') - os.system('ifconfig "' + self.bss_hostapd[2].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[2].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[2].ifname + '" up') @classmethod def setUpClass(cls):
@@ -124,12 +124,15 @@ class Test(unittest.TestCase): HostapdCLI(config='ft-sae-2.conf'), HostapdCLI(config='ft-psk-3.conf') ] - ctx.start_process(['ifconfig', cls.bss_hostapd[0].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:01', 'up']).wait() - ctx.start_process(['ifconfig', cls.bss_hostapd[1].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:02', 'up']).wait() - ctx.start_process(['ifconfig', cls.bss_hostapd[2].ifname, 'down', 'hw', \ - 'ether', '12:00:00:00:00:03', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, \ + 'addr', '12:00:00:00:00:01', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, \ + 'addr', '12:00:00:00:00:02', 'up']).wait() + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, 'down']) + ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, \ + 'addr', '12:00:00:00:00:03', 'up']).wait() # Set interface addresses to those expected by hostapd config files cls.bss_hostapd[0].reload()
doc/test-runner.txt +1 -1
@@ -19,7 +19,7 @@ OS: 1. qemu 2.4.1 2. Linux kernel 4.20+ 3. dbus-daemon 1.11.18 - 4. ifconfig 2.10-alpha + 4. iproute2 5. iw 3.17 6. python 3.9 7. haveged no ver. avail.
tools/test-runner +3 -3
@@ -361,7 +361,7 @@ class Interface: Process(['iw', 'dev', self.name, 'del']).wait() def set_interface_state(self, state): - Process(['ifconfig', self.name, state]).wait() + Process(['ip', 'link', 'set', self.name, state]).wait() class Radio: def __init__(self, name):
@@ -971,7 +971,7 @@ class TestContext(Namespace): print("Ofono or Phonesim not found, skipping test") return - Process(['ifconfig', 'lo', 'up']).wait() + Process(['ip', 'link', 'set', 'lo', 'up']).wait() os.environ['OFONO_PHONESIM_CONFIG'] = '/tmp/phonesim.conf'
@@ -1358,7 +1358,7 @@ def post_test(ctx, to_copy): else: os.remove('/tmp/' + f) - Process(['ifconfig', 'lo', 'down']).wait() + Process(['ip', 'link', 'set', 'lo', 'down']).wait() except Exception as e: print("Exception thrown in post_test") finally:
Signature · 1 line
2.33.1
Denis Kenzior
AppliedRe: [PATCH v2] auto-t: replace ifconfig with ip commands
Hi Torsten,
Quoted 7 lines · Torsten Schmitz
ifconfig has long been deprecated in favor of ip from iproute2. It is usually no longer installed by default.
---
changes from v1:
remove ifconfig introduced in commmitd30fc978fix typo adrr
changed commit message
Quoted 15 lines
--- autotests/testFILS/fils_256_test.py | 2 +- autotests/testFILS/fils_384_test.py | 2 +- .../testFT-8021x-roam/connection_test.py | 18 +++++++------ autotests/testFT-FILS/connection_test.py | 18 ++++++------- autotests/testNetconfig/connection_test.py | 8 +++--- autotests/testNetconfig/static_test.py | 3 +-- autotests/testP2P/connection_test.py | 2 +- autotests/testPSK-roam/connection_test.py | 16 +++++------ autotests/testPreauth-roam/connection_test.py | 2 +- autotests/testSAE-roam/connection_test.py | 27 ++++++++++--------- doc/test-runner.txt | 2 +- tools/test-runner | 6 ++--- 12 files changed, 55 insertions(+), 51 deletions(-)
Applied, thanks!
Regards,
-Denis