]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Close pyrad server sockets explicitly
authorJouni Malinen <j@w1.fi>
Sun, 4 Aug 2019 20:50:56 +0000 (23:50 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 4 Aug 2019 21:10:32 +0000 (00:10 +0300)
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 <j@w1.fi>
tests/hwsim/test_eap_proto.py
tests/hwsim/test_radius.py

index 7aeaf968c6763a7b0f36f3ea5425038d11debe20..fad33bba586a99f5304b0aadd084f09f165e137e 100644 (file)
@@ -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",
index 6e825f0f5cc99569b5799ffa7ab58f6037084a04..dbefaf551e347e184a3c7ead155fee6a134c8d56 100644 (file)
@@ -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",