commit fec356b632e46536406484f39718441b57e94846
parent 2104a15c2444cfb5bc0873e6c633c1bf930c7f78
Author: illiliti <illiliti@protonmail.com>
Date: Fri, 26 Nov 2021 03:28:37 +0300
Merge tag '1.20'
Release 1.20
Diffstat:
44 files changed, 740 insertions(+), 223 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,6 +4,8 @@
.libs
.deps
.dirstamp
+tags
+cscope.*
Makefile
Makefile.in
aclocal.m4
diff --git a/AUTHORS b/AUTHORS
@@ -31,3 +31,5 @@ Sean Anderson <sean.anderson@seco.com>
Joseph Benden <joe@benden.us>
Michael Johnson <mjohnson459@gmail.com>
Matt Oberle <matt.r.oberle@gmail.com>
+Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
+Torsten Schmitz <noreply.torsten@gmail.com>
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+ver 1.20:
+ Fix issue with handling Hotspot 2.0 requirements.
+ Add support for evict_nocarrier setting during roaming.
+ Add support for experimental NetworkConfigurationAgent API.
+
ver 1.19:
Fix issue with handling OCV if offloading is supported.
Fix issue with handling SA Query on channel switch event.
diff --git a/Makefile.am b/Makefile.am
@@ -247,6 +247,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
src/diagnostic.h src/diagnostic.c \
src/ip-pool.h src/ip-pool.c \
src/band.h src/band.c \
+ src/sysfs.h src/sysfs.c \
$(eap_sources) \
$(builtin_sources)
diff --git a/autotests/testAP/connection_test.py b/autotests/testAP/connection_test.py
@@ -55,9 +55,10 @@ class Test(unittest.TestCase):
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
- ordered_networks = dev2.get_ordered_networks()
+ networks = {}
+ networks['TestAP1'] = dev2.get_ordered_network('TestAP1')
+ networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
- networks = { n.name: n for n in ordered_networks }
self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
diff --git a/autotests/testAP/dhcp_config_test.py b/autotests/testAP/dhcp_config_test.py
@@ -37,9 +37,9 @@ class Test(unittest.TestCase):
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
- ordered_networks = dev2.get_ordered_networks()
+ networks = {}
+ networks['APConfig'] = dev2.get_ordered_network('APConfig', full_scan=True)
- networks = { n.name: n for n in ordered_networks }
self.assertEqual(networks['APConfig'].type, NetworkType.psk)
psk_agent = PSKAgent('password123')
diff --git a/autotests/testAP/dhcp_test.py b/autotests/testAP/dhcp_test.py
@@ -34,9 +34,9 @@ class Test(unittest.TestCase):
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
- ordered_networks = dev2.get_ordered_networks()
+ networks = {}
+ networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
- networks = { n.name: n for n in ordered_networks }
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
psk_agent = PSKAgent('Password2')
diff --git a/autotests/testAP/failure_test.py b/autotests/testAP/failure_test.py
@@ -56,8 +56,10 @@ class Test(unittest.TestCase):
condition = 'not obj.scanning'
wd.wait_for_object_condition(dev2, condition)
- ordered_networks = dev2.get_ordered_networks()
- networks = { n.name: n for n in ordered_networks }
+ networks = {}
+ networks['TestAP1'] = dev2.get_ordered_network('TestAP1')
+ networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
+
self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
diff --git a/autotests/testFILS/fils_256_test.py b/autotests/testFILS/fils_256_test.py
@@ -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
diff --git a/autotests/testFILS/fils_384_test.py b/autotests/testFILS/fils_384_test.py
@@ -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
diff --git a/autotests/testFT-8021x-roam/connection_test.py b/autotests/testFT-8021x-roam/connection_test.py
@@ -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")
diff --git a/autotests/testFT-FILS/connection_test.py b/autotests/testFT-FILS/connection_test.py
@@ -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")
diff --git a/autotests/testHotspot/hotspot_test.py b/autotests/testHotspot/hotspot_test.py
@@ -14,11 +14,7 @@ import testutil
class Test(unittest.TestCase):
- def test_connection_success(self):
- wd = self.wd
-
- hapd = HostapdCLI(config='ssidHotspot.conf')
-
+ def validate_connection(self, wd, hapd, dgaf_disable=False):
psk_agent = PSKAgent('abc', ('domain\\user', 'testpasswd'))
wd.register_psk_agent(psk_agent)
@@ -38,7 +34,16 @@ class Test(unittest.TestCase):
wd.wait_for_object_condition(device, condition)
testutil.test_iface_operstate()
- testutil.test_ifaces_connected(device.name, hapd.ifname)
+
+ if not dgaf_disable:
+ testutil.test_ifaces_connected(device.name, hapd.ifname)
+ else:
+ # This is expected to fail with group traffic
+ with self.assertRaises(Exception):
+ testutil.test_ifaces_connected(device.name, hapd.ifname, expect_fail=True)
+
+ # Now try again without testing group traffic
+ testutil.test_ifaces_connected(device.name, hapd.ifname, group=False)
device.disconnect()
@@ -47,6 +52,20 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
+ def test_hotspot(self):
+ hapd = HostapdCLI(config='ssidHotspot.conf')
+ hapd.set_value('disable_dgaf', '0')
+ hapd.reload()
+
+ self.validate_connection(self.wd, hapd)
+
+ def test_dgaf_disabled(self):
+ hapd = HostapdCLI(config='ssidHotspot.conf')
+ hapd.set_value('disable_dgaf', '1')
+ hapd.reload()
+
+ self.validate_connection(self.wd, hapd, dgaf_disable=True)
+
@classmethod
def setUpClass(cls):
IWD.copy_to_hotspot('example.conf')
diff --git a/autotests/testNetconfig/connection_test.py b/autotests/testNetconfig/connection_test.py
@@ -11,7 +11,7 @@ from iwd import NetworkType
from hostapd import HostapdCLI
import testutil
from config import ctx
-import os
+import os, time
class Test(unittest.TestCase):
@@ -39,6 +39,10 @@ class Test(unittest.TestCase):
testutil.test_iface_operstate()
testutil.test_ifaces_connected()
+ time.sleep(2)
+ ret = os.system('ip addr show ' + device.name + ' | grep \'inet6 3ffe:501:ffff:100::\'')
+ self.assertEqual(os.waitstatus_to_exitcode(ret), 0)
+
device.disconnect()
condition = 'not obj.connected'
@@ -48,29 +52,53 @@ class Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
- def remove_lease():
+ def remove_lease4():
try:
os.remove('/tmp/dhcpd.leases')
os.remove('/tmp/dhcpd.leases~')
except:
pass
+ def remove_lease6():
+ try:
+ os.remove('/tmp/dhcpd6.leases')
+ os.remove('/tmp/dhcpd6.leases~')
+ except:
+ pass
hapd = HostapdCLI()
# 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_lease)
+ hapd.ifname], cleanup=remove_lease4)
+
+ 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',
+ hapd.ifname], cleanup=remove_lease6)
+ ctx.start_process(['sysctl', 'net.ipv6.conf.' + hapd.ifname + '.forwarding=1']).wait()
+ # Tell clients to use DHCPv6
+ config = open('/tmp/radvd.conf', 'w')
+ config.write('interface ' + hapd.ifname + ' { AdvSendAdvert on; AdvManagedFlag on; };')
+ config.close()
+ cls.radvd_pid = ctx.start_process(['radvd', '-n', '-d5', '-p', '/tmp/radvd.pid', '-C', '/tmp/radvd.conf'])
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
ctx.stop_process(cls.dhcpd_pid)
cls.dhcpd_pid = None
+ ctx.stop_process(cls.dhcpd6_pid)
+ cls.dhcpd6_pid = None
+ ctx.stop_process(cls.radvd_pid)
+ cls.radvd_pid = None
+ os.remove('/tmp/radvd.conf')
if __name__ == '__main__':
unittest.main(exit=True)
diff --git a/autotests/testNetconfig/dhcpd-v6.conf b/autotests/testNetconfig/dhcpd-v6.conf
@@ -0,0 +1,6 @@
+subnet6 3ffe:501:ffff:100::/64
+ {
+ option dhcp6.name-servers 3ffe:501:ffff:100::1;
+ range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::20;
+ range6 3ffe:501:ffff:100::100 3ffe:501:ffff:100::200;
+ }
diff --git a/autotests/testNetconfig/main.conf b/autotests/testNetconfig/main.conf
@@ -1,2 +1,5 @@
[General]
EnableNetworkConfiguration=true
+
+[Network]
+EnableIPv6=true
diff --git a/autotests/testNetconfig/static_test.py b/autotests/testNetconfig/static_test.py
@@ -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',
diff --git a/autotests/testOWE-transition/connection_test.py b/autotests/testOWE-transition/connection_test.py
@@ -8,6 +8,7 @@ import iwd
from iwd import IWD
from iwd import NetworkType
from hostapd import HostapdCLI
+from hwsim import Hwsim
import testutil
class Test(unittest.TestCase):
@@ -220,6 +221,38 @@ class Test(unittest.TestCase):
self.validate(self.wd, self.hapd_open)
+ # OWE Transition pair + additional open network with the same SSID
+ def test_owe_transition_extra_open(self):
+ self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
+ self.hapd_open.reload()
+ self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
+ self.hapd_owe.reload()
+
+ self.hapd_open2.set_value('ssid', 'transition')
+ self.hapd_open2.reload()
+
+ self.hapd_owe2.disable()
+
+ # Set the open network signal strength very low so it gets put last on
+ # the network bss_list, forcing the additional open network to be
+ # checked first.
+ self.rule0 = self.hwsim.rules.create()
+ self.rule0.source = self.hwsim.get_radio('rad0').addresses[0]
+ self.rule0.signal = -4000
+ self.rule0.enabled = True
+
+ devices = self.wd.list_devices(1)
+ device = devices[0]
+
+ device.scan()
+ condition = 'obj.scanning'
+ self.wd.wait_for_object_condition(device, condition)
+ condition = 'not obj.scanning'
+ self.wd.wait_for_object_condition(device, condition)
+
+
+ self.validate(self.wd, self.hapd_owe)
+
def setUp(self):
self.wd = IWD(True)
self.hapd_owe = HostapdCLI(config='ssidOWE.conf')
@@ -227,6 +260,8 @@ class Test(unittest.TestCase):
self.hapd_owe2 = HostapdCLI(config='ssidOWE-2.conf')
self.hapd_open2 = HostapdCLI(config='ssidOpen-2.conf')
+ self.hwsim = Hwsim()
+
def tearDown(self):
IWD.clear_storage()
@@ -235,6 +270,7 @@ class Test(unittest.TestCase):
self.wd = None
self.hapd_open = None
self.hapd_owe = None
+ self.hwsim = None
@classmethod
def setUpClass(cls):
diff --git a/autotests/testP2P/connection_test.py b/autotests/testP2P/connection_test.py
@@ -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
diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py
@@ -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")
diff --git a/autotests/testPreauth-roam/connection_test.py b/autotests/testPreauth-roam/connection_test.py
@@ -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):
diff --git a/autotests/testSAE-roam/connection_test.py b/autotests/testSAE-roam/connection_test.py
@@ -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()
diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
@@ -437,7 +437,7 @@ class Device(IWDDBusAbstract):
self._wait_for_async_op()
- def get_ordered_networks(self, scan_if_needed = True, full_scan = False):
+ def get_ordered_networks(self, scan_if_needed = True, full_scan = False, list = []):
'''Return the list of networks found in the most recent
scan, sorted by their user interface importance
score as calculated by iwd. If the device is
@@ -454,7 +454,10 @@ class Device(IWDDBusAbstract):
ordered_network = OrderedNetwork(bus_obj, self._bus, self._namespace)
ordered_networks.append(ordered_network)
- if len(ordered_networks) > 0:
+ names = [x.name for x in ordered_networks]
+
+ # all() will always return true if 'list' is empty
+ if all(x in names for x in list) and len(names) > 0:
return ordered_networks
elif not scan_if_needed:
return None
@@ -489,8 +492,8 @@ class Device(IWDDBusAbstract):
network wasn't found. If the network is not found an exception is
raised, this removes the need to extra asserts in autotests.
'''
- def wait_for_network(self, network, scan_if_needed):
- networks = self.get_ordered_networks(scan_if_needed)
+ def wait_for_network(self, network, scan_if_needed, full_scan):
+ networks = self.get_ordered_networks(scan_if_needed, full_scan, list=[network])
if not networks:
# No point in continuing if we aren't going to re-scan
@@ -505,7 +508,7 @@ class Device(IWDDBusAbstract):
return False
- return ctx.non_block_wait(wait_for_network, 30, self, network, scan_if_needed,
+ return ctx.non_block_wait(wait_for_network, 30, self, network, scan_if_needed, full_scan,
exception=Exception("Network %s not found" % network))
def wps_push_button(self):
diff --git a/client/command.h b/client/command.h
@@ -83,10 +83,14 @@ struct command_family_desc {
} __attribute__((aligned(8)));
#define COMMAND_FAMILY(name, init, exit) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
static struct command_family_desc __command_family_ ## name \
- __attribute__((used, section("__command"), aligned(8))) = {\
+ __attribute__((used, retain, \
+ section("__command"), aligned(8))) = { \
#name, init, exit \
}; \
+ _Pragma("GCC diagnostic pop")
bool command_init(char **argv, int argc);
void command_exit(void);
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
@@ -315,7 +315,8 @@ static void proxy_callback(struct l_dbus_message *message, void *user_data)
}
proxy = callback_data->user_data;
- if (!strcmp(proxy->type->interface, IWD_AGENT_MANAGER_INTERFACE))
+ if (!strcmp(proxy->type->interface, IWD_AGENT_MANAGER_INTERFACE) ||
+ !strcmp(proxy->type->interface, IWD_DAEMON_INTERFACE))
return;
quit:
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
@@ -118,10 +118,14 @@ struct interface_type_desc {
} __attribute__((aligned(8)));
#define INTERFACE_TYPE(interface, init, exit) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
static struct interface_type_desc __interface_type_ ## interface\
- __attribute__((used, section("__interface"), aligned(8))) = {\
+ __attribute__((used, retain, section("__interface"), \
+ aligned(8))) = { \
#interface, init, exit \
}; \
+ _Pragma("GCC diagnostic pop")
bool dbus_proxy_init(void);
bool dbus_proxy_exit(void);
diff --git a/configure.ac b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
-AC_INIT(iwd, 1.19)
+AC_INIT(iwd, 1.20)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR(build-aux)
@@ -268,7 +268,7 @@ if (test "${enable_external_ell}" = "yes"); then
test "${enable_monitor}" != "no" ||
test "${enable_wired}" = "yes" ||
test "${enable_hwsim}" = "yes"); then
- ell_min_version="0.45"
+ ell_min_version="0.46"
else
ell_min_version="0.5"
fi
diff --git a/doc/agent-api.txt b/doc/agent-api.txt
@@ -25,6 +25,48 @@ Methods void RegisterAgent(object path)
[service].Failed
[service].NotFound
+ void RegisterNetworkConfigurationAgent(object path)
+
+ Register the agent for handling IPv4 and IPv6
+ configuration setting. This method and its
+ corresponding unregister method are only supported
+ if network configuration is enabled: see
+ EnableNetworkConfiguration in iwd.config(5) and
+ NetworkConfigurationEnabled in
+ net.connman.iwd.Daemon.GetInfo in daemon-api.txt.
+
+ During a station-mode, AP-mode or P2P connection, IWD
+ will obtain the IP configuration values for a network
+ interface, either automatically from a remote server
+ (DHCP or otherwise), generate it or read it from a
+ settings file. If no network configuration agent is
+ present, IWD immediately writes (commits) those
+ values to the corresponding interface, the routing
+ table and communicates them to the resolver. If such
+ agent is registered, IWD requests the agent to do
+ this last step.
+
+ Connection success is not signalled until the agent
+ method has returned. The agent may also be invoked
+ during the connection lifetime whenever the IP
+ configuration changes and after a roam. The agent
+ object must have the NetworkConfigurationAgent
+ interface.
+
+ Possible Errors: [service].InvalidArguments
+ [service].Failed
+ [service].AlreadyExists
+ [service].NotSupported
+
+ void UnregisterNetworkConfigurationAgent(object path)
+
+ Unregister an existing network configuration agent.
+
+ Possible Errors: [service].InvalidArguments
+ [service].Failed
+ [service].NotFound
+ [service].NotAvailable
+
Agent hierarchy
===============
@@ -86,3 +128,67 @@ Examples Requesting a passphrase for WPA2 network
RequestPassphrase("/net/connman/iwd/0/3/54657374_psk")
==> "secret123"
+
+
+NetworkConfigurationAgent hierarchy [experimental]
+===================================
+
+Service unique name
+Interface net.connman.iwd.NetworkConfigurationAgent
+Object path freely definable
+
+Methods void Release() [noreply]
+
+ This method gets called when the service daemon
+ unregisters the agent. An agent can use it to do
+ cleanup tasks. There is no need to unregister the
+ agent, because when this method gets called it has
+ already been unregistered.
+
+ void ConfigureIPv4(object device, string interface, dict config)
+
+ This method gets called during a connection setup
+ when a new set of IPv4 configuration values is to
+ be written to a network interface. The connection
+ is aborted if the method call returns an error or
+ times out. The 'config' dictionary (a{sv}) maps
+ string keys to values of types defined per key.
+
+ The following key/value pairs are used, but more
+ may be added in future versions.
+
+ string Method - Indicates whether the local address
+ was set statically (value "static") or obtained
+ automatically such as through DHCP (value "auto").
+ Even when the address was obtained from the remote
+ end some configuration bits, such as DNS addresses,
+ may have been overridden locally.
+
+ string Address - Local IP address string.
+
+ byte PrefixLength - Holds the prefix-length of the
+ local subnet. For IPv4 this maps to the netmask.
+
+ string Gateway [optional] - Local subnet's gateway
+ address if one exists.
+
+ array(string) DomainNameServers [optional] - Holds
+ the list of DNS addresses configured if any exist.
+
+ array(string) DomainNames [optional] - Holds the
+ network's local domain names if any exist.
+
+ Possible Errors: net.connman.iwd.Agent.Error.Canceled
+
+ void ConfigureIPv6(object device, string interface, dict config)
+
+ Same as ConfigureIPv4 above but for IPv6.
+
+ void Cancel(object device, string interface,
+ string reason) [noreply]
+
+ This method gets called to indicate that the connection
+ request failed before a reply was returned. The
+ argument will indicate why the request is being
+ cancelled and may be "out-of-range", "user-canceled",
+ "timed-out" or "shutdown".
diff --git a/doc/test-runner.txt b/doc/test-runner.txt
@@ -19,9 +19,9 @@ 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
+ 6. python 3.9
7. haveged no ver. avail.
8. hostapd recent
9. <iwd>/tools/hwsim 0.0
@@ -29,6 +29,7 @@ OS:
11. ofono (optional)
12. phonesim (optional)
13. wpa_supplicant 2.9
+ 14. radvd 2.18
Note: The version for hostapd is listed as 'recent'. Older hostapd versions
will work but we are continually adopting new features from hostapd and using
diff --git a/src/anqp.c b/src/anqp.c
@@ -256,7 +256,7 @@ uint32_t anqp_request(uint64_t wdev_id, const uint8_t *addr,
&anqp_frame_prefix, anqp_response_frame_event,
NULL);
- return true;
+ return request->id;
}
void anqp_cancel(uint32_t id)
diff --git a/src/ap.c b/src/ap.c
@@ -101,6 +101,8 @@ struct ap_state {
bool started : 1;
bool gtk_set : 1;
bool netconfig_set_addr4 : 1;
+ bool in_event : 1;
+ bool free_pending : 1;
};
struct sta_state {
@@ -250,6 +252,35 @@ static void ap_reset(struct ap_state *ap)
}
}
+static bool ap_event_done(struct ap_state *ap, bool prev_in_event)
+{
+ ap->in_event = prev_in_event;
+
+ if (!prev_in_event && ap->free_pending) {
+ ap_free(ap);
+ return true;
+ }
+
+ return ap->free_pending;
+}
+
+/*
+ * Returns true if the AP is considered freed and the caller must avoid
+ * accessing @ap.
+ */
+static bool ap_event(struct ap_state *ap, enum ap_event_type event,
+ const void *event_data)
+{
+ bool prev = ap->in_event;
+
+ if (ap->free_pending)
+ return true;
+
+ ap->in_event = true;
+ ap->ops->handle_event(event, event_data, ap->user_data);
+ return ap_event_done(ap, prev);
+}
+
static void ap_del_station(struct sta_state *sta, uint16_t reason,
bool disassociate)
{
@@ -284,23 +315,34 @@ static void ap_del_station(struct sta_state *sta, uint16_t reason,
ap_stop_handshake(sta);
/*
+ * If the event handler tears the AP down, we've made sure above that
+ * a subsequent ap_sta_free(sta) has no need to access sta->ap.
+ */
+ if (send_event)
+ if (ap_event(ap, AP_EVENT_STATION_REMOVED, &event_data))
+ return;
+
+ /*
* Expire any DHCP leases owned by this client when it disconnects to
* make it harder for somebody to DoS the IP pool. If the client
* comes back and the lease is still in the expired leases list they
* will get their IP back.
*/
if (ap->netconfig_dhcp) {
+ bool prev = ap->in_event;
+
+ /*
+ * If the LEASE_EXPIRED event in ap_dhcp_event_cb triggers an
+ * ap_free(), delay cleanup to avoid destroying the DHCP
+ * server midway through l_dhcp_server_expire_by_mac().
+ */
+ ap->in_event = true;
+
sta->ip_alloc_lease = NULL;
l_dhcp_server_expire_by_mac(ap->netconfig_dhcp, sta->addr);
- }
- /*
- * If the event handler tears the AP down, we've made sure above that
- * a subsequent ap_sta_free(sta) has no need to access sta->ap.
- */
- if (send_event)
- ap->ops->handle_event(AP_EVENT_STATION_REMOVED, &event_data,
- ap->user_data);
+ ap_event_done(ap, prev);
+ }
}
static bool ap_sta_match_addr(const void *a, const void *b)
@@ -335,19 +377,16 @@ static void ap_del_key_cb(struct l_genl_msg *msg, void *user_data)
static void ap_new_rsna(struct sta_state *sta)
{
struct ap_state *ap = sta->ap;
+ struct ap_event_station_added_data event_data = {};
l_debug("STA "MAC" authenticated", MAC_STR(sta->addr));
sta->rsna = true;
- if (ap->ops->handle_event) {
- struct ap_event_station_added_data event_data = {};
- event_data.mac = sta->addr;
- event_data.assoc_ies = sta->assoc_ies;
- event_data.assoc_ies_len = sta->assoc_ies_len;
- ap->ops->handle_event(AP_EVENT_STATION_ADDED, &event_data,
- ap->user_data);
- }
+ event_data.mac = sta->addr;
+ event_data.assoc_ies = sta->assoc_ies;
+ event_data.assoc_ies_len = sta->assoc_ies_len;
+ ap_event(ap, AP_EVENT_STATION_ADDED, &event_data);
}
static void ap_drop_rsna(struct sta_state *sta)
@@ -356,6 +395,7 @@ static void ap_drop_rsna(struct sta_state *sta)
struct l_genl_msg *msg;
uint32_t ifindex = netdev_get_ifindex(sta->ap->netdev);
uint8_t key_id = 0;
+ struct ap_event_station_removed_data event_data = {};
sta->rsna = false;
@@ -380,12 +420,8 @@ static void ap_drop_rsna(struct sta_state *sta)
ap_stop_handshake(sta);
- if (ap->ops->handle_event) {
- struct ap_event_station_removed_data event_data = {};
- event_data.mac = sta->addr;
- ap->ops->handle_event(AP_EVENT_STATION_REMOVED, &event_data,
- ap->user_data);
- }
+ event_data.mac = sta->addr;
+ ap_event(ap, AP_EVENT_STATION_REMOVED, &event_data);
}
static void ap_set_rsn_info(struct ap_state *ap, struct ie_rsn_info *rsn)
@@ -405,7 +441,7 @@ static void ap_wsc_exit_pbc(struct ap_state *ap)
ap->wsc_dpid = 0;
ap_update_beacon(ap);
- ap->ops->handle_event(AP_EVENT_PBC_MODE_EXIT, NULL, ap->user_data);
+ ap_event(ap, AP_EVENT_PBC_MODE_EXIT, NULL);
}
struct ap_pbc_record_expiry_data {
@@ -1090,9 +1126,7 @@ static void ap_wsc_handshake_event(struct handshake_state *hs,
&expiry_data);
event_data.mac = sta->addr;
- sta->ap->ops->handle_event(AP_EVENT_REGISTRATION_SUCCESS,
- &event_data,
- sta->ap->user_data);
+ ap_event(sta->ap, AP_EVENT_REGISTRATION_SUCCESS, &event_data);
break;
default:
break;
@@ -1594,11 +1628,11 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
const char *ssid = NULL;
const uint8_t *rsn = NULL;
size_t ssid_len = 0;
- struct l_uintset *rates = NULL;
+ _auto_(l_uintset_free) struct l_uintset *rates = NULL;
struct ie_rsn_info rsn_info;
int err;
struct ie_tlv_iter iter;
- uint8_t *wsc_data = NULL;
+ _auto_(l_free) uint8_t *wsc_data = NULL;
ssize_t wsc_data_len;
bool fils_ip_req = false;
struct ie_fils_ip_addr_request_info fils_ip_req_info;
@@ -1685,9 +1719,6 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
goto bad_frame;
}
- l_free(wsc_data);
- wsc_data = NULL;
-
if (wsc_req.request_type !=
WSC_REQUEST_TYPE_ENROLLEE_OPEN_8021X) {
err = MMPDU_REASON_CODE_INVALID_IE;
@@ -1728,8 +1759,9 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
event_data.mac = sta->addr;
event_data.assoc_ies = ies;
event_data.assoc_ies_len = ies_len;
- ap->ops->handle_event(AP_EVENT_REGISTRATION_START, &event_data,
- ap->user_data);
+
+ if (ap_event(ap, AP_EVENT_REGISTRATION_START, &event_data))
+ return;
/*
* Since we're starting the PBC Registration Protocol
@@ -1781,7 +1813,7 @@ static void ap_assoc_reassoc(struct sta_state *sta, bool reassoc,
if (sta->rates)
l_uintset_free(sta->rates);
- sta->rates = rates;
+ sta->rates = l_steal_ptr(rates);
l_free(sta->assoc_ies);
@@ -1823,11 +1855,6 @@ bad_frame:
else if (sta->associated)
ap_stop_handshake(sta);
- if (rates)
- l_uintset_free(rates);
-
- l_free(wsc_data);
-
if (!ap_assoc_resp(ap, sta, sta->addr, err, reassoc,
req, (void *) ies + ies_len - (void *) req,
NULL, ap_fail_assoc_resp_cb))
@@ -2209,6 +2236,7 @@ static void ap_start_failed(struct ap_state *ap, int err)
{
struct ap_event_start_failed_data data = { err };
+ ap->in_event = true;
ap->ops->handle_event(AP_EVENT_START_FAILED, &data, ap->user_data);
ap_reset(ap);
l_genl_family_free(ap->nl80211);
@@ -2224,13 +2252,11 @@ static void ap_dhcp_event_cb(struct l_dhcp_server *server,
switch (event) {
case L_DHCP_SERVER_EVENT_NEW_LEASE:
- ap->ops->handle_event(AP_EVENT_DHCP_NEW_LEASE, lease,
- ap->user_data);
+ ap_event(ap, AP_EVENT_DHCP_NEW_LEASE, lease);
break;
case L_DHCP_SERVER_EVENT_LEASE_EXPIRED:
- ap->ops->handle_event(AP_EVENT_DHCP_LEASE_EXPIRED, lease,
- ap->user_data);
+ ap_event(ap, AP_EVENT_DHCP_LEASE_EXPIRED, lease);
break;
default:
@@ -2267,7 +2293,7 @@ static void ap_start_cb(struct l_genl_msg *msg, void *user_data)
}
ap->started = true;
- ap->ops->handle_event(AP_EVENT_STARTED, NULL, ap->user_data);
+ ap_event(ap, AP_EVENT_STARTED, NULL);
}
static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
@@ -2552,6 +2578,8 @@ static void ap_mlme_notify(struct l_genl_msg *msg, void *user_data)
switch (l_genl_msg_get_command(msg)) {
case NL80211_CMD_STOP_AP:
+ ap->in_event = true;
+
if (ap->start_stop_cmd_id) {
struct ap_event_start_failed_data data = { -ECANCELED };
@@ -3304,7 +3332,9 @@ void ap_shutdown(struct ap_state *ap, ap_stopped_func_t stopped_func,
if (ap->started) {
ap->started = false;
- ap->ops->handle_event(AP_EVENT_STOPPING, NULL, ap->user_data);
+
+ if (ap_event(ap, AP_EVENT_STOPPING, NULL))
+ return;
}
ap_reset(ap);
@@ -3355,6 +3385,11 @@ free_ap:
/* Free @ap without a graceful shutdown */
void ap_free(struct ap_state *ap)
{
+ if (ap->in_event) {
+ ap->free_pending = true;
+ return;
+ }
+
ap_reset(ap);
l_genl_family_free(ap->nl80211);
l_free(ap);
diff --git a/src/eap-private.h b/src/eap-private.h
@@ -94,10 +94,14 @@ struct eap_method_desc {
} __attribute__((aligned(8)));
#define EAP_METHOD_BUILTIN(name, init, exit) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
static struct eap_method_desc __eap_builtin_ ## name \
- __attribute__((used, section("__eap"), aligned(8))) = { \
+ __attribute__((used, retain, section("__eap"), \
+ aligned(8))) = { \
#name, init, exit \
}; \
+ _Pragma("GCC diagnostic pop")
int eap_register_method(struct eap_method *method);
int eap_unregister_method(struct eap_method *method);
diff --git a/src/eap.c b/src/eap.c
@@ -413,8 +413,14 @@ static const char *eap_type_to_str(enum eap_type type, uint32_t vendor_id,
return buf;
}
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
#define IS_EXPANDED_RESPONSE(id, t) \
(type == EAP_TYPE_EXPANDED && vendor_id == (id) && vendor_type == (t))
+_Pragma("GCC diagnostic pop")
+
+#define RESPONSE_IS(t) \
+ (type == (t) || IS_EXPANDED_RESPONSE(0, (t)))
static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
size_t len)
@@ -428,14 +434,6 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
eap->method->vendor_id[2];
uint32_t our_vendor_type = eap->method->vendor_type;
- bool response_is(enum eap_type wanted)
- {
- if (type == wanted)
- return true;
-
- return IS_EXPANDED_RESPONSE(0, wanted);
- }
-
if (len < 1)
/* Invalid packets to be ignored */
return;
@@ -461,7 +459,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
return;
}
- if (response_is(EAP_TYPE_NAK)) {
+ if (RESPONSE_IS(EAP_TYPE_NAK)) {
l_debug("EAP peer not configured for method: %s",
eap_type_to_str(our_type, our_vendor_id,
our_vendor_type));
@@ -500,7 +498,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
*/
if (!eap->identity) {
- if (!response_is(EAP_TYPE_IDENTITY))
+ if (!RESPONSE_IS(EAP_TYPE_IDENTITY))
goto unsupported_method;
/*
@@ -528,7 +526,7 @@ static void eap_handle_response(struct eap_state *eap, const uint8_t *pkt,
* (with the exception of the Nak)
*/
if (our_type != EAP_TYPE_EXPANDED) {
- if (response_is(our_type))
+ if (RESPONSE_IS(our_type))
goto handle_response;
} else if (IS_EXPANDED_RESPONSE(our_vendor_id, our_vendor_type))
goto handle_response;
diff --git a/src/ie.c b/src/ie.c
@@ -2035,7 +2035,8 @@ int ie_build_roaming_consortium(const uint8_t *rc, size_t rc_len, uint8_t *to)
}
int ie_parse_hs20_indication(struct ie_tlv_iter *iter, uint8_t *version_out,
- uint16_t *pps_mo_id_out, uint8_t *domain_id_out)
+ uint16_t *pps_mo_id_out, uint8_t *domain_id_out,
+ bool *dgaf_disable_out)
{
unsigned int len = ie_tlv_iter_get_length(iter);
const uint8_t *data = ie_tlv_iter_get_data(iter);
@@ -2060,6 +2061,9 @@ int ie_parse_hs20_indication(struct ie_tlv_iter *iter, uint8_t *version_out,
if (pps_mo_present && domain_id_present)
return -EPROTOTYPE;
+ if (dgaf_disable_out)
+ *dgaf_disable_out = test_bit(&hs20_config, 0);
+
if (version_out)
*version_out = bit_field(hs20_config, 4, 4);
@@ -2087,7 +2091,7 @@ int ie_parse_hs20_indication(struct ie_tlv_iter *iter, uint8_t *version_out,
int ie_parse_hs20_indication_from_data(const uint8_t *data, size_t len,
uint8_t *version, uint16_t *pps_mo_id,
- uint8_t *domain_id)
+ uint8_t *domain_id, bool *dgaf_disable)
{
struct ie_tlv_iter iter;
@@ -2099,7 +2103,8 @@ int ie_parse_hs20_indication_from_data(const uint8_t *data, size_t len,
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_VENDOR_SPECIFIC)
return -EPROTOTYPE;
- return ie_parse_hs20_indication(&iter, version, pps_mo_id, domain_id);
+ return ie_parse_hs20_indication(&iter, version, pps_mo_id, domain_id,
+ dgaf_disable);
}
/*
diff --git a/src/ie.h b/src/ie.h
@@ -616,10 +616,11 @@ int ie_parse_roaming_consortium_from_data(const uint8_t *data, size_t len,
int ie_build_roaming_consortium(const uint8_t *rc, size_t rc_len, uint8_t *to);
int ie_parse_hs20_indication(struct ie_tlv_iter *iter, uint8_t *version,
- uint16_t *pps_mo_id, uint8_t *domain_id);
+ uint16_t *pps_mo_id, uint8_t *domain_id,
+ bool *dgaf_disable);
int ie_parse_hs20_indication_from_data(const uint8_t *data, size_t len,
uint8_t *version, uint16_t *pps_mo_id,
- uint8_t *domain_id);
+ uint8_t *domain_id, bool *dgaf_disable);
int ie_build_hs20_indication(uint8_t version, uint8_t *to);
enum ie_rsnx_capability {
diff --git a/src/module.h b/src/module.h
@@ -33,19 +33,25 @@ struct iwd_module_depends {
};
#define IWD_MODULE(name, init, exit) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
static struct iwd_module_desc __iwd_module_ ## name \
- __attribute__((used, section("__iwd_module"), aligned(8))) = {\
+ __attribute__((used, retain, section("__iwd_module"), \
+ aligned(8))) = { \
#name, init, exit \
- };
+ }; \
+ _Pragma("GCC diagnostic pop")
#define IWD_MODULE_DEPENDS(name, dep) \
- static struct iwd_module_depends \
- __iwd_module__##name##_##dep \
- __attribute__((used, section("__iwd_module_dep"), \
- aligned(8))) = { \
- .self = #name, \
- .target = #dep, \
- };
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
+ static struct iwd_module_depends __iwd_module__##name##_##dep \
+ __attribute__((used, retain, \
+ section("__iwd_module_dep"), aligned(8))) = { \
+ .self = #name, \
+ .target = #dep, \
+ }; \
+ _Pragma("GCC diagnostic pop")
int iwd_modules_init(void);
void iwd_modules_exit(void);
diff --git a/src/netconfig.c b/src/netconfig.c
@@ -50,6 +50,7 @@
#include "src/util.h"
#include "src/ie.h"
#include "src/netconfig.h"
+#include "src/sysfs.h"
struct netconfig {
uint32_t ifindex;
@@ -102,38 +103,6 @@ static void do_debug(const char *str, void *user_data)
l_info("%s%s", prefix, str);
}
-static int write_string(const char *file, const char *value)
-{
- size_t l = strlen(value);
- int fd;
- int r;
-
- fd = L_TFR(open(file, O_WRONLY));
- if (fd < 0)
- return -errno;
-
- r = L_TFR(write(fd, value, l));
- L_TFR(close(fd));
-
- return r;
-}
-
-static int sysfs_write_ipv6_setting(const char *ifname, const char *setting,
- const char *value)
-{
- int r;
-
- L_AUTO_FREE_VAR(char *, file) =
- l_strdup_printf("/proc/sys/net/ipv6/conf/%s/%s",
- ifname, setting);
-
- r = write_string(file, value);
- if (r < 0)
- l_error("Unable to write %s to %s", setting, file);
-
- return r;
-}
-
static void netconfig_free_settings(struct netconfig *netconfig)
{
l_rtnl_address_free(netconfig->v4_address);
@@ -207,6 +176,36 @@ static inline char *netconfig_ipv6_to_string(const uint8_t *addr)
return addr_str;
}
+static bool netconfig_use_fils_addr(struct netconfig *netconfig, int af)
+{
+ if ((af == AF_INET ? netconfig->rtm_protocol :
+ netconfig->rtm_v6_protocol) != RTPROT_DHCP)
+ return false;
+
+ if (!netconfig->fils_override)
+ return false;
+
+ if (af == AF_INET)
+ return !!netconfig->fils_override->ipv4_addr;
+
+ return !l_memeqzero(netconfig->fils_override->ipv6_addr, 16);
+}
+
+static bool netconfig_use_fils_gateway(struct netconfig *netconfig, int af)
+{
+ if ((af == AF_INET ? netconfig->rtm_protocol :
+ netconfig->rtm_v6_protocol) != RTPROT_DHCP)
+ return false;
+
+ if (!netconfig->fils_override)
+ return false;
+
+ if (af == AF_INET)
+ return !!netconfig->fils_override->ipv4_gateway;
+
+ return !l_memeqzero(netconfig->fils_override->ipv6_gateway, 16);
+}
+
static char **netconfig_get_dns_list(struct netconfig *netconfig, int af,
const uint8_t **out_dns_mac)
{
@@ -490,7 +489,7 @@ static char *netconfig_ipv4_get_gateway(struct netconfig *netconfig,
return gateway;
case RTPROT_DHCP:
- if (fils && fils->ipv4_gateway) {
+ if (netconfig_use_fils_gateway(netconfig, AF_INET)) {
gateway = netconfig_ipv4_to_string(fils->ipv4_gateway);
if (gateway && out_mac &&
@@ -558,10 +557,7 @@ static struct l_rtnl_route *netconfig_get_static6_gateway(
gateway = l_settings_get_string(netconfig->active_settings,
"IPv6", "Gateway");
- if (!gateway && netconfig->rtm_v6_protocol == RTPROT_DHCP &&
- netconfig->fils_override &&
- !l_memeqzero(netconfig->fils_override->ipv6_gateway,
- 16)) {
+ if (!gateway && netconfig_use_fils_gateway(netconfig, AF_INET6)) {
gateway = netconfig_ipv6_to_string(
netconfig->fils_override->ipv6_gateway);
@@ -729,8 +725,7 @@ static void netconfig_ifaddr_ipv6_added(struct netconfig *netconfig,
ip, ifa->ifa_prefixlen);
if (netconfig->rtm_v6_protocol != RTPROT_DHCP ||
- (netconfig->fils_override &&
- !l_memeqzero(netconfig->fils_override->ipv6_addr, 16)))
+ netconfig_use_fils_addr(netconfig, AF_INET6))
return;
inet_pton(AF_INET6, ip, &in6);
@@ -844,10 +839,8 @@ static void netconfig_route6_add_cb(int error, uint16_t type,
}
}
-static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
+static bool netconfig_ipv4_subnet_route_install(struct netconfig *netconfig)
{
- L_AUTO_FREE_VAR(char *, gateway) = NULL;
- const uint8_t *gateway_mac = NULL;
struct in_addr in_addr;
char ip[INET_ADDRSTRLEN];
char network[INET_ADDRSTRLEN];
@@ -870,10 +863,19 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
netconfig_route_generic_cb,
netconfig, NULL)) {
l_error("netconfig: Failed to add subnet route.");
-
return false;
}
+ return true;
+}
+
+static bool netconfig_ipv4_gateway_route_install(struct netconfig *netconfig)
+{
+ L_AUTO_FREE_VAR(char *, gateway) = NULL;
+ const uint8_t *gateway_mac = NULL;
+ struct in_addr in_addr;
+ char ip[INET_ADDRSTRLEN];
+
gateway = netconfig_ipv4_get_gateway(netconfig, &gateway_mac);
if (!gateway) {
l_debug("No gateway obtained from %s.",
@@ -889,6 +891,10 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
return true;
}
+ if (!l_rtnl_address_get_address(netconfig->v4_address, ip) ||
+ inet_pton(AF_INET, ip, &in_addr) < 1)
+ return false;
+
netconfig->route4_add_gateway_cmd_id =
l_rtnl_route4_add_gateway(rtnl, netconfig->ifindex, gateway, ip,
ROUTE_PRIORITY_OFFSET,
@@ -902,23 +908,20 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
return false;
}
- if (gateway_mac) {
- /*
- * Attempt to use the gateway MAC address received from the AP
- * by writing the mapping directly into the netdev's ARP table
- * so as to save one data frame roundtrip before first IP
- * connections are established. This is very low-priority but
- * print error messages just because they may indicate bigger
- * problems.
- */
- if (!l_rtnl_neighbor_set_hwaddr(rtnl, netconfig->ifindex,
+ /*
+ * Attempt to use the gateway MAC address received from the AP by
+ * writing the mapping directly into the netdev's ARP table so as
+ * to save one data frame roundtrip before first IP connections
+ * are established. This is very low-priority but print error
+ * messages just because they may indicate bigger problems.
+ */
+ if (gateway_mac && !l_rtnl_neighbor_set_hwaddr(rtnl, netconfig->ifindex,
AF_INET,
&netconfig->fils_override->ipv4_gateway,
gateway_mac, 6,
netconfig_set_neighbor_entry_cb, NULL,
NULL))
- l_debug("l_rtnl_neighbor_set_hwaddr failed");
- }
+ l_debug("l_rtnl_neighbor_set_hwaddr failed");
return true;
}
@@ -939,10 +942,9 @@ static void netconfig_ipv4_ifaddr_add_cmd_cb(int error, uint16_t type,
netconfig_gateway_to_arp(netconfig);
- if (!netconfig_ipv4_routes_install(netconfig)) {
- l_error("netconfig: Failed to install IPv4 routes.");
+ if (!netconfig_ipv4_subnet_route_install(netconfig) ||
+ !netconfig_ipv4_gateway_route_install(netconfig))
return;
- }
netconfig_set_dns(netconfig);
netconfig_set_domains(netconfig);
@@ -1216,9 +1218,7 @@ static bool netconfig_ipv4_select_and_install(struct netconfig *netconfig)
struct netdev *netdev = netdev_find(netconfig->ifindex);
bool set_address = (netconfig->rtm_protocol == RTPROT_STATIC);
- if (netconfig->rtm_protocol == RTPROT_DHCP &&
- netconfig->fils_override &&
- netconfig->fils_override->ipv4_addr) {
+ if (netconfig_use_fils_addr(netconfig, AF_INET)) {
L_AUTO_FREE_VAR(char *, addr_str) = netconfig_ipv4_to_string(
netconfig->fils_override->ipv4_addr);
uint8_t prefix_len = netconfig->fils_override->ipv4_prefix_len;
@@ -1299,9 +1299,7 @@ static bool netconfig_ipv6_select_and_install(struct netconfig *netconfig)
sysfs_write_ipv6_setting(netdev_get_name(netdev), "disable_ipv6", "0");
- if (netconfig->rtm_v6_protocol == RTPROT_DHCP &&
- netconfig->fils_override &&
- !l_memeqzero(netconfig->fils_override->ipv6_addr, 16)) {
+ if (netconfig_use_fils_addr(netconfig, AF_INET6)) {
uint8_t prefix_len = netconfig->fils_override->ipv6_prefix_len;
L_AUTO_FREE_VAR(char *, addr_str) = netconfig_ipv6_to_string(
netconfig->fils_override->ipv6_addr);
@@ -1500,7 +1498,7 @@ bool netconfig_configure(struct netconfig *netconfig,
return true;
}
-bool netconfig_reconfigure(struct netconfig *netconfig)
+bool netconfig_reconfigure(struct netconfig *netconfig, bool set_arp_gw)
{
/*
* Starting with kernel 4.20, ARP cache is flushed when the netdev
@@ -1509,7 +1507,8 @@ bool netconfig_reconfigure(struct netconfig *netconfig)
* lost or delayed. Try to force the gateway into the ARP cache
* to alleviate this
*/
- netconfig_gateway_to_arp(netconfig);
+ if (set_arp_gw)
+ netconfig_gateway_to_arp(netconfig);
if (netconfig->rtm_protocol == RTPROT_DHCP) {
/* TODO l_dhcp_client sending a DHCP inform request */
diff --git a/src/netconfig.h b/src/netconfig.h
@@ -36,7 +36,7 @@ bool netconfig_load_settings(struct netconfig *netconfig,
bool netconfig_configure(struct netconfig *netconfig,
netconfig_notify_func_t notify,
void *user_data);
-bool netconfig_reconfigure(struct netconfig *netconfig);
+bool netconfig_reconfigure(struct netconfig *netconfig, bool set_arp_gw);
bool netconfig_reset(struct netconfig *netconfig);
char *netconfig_get_dhcp_server_ipv4(struct netconfig *netconfig);
bool netconfig_get_fils_ip_req(struct netconfig *netconfig,
diff --git a/src/scan.c b/src/scan.c
@@ -1058,6 +1058,7 @@ static void scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
{
uint16_t cost_level;
uint16_t cost_flags;
+ bool dgaf_disable;
if (!bss->wpa && is_ie_wpa_ie(data, len)) {
bss->wpa = l_memdup(data - 2, len + 2);
@@ -1071,9 +1072,11 @@ static void scan_parse_vendor_specific(struct scan_bss *bss, const void *data,
if (is_ie_wfa_ie(data, len, IE_WFA_OI_HS20_INDICATION)) {
if (ie_parse_hs20_indication_from_data(data - 2, len + 2,
- &bss->hs20_version, NULL, NULL) < 0)
+ &bss->hs20_version, NULL, NULL,
+ &dgaf_disable) < 0)
return;
+ bss->hs20_dgaf_disable = dgaf_disable;
bss->hs20_capable = true;
return;
}
@@ -1252,6 +1255,23 @@ static bool scan_parse_bss_information_elements(struct scan_bss *bss,
bss->rc_ie = l_memdup(iter.data - 2, iter.len + 2);
break;
+
+ case IE_TYPE_EXTENDED_CAPABILITIES:
+ /* 802.11-2020 9.4.2.26
+ *
+ * "The length of the Extended Capabilities field is
+ * variable. If fewer bits are received in an Extended
+ * Capabilities field than shown in Table 9-153, the
+ * rest of the Extended Capabilities field bits are
+ * assumed to be zero"
+ *
+ * Currently only Proxy ARP bit (12) is checked, and if
+ * not found, this is not a fatal error.
+ */
+ if (iter.len < 2)
+ break;
+
+ bss->proxy_arp = test_bit(iter.data, 12);
}
}
@@ -1608,6 +1628,10 @@ int scan_bss_rank_compare(const void *a, const void *b, void *user_data)
{
const struct scan_bss *new_bss = a, *bss = b;
+ if (bss->rank == new_bss->rank)
+ return (bss->signal_strength >
+ new_bss->signal_strength) ? 1 : -1;
+
return (bss->rank > new_bss->rank) ? 1 : -1;
}
diff --git a/src/scan.h b/src/scan.h
@@ -86,6 +86,8 @@ struct scan_bss {
bool anqp_capable : 1;
bool hs20_capable : 1;
bool force_default_sae_group : 1;
+ bool proxy_arp : 1;
+ bool hs20_dgaf_disable : 1;
uint8_t cost_level : 3;
uint8_t cost_flags : 4;
};
diff --git a/src/station.c b/src/station.c
@@ -57,12 +57,15 @@
#include "src/anqputil.h"
#include "src/diagnostic.h"
#include "src/frame-xchg.h"
+#include "src/sysfs.h"
static struct l_queue *station_list;
static uint32_t netdev_watch;
static uint32_t mfp_setting;
static uint32_t roam_retry_interval;
static bool anqp_disabled;
+static bool supports_arp_evict_nocarrier;
+static bool supports_ndisc_evict_nocarrier;
static struct watchlist event_watches;
struct station {
@@ -697,6 +700,10 @@ static bool network_has_open_pair(struct network *network, struct scan_bss *owe)
struct scan_bss *open = entry->data;
struct ie_owe_transition_info *open_info = open->owe_trans;
+ /* AP does not advertise owe transition */
+ if (!open_info)
+ continue;
+
/*
* Check if this is an Open/Hidden pair:
*
@@ -1386,6 +1393,44 @@ static const char *station_state_to_string(enum station_state state)
return "invalid";
}
+static void station_set_evict_nocarrier(struct station *station, bool value)
+{
+ char *v = value ? "1" : "0";
+
+ if (supports_arp_evict_nocarrier)
+ sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+ "arp_evict_nocarrier", v);
+
+ if (supports_ndisc_evict_nocarrier)
+ sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+ "ndisc_evict_nocarrier", v);
+}
+
+/*
+ * Handles dropping ARP (IPv4) and neighbor advertisements (IPv6) settings.
+ */
+static void station_set_drop_neighbor_discovery(struct station *station,
+ bool value)
+{
+ char *v = value ? "1" : "0";
+
+ sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+ "drop_gratuitous_arp", v);
+ sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+ "drop_unsolicited_na", v);
+}
+
+static void station_set_drop_unicast_l2_multicast(struct station *station,
+ bool value)
+{
+ char *v = value ? "1" : "0";
+
+ sysfs_write_ipv4_setting(netdev_get_name(station->netdev),
+ "drop_unicast_in_l2_multicast", v);
+ sysfs_write_ipv6_setting(netdev_get_name(station->netdev),
+ "drop_unicast_in_l2_multicast", v);
+}
+
static void station_enter_state(struct station *station,
enum station_state state)
{
@@ -1439,9 +1484,6 @@ static void station_enter_state(struct station *station,
periodic_scan_stop(station);
break;
- case STATION_STATE_DISCONNECTED:
- periodic_scan_stop(station);
- break;
case STATION_STATE_CONNECTED:
#ifdef HAVE_DBUS
l_dbus_object_add_interface(dbus,
@@ -1450,10 +1492,40 @@ static void station_enter_state(struct station *station,
station);
#endif
periodic_scan_stop(station);
+
+ station_set_evict_nocarrier(station, true);
+
+ /*
+ * Hotspot Specification 2.0 - Section 6.5
+ *
+ * " - Shall drop all received {gratuitous ARP, unsolicited
+ * Neighbor Advertisement} messages when the Proxy ARP field
+ * is set to 1 in the Extended Capabilities element of the
+ * serving AP.
+ *
+ * - When the serving AP transmits frames containing an HS2.0
+ * Indication element in which the value of the DGAF Disable
+ * bit subfield is set to 0, the mobile device should
+ * discard all received unicast IP packets that were
+ * decrypted using the GTK"
+ */
+ if (station->connected_bss->proxy_arp)
+ station_set_drop_neighbor_discovery(station, true);
+ if (station->connected_bss->hs20_dgaf_disable)
+ station_set_drop_unicast_l2_multicast(station, true);
+
+ break;
+ case STATION_STATE_DISCONNECTED:
+ periodic_scan_stop(station);
+
+ station_set_evict_nocarrier(station, true);
+ station_set_drop_neighbor_discovery(station, false);
+ station_set_drop_unicast_l2_multicast(station, false);
break;
case STATION_STATE_DISCONNECTING:
break;
case STATION_STATE_ROAMING:
+ station_set_evict_nocarrier(station, false);
break;
}
@@ -1847,7 +1919,8 @@ static void station_roamed(struct station *station)
station_roam_timeout_rearm(station, roam_retry_interval);
if (station->netconfig)
- netconfig_reconfigure(station->netconfig);
+ netconfig_reconfigure(station->netconfig,
+ !supports_arp_evict_nocarrier);
if (station->roam_freqs) {
scan_freq_set_free(station->roam_freqs);
@@ -4495,6 +4568,11 @@ static int station_init(void)
if (!netconfig_enabled())
l_info("station: Network configuration is disabled.");
+ supports_arp_evict_nocarrier = sysfs_supports_ipv4_setting("all",
+ "arp_evict_nocarrier");
+ supports_ndisc_evict_nocarrier = sysfs_supports_ipv6_setting("all",
+ "ndisc_evict_nocarrier");
+
watchlist_init(&event_watches, NULL);
return 0;
diff --git a/src/sysfs.c b/src/sysfs.c
@@ -0,0 +1,109 @@
+/*
+ *
+ * Wireless daemon for Linux
+ *
+ * Copyright (C) 2021 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <ell/ell.h>
+
+#include "src/sysfs.h"
+
+static int write_string(const char *file, const char *value)
+{
+ size_t l = strlen(value);
+ int fd;
+ int r;
+
+ fd = L_TFR(open(file, O_WRONLY));
+ if (fd < 0)
+ return -errno;
+
+ r = L_TFR(write(fd, value, l));
+ L_TFR(close(fd));
+
+ return r;
+}
+
+static bool sysfs_supports_ip_setting(const char *ipv, const char *ifname,
+ const char *setting)
+{
+ struct stat st;
+ int err;
+ L_AUTO_FREE_VAR(char *, file) =
+ l_strdup_printf("/proc/sys/net/%s/conf/%s/%s", ipv,
+ ifname, setting);
+
+ err = stat(file, &st);
+
+ if (!err && S_ISREG(st.st_mode) != 0)
+ return true;
+
+ return false;
+}
+
+bool sysfs_supports_ipv6_setting(const char *ifname, const char *setting)
+{
+ return sysfs_supports_ip_setting("ipv6", ifname, setting);
+}
+
+int sysfs_write_ipv6_setting(const char *ifname, const char *setting,
+ const char *value)
+{
+ int r;
+
+ L_AUTO_FREE_VAR(char *, file) =
+ l_strdup_printf("/proc/sys/net/ipv6/conf/%s/%s",
+ ifname, setting);
+
+ r = write_string(file, value);
+ if (r < 0)
+ l_error("Unable to write %s to %s", setting, file);
+
+ return r;
+}
+
+bool sysfs_supports_ipv4_setting(const char *ifname, const char *setting)
+{
+ return sysfs_supports_ip_setting("ipv4", ifname, setting);
+}
+
+int sysfs_write_ipv4_setting(const char *ifname, const char *setting,
+ const char *value)
+{
+ int r;
+
+ L_AUTO_FREE_VAR(char *, file) =
+ l_strdup_printf("/proc/sys/net/ipv4/conf/%s/%s",
+ ifname, setting);
+
+ r = write_string(file, value);
+ if (r < 0)
+ l_error("Unable to write %s to %s", setting, file);
+
+ return r;
+}
diff --git a/src/sysfs.h b/src/sysfs.h
@@ -0,0 +1,28 @@
+/*
+ *
+ * Wireless daemon for Linux
+ *
+ * Copyright (C) 2021 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+bool sysfs_supports_ipv6_setting(const char *ifname, const char *setting);
+int sysfs_write_ipv6_setting(const char *ifname, const char *setting,
+ const char *value);
+bool sysfs_supports_ipv4_setting(const char *ifname, const char *setting);
+int sysfs_write_ipv4_setting(const char *ifname, const char *setting,
+ const char *value);
diff --git a/tools/test-runner b/tools/test-runner
@@ -45,7 +45,7 @@ TIOCSTTY = 0x540E
config = None
intf_id = 0
-TEST_MAX_TIMEOUT = 120
+TEST_MAX_TIMEOUT = 240
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -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):
@@ -955,7 +955,7 @@ class TestContext(Namespace):
else:
wpas_radios = [rad for rad in self.radios if rad.name in settings]
- self.wpas_interfaces = [rad.create_interface('wpa_supplicant.conf', 'wpas') \
+ self.wpas_interfaces = [rad.create_interface(settings[rad.name], 'wpas') \
for rad in wpas_radios]
def start_ofono(self):
@@ -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: