summaryrefslogtreecommitdiffstats
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-01-15 06:19:03 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2024-01-15 11:53:07 +0100
commita663ddc04e43a9234e00e47aed98bf2bbeb1573a (patch)
tree47af69b596d12f08ce0a6bd794c0b58127516b17 /test/test-network
parentresolve: on_transaction_stream_error() may free multiple transactions (diff)
downloadsystemd-a663ddc04e43a9234e00e47aed98bf2bbeb1573a.tar.xz
systemd-a663ddc04e43a9234e00e47aed98bf2bbeb1573a.zip
test-network: add simple test case for DHCP relay on bridge interface
For issue #30763.
Diffstat (limited to 'test/test-network')
-rw-r--r--test/test-network/conf/25-agent-bridge-port.network7
-rw-r--r--test/test-network/conf/25-agent-bridge.netdev4
-rw-r--r--test/test-network/conf/25-agent-bridge.network12
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py18
4 files changed, 41 insertions, 0 deletions
diff --git a/test/test-network/conf/25-agent-bridge-port.network b/test/test-network/conf/25-agent-bridge-port.network
new file mode 100644
index 0000000000..709a783431
--- /dev/null
+++ b/test/test-network/conf/25-agent-bridge-port.network
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=client-peer
+
+[Network]
+Bridge=bridge-relay
+IPv6AcceptRA=no
diff --git a/test/test-network/conf/25-agent-bridge.netdev b/test/test-network/conf/25-agent-bridge.netdev
new file mode 100644
index 0000000000..a611337f51
--- /dev/null
+++ b/test/test-network/conf/25-agent-bridge.netdev
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[NetDev]
+Name=bridge-relay
+Kind=bridge
diff --git a/test/test-network/conf/25-agent-bridge.network b/test/test-network/conf/25-agent-bridge.network
new file mode 100644
index 0000000000..8383790001
--- /dev/null
+++ b/test/test-network/conf/25-agent-bridge.network
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=bridge-relay
+
+[Network]
+Address=192.168.2.1/24
+DHCPServer=yes
+IPv6AcceptRA=no
+
+[DHCPServer]
+RelayTarget=192.168.1.1
+RelayAgentRemoteId=string:aabbccdd
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 4497019367..edf09b8120 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -5380,6 +5380,24 @@ class NetworkdDHCPServerRelayAgentTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, r'Address: 192.168.5.150 \(DHCP4 via 192.168.5.1\)')
+ def test_replay_agent_on_bridge(self):
+ copy_network_unit('25-agent-bridge.netdev',
+ '25-agent-veth-client.netdev',
+ '25-agent-bridge.network',
+ '25-agent-bridge-port.network',
+ '25-agent-client.network')
+ start_networkd()
+ self.wait_online(['bridge-relay:routable', 'client-peer:enslaved'])
+
+ # For issue #30763.
+ expect = 'bridge-relay: DHCPv4 server: STARTED'
+ for _ in range(20):
+ if expect in read_networkd_log():
+ break
+ time.sleep(0.5)
+ else:
+ self.fail()
+
class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
def setUp(self):