From: Jouni Malinen Date: Sun, 4 Aug 2019 20:50:56 +0000 (+0300) Subject: tests: Close pyrad server sockets explicitly X-Git-Tag: hostap_2_9~22 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fhostap.git;a=commitdiff_plain;h=752e7a33e8d2767e541614be56a5b02cdcf25de6 tests: Close pyrad server sockets explicitly This helps in avoiding issues with another test case trying to bind to the same UDP port and failing due to the previous use by pyrad still being open. This showed up with failures in radius_ipv6 when it followed a test case like eap_proto_tls with suitable set of test cases between them. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_eap_proto.py b/tests/hwsim/test_eap_proto.py index 7aeaf968c..fad33bba5 100644 --- a/tests/hwsim/test_eap_proto.py +++ b/tests/hwsim/test_eap_proto.py @@ -145,6 +145,9 @@ def start_radius_server(eap_handler): else: logger.error("Unexpected event in pyrad server main loop") + for fd in self.authfds + self.acctfds: + fd.close() + srv = TestServer(dict=pyrad.dictionary.Dictionary("dictionary.radius"), authport=18138, acctport=18139) srv.hosts["127.0.0.1"] = pyrad.server.RemoteHost("127.0.0.1", diff --git a/tests/hwsim/test_radius.py b/tests/hwsim/test_radius.py index 6e825f0f5..dbefaf551 100644 --- a/tests/hwsim/test_radius.py +++ b/tests/hwsim/test_radius.py @@ -1079,6 +1079,9 @@ def test_radius_protocol(dev, apdev): else: logger.error("Unexpected event in pyrad server main loop") + for fd in self.authfds + self.acctfds: + fd.close() + srv = TestServer(dict=pyrad.dictionary.Dictionary("dictionary.radius"), authport=18138, acctport=18139) srv.hosts["127.0.0.1"] = pyrad.server.RemoteHost("127.0.0.1", @@ -1193,6 +1196,9 @@ def start_radius_psk_server(psk, invalid_code=False, acct_interim_interval=0, else: logger.error("Unexpected event in pyrad server main loop") + for fd in self.authfds + self.acctfds: + fd.close() + srv = TestServer(dict=pyrad.dictionary.Dictionary("dictionary.radius"), authport=18138, acctport=18139) srv.hosts["127.0.0.1"] = pyrad.server.RemoteHost("127.0.0.1", @@ -1471,6 +1477,9 @@ def test_ap_vlan_wpa2_psk_radius_required(dev, apdev): else: logger.error("Unexpected event in pyrad server main loop") + for fd in self.authfds + self.acctfds: + fd.close() + srv = TestServer(dict=pyrad.dictionary.Dictionary("dictionary.radius"), authport=18138, acctport=18139) srv.hosts["127.0.0.1"] = pyrad.server.RemoteHost("127.0.0.1",