#!/bin/bash . /usr/lib/network/functions action="${1}" assert isset action interface="${2}" assert isset interface proto=${3} assert isset proto # Check if the given interface is a zone. assert zone_exists ${interface} case "${action}" in start) leases_file="" # Create dhclient configuration file. case "${proto}" in ipv4) config_file="${RUN_DIR}/dhclient/${interface}/dhclient4.conf" ;; ipv6) config_file="${RUN_DIR}/dhclient/${interface}/dhclient6.conf" leases_file="/var/lib/dhclient/dhclient6-${interface}.leases" ;; esac assert isset config_file # Update the dhclient configuration files dhclient_write_config "${interface}" \ --config-file="${config_file}" \ --leases-file="${leases_file}" || exit $? exit ${EXIT_OK} ;; stop) case "${proto}" in ipv4) reason="STOP" ;; ipv6) reason="STOP6" ;; esac assert isset reason export interface export reason exec /usr/sbin/dhclient-script log ERROR $"execing dhclient-script has failed." exit ${EXIT_ERROR} ;; *) log ERROR "Unknown action passed: ${action}" exit ${EXIT_ERROR} ;; esac