dnsmasq_tests.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # Copyright (c) 2014-2018 Oracle and/or its affiliates. All Rights Reserved.
  4. # Copyright (c) 2018 Petr Vorel <pvorel@suse.cz>
  5. #
  6. # Author: Alexey Kodanev alexey.kodanev@oracle.com
  7. dhcp_name="dnsmasq"
  8. . dhcp_lib.sh
  9. log="/var/log/dnsmasq.tst.log"
  10. lease_dir="/var/lib/misc"
  11. tst_selinux_enabled && lease_dir="/var/lib/dnsmasq"
  12. lease_file="$lease_dir/dnsmasq.tst.leases"
  13. common_opt="--no-hosts --no-resolv --dhcp-authoritative \
  14. --log-facility=$log --interface=$iface0 \
  15. --dhcp-leasefile=$lease_file --port=0 --conf-file= "
  16. start_dhcp()
  17. {
  18. dnsmasq $common_opt \
  19. --dhcp-range=10.1.1.100,10.1.1.100,255.255.255.0,2m \
  20. --dhcp-option=option:router --dhcp-option=option:dns-server
  21. }
  22. start_dhcp6()
  23. {
  24. # check that dnsmasq supports IPv6
  25. dnsmasq --dhcp-range=fd00::1,fd00::1 --test > /dev/null 2>&1 || \
  26. tst_brk TCONF "dnsmasq doesn't support DHCPv6"
  27. dnsmasq $common_opt \
  28. --dhcp-range=fd00:1:1:2::100,fd00:1:1:2::100 --enable-ra \
  29. --dhcp-option=option6:dns-server
  30. }
  31. cleanup_dhcp()
  32. {
  33. rm -f $log
  34. }
  35. print_dhcp_version()
  36. {
  37. dnsmasq --version | head -2
  38. }
  39. tst_run