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 12common_opt="--no-hosts --no-resolv --dhcp-authoritative \ 13 --log-facility=./tst_dnsmasq.log --interface=$iface0 \ 14 --dhcp-leasefile=tst_dnsmasq.lease --port=0 --conf-file= " 15 16start_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 23start_dhcp6() 24{ 25 # check that dnsmasq supports IPv6 26 dnsmasq --dhcp-range=fd00::1,fd00::1 --test > /dev/null 2>&1 || \ 27 tst_brk TCONF "dnsmasq doesn't support DHCPv6" 28 29 dnsmasq $common_opt \ 30 --dhcp-range=fd00:1:1:2::100,fd00:1:1:2::100 --enable-ra \ 31 --dhcp-option=option6:dns-server 32} 33 34cleanup_dhcp() 35{ 36 rm -f tst_dnsmasq.log 37} 38 39print_dhcp_log() 40{ 41 cat tst_dnsmasq.log 42} 43 44print_dhcp_version() 45{ 46 dnsmasq --version | head -2 47} 48 49tst_run 50