From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.linux.dev
Subject: [PATCH v2 3/4] autotests: Also validate correct hostname sent over DHCPv4
Date: Thu, 7 Jul 2022 22:03:08 +0200 [thread overview]
Message-ID: <20220707200309.3276163-3-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20220707200309.3276163-1-andrew.zaborowski@intel.com>
---
autotests/testNetconfig/auto.psk | 5 +++++
autotests/testNetconfig/connection_test.py | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 autotests/testNetconfig/auto.psk
diff --git a/autotests/testNetconfig/auto.psk b/autotests/testNetconfig/auto.psk
new file mode 100644
index 00000000..4077d65f
--- /dev/null
+++ b/autotests/testNetconfig/auto.psk
@@ -0,0 +1,5 @@
+[IPv4]
+SendHostname=true
+
+[Settings]
+AutoConnect=false
diff --git a/autotests/testNetconfig/connection_test.py b/autotests/testNetconfig/connection_test.py
index aebb0a2e..cf90993a 100644
--- a/autotests/testNetconfig/connection_test.py
+++ b/autotests/testNetconfig/connection_test.py
@@ -36,6 +36,8 @@ class Test(unittest.TestCase):
return socket.inet_pton(socket.AF_INET6, l.split(None, 1)[1].split('/', 1)[0])
return None
+ os.system("hostname test-sta")
+ IWD.copy_to_storage('auto.psk', name='ap-ns1.psk')
wd = IWD(True)
psk_agent = PSKAgent("secret123")
@@ -109,6 +111,7 @@ class Test(unittest.TestCase):
leases_file = self.parse_lease_file('/tmp/dhcpd.leases', socket.AF_INET)
lease = leases_file['leases'][socket.inet_pton(socket.AF_INET, '192.168.1.10')]
self.assertEqual(lease['state'], 'active')
+ self.assertEqual(lease['client-hostname'], 'test-sta')
self.assertTrue(lease['starts'] < connect_time)
self.assertTrue(lease['ends'] > connect_time)
# The T1 is 15 seconds per dhcpd.conf. This is the approximate interval between lease
@@ -123,6 +126,7 @@ class Test(unittest.TestCase):
leases_file = self.parse_lease_file('/tmp/dhcpd.leases', socket.AF_INET)
new_lease = leases_file['leases'][socket.inet_pton(socket.AF_INET, '192.168.1.10')]
self.assertEqual(new_lease['state'], 'active')
+ self.assertEqual(new_lease['client-hostname'], 'test-sta')
self.assertTrue(new_lease['starts'] > lease['starts'] + 10)
self.assertTrue(new_lease['starts'] < lease['starts'] + 25)
self.assertTrue(new_lease['ends'] > lease['ends'] + 10)
@@ -162,6 +166,7 @@ class Test(unittest.TestCase):
leases_file = self.parse_lease_file('/tmp/dhcpd.leases', socket.AF_INET)
new_lease = leases_file['leases'][socket.inet_pton(socket.AF_INET, '192.168.1.10')]
self.assertEqual(new_lease['state'], 'active')
+ self.assertEqual(lease['client-hostname'], 'test-sta')
self.assertTrue(new_lease['starts'] > lease['starts'] + 70)
self.assertTrue(new_lease['starts'] < lease['starts'] + 85)
self.assertTrue(new_lease['ends'] > lease['ends'] + 70)
--
2.34.1
next prev parent reply other threads:[~2022-07-07 20:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 20:03 [PATCH v2 1/4] test-runner: Support running hostapd in namespaces Andrew Zaborowski
2022-07-07 20:03 ` [PATCH v2 2/4] autotests: DHCPv4 renewal/resend test in testNetconfig Andrew Zaborowski
2022-07-07 20:03 ` Andrew Zaborowski [this message]
2022-07-07 20:03 ` [PATCH v2 4/4] test-runner: Mark source directory as safe for git Andrew Zaborowski
2022-07-07 22:37 ` [PATCH v2 1/4] test-runner: Support running hostapd in namespaces James Prestwood
2022-07-07 23:11 ` Andrew Zaborowski
2022-07-07 23:19 ` James Prestwood
2022-07-07 23:42 ` Andrew Zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220707200309.3276163-3-andrew.zaborowski@intel.com \
--to=andrew.zaborowski@intel.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox