]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: use --bind-interfaces option for dnsmasq
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 17 Dec 2021 22:55:07 +0000 (07:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 18 Dec 2021 01:09:07 +0000 (10:09 +0900)
Also make the interface name and router address configurable.

test/test-network/systemd-networkd-tests.py

index 151270b8a26823c996511f09d2c76a274ce223d2..0f4f7a3bd69fdf28b60dcf07e62a2194a5383ff6 100755 (executable)
@@ -502,8 +502,8 @@ def remove_networkd_conf_dropin(dropins):
         if (os.path.exists(os.path.join(networkd_conf_dropin_path, dropin))):
             os.remove(os.path.join(networkd_conf_dropin_path, dropin))
 
-def start_dnsmasq(additional_options='', ipv4_range='192.168.5.10,192.168.5.200', ipv6_range='2600::10,2600::20', lease_time='1h'):
-    dnsmasq_command = f'dnsmasq -8 {dnsmasq_log_file} --log-queries=extra --log-dhcp --pid-file={dnsmasq_pid_file} --conf-file=/dev/null --interface=veth-peer --enable-ra --dhcp-range={ipv6_range},{lease_time} --dhcp-range={ipv4_range},{lease_time} -R --dhcp-leasefile={dnsmasq_lease_file} --dhcp-option=26,1492 --dhcp-option=option:router,192.168.5.1 --port=0 ' + additional_options
+def start_dnsmasq(additional_options='', interface='veth-peer', ipv4_range='192.168.5.10,192.168.5.200', ipv4_router='192.168.5.1', ipv6_range='2600::10,2600::20', lease_time='1h'):
+    dnsmasq_command = f'dnsmasq -8 {dnsmasq_log_file} --log-queries=extra --log-dhcp --pid-file={dnsmasq_pid_file} --conf-file=/dev/null --bind-interfaces --interface={interface} --enable-ra --dhcp-range={ipv6_range},{lease_time} --dhcp-range={ipv4_range},{lease_time} -R --dhcp-leasefile={dnsmasq_lease_file} --dhcp-option=26,1492 --dhcp-option=option:router,{ipv4_router} --port=0 ' + additional_options
     check_output(dnsmasq_command)
 
 def stop_by_pid_file(pid_file):