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 8dhcp_name="dnsmasq" 9 10. dhcp_lib.sh 11 12log="/var/log/dnsmasq.tst.log" 13 14lease_dir="/var/lib/misc" 15tst_selinux_enabled && lease_dir="/var/lib/dnsmasq" 16lease_file="$lease_dir/dnsmasq.tst.leases" 17 18common_opt="--no-hosts --no-resolv --dhcp-authoritative \ 19 --log-facility=$log --interface=$iface0 \ 20 --dhcp-leasefile=$lease_file --port=0 --conf-file= " 21 22start_dhcp() 23{ 24 dnsmasq $common_opt \ 25 --dhcp-range=10.1.1.100,10.1.1.100,255.255.255.0,2m \ 26 --dhcp-option=option:router --dhcp-option=option:dns-server 27} 28 29start_dhcp6() 30{ 31 # check that dnsmasq supports IPv6 32 dnsmasq --dhcp-range=fd00::1,fd00::1 --test > /dev/null 2>&1 || \ 33 tst_brk TCONF "dnsmasq doesn't support DHCPv6" 34 35 dnsmasq $common_opt \ 36 --dhcp-range=fd00:1:1:2::100,fd00:1:1:2::100 --enable-ra \ 37 --dhcp-option=option6:dns-server 38} 39 40cleanup_dhcp() 41{ 42 rm -f $log 43} 44 45print_dhcp_version() 46{ 47 dnsmasq --version | head -2 48} 49 50tst_run 51