--- net.eth0.orig 2004-06-07 14:08:41.737007048 +0200 +++ net.eth0 2004-06-07 14:10:32.573157392 +0200 @@ -45,6 +45,7 @@ # vlans_IFACE (space-separated list) # ifconfig_IFACE (array of ifconfig lines, replaces iface_IFACE) # dhcpcd_IFACE (command-line args for dhcpcd) +# clearip_IFACE (if set, clear dhcpcd cache) # routes_IFACE (array of route lines) # inet6_IFACE (array of inet6 lines) # ifconfig_fallback_IFACE (fallback ifconfig if dhcp fails) @@ -55,6 +56,7 @@ eval vlans_IFACE=\"\$\{iface_${iface}_vlans\}\" eval ifconfig_IFACE=( \"\$\{ifconfig_$iface\[@\]\}\" ) eval dhcpcd_IFACE=\"\$\{dhcpcd_$iface\}\" + eval clearip_IFACE=\"\$\{clearip_$iface\}\" eval routes_IFACE=( \"\$\{routes_$iface\[@\]\}\" ) eval inet6_IFACE=( \"\$\{inet6_$iface\[@\]\}\" ) eval ifconfig_fallback_IFACE=( \"\$\{ifconfig_fallback_$iface\[@\]\}\" ) @@ -88,6 +90,14 @@ local IFACE=${1} i x retval checkconfig || return 1 + # Check if we should clear the IP address of that interface before DHCPing + if [[ ! -z ${clearip_IFACE} ]]; then + einfo "Clearing cached IP for ${IFACE}" + if [[ -f "/var/cache/dhcpcd-${IFACE}.cache" ]]; then + rm "/var/cache/dhcpcd-${IFACE}.cache" + fi + fi + if [[ ${ifconfig_IFACE} != dhcp ]]; then # Show the address, but catch if this interface will be inet6 only i=${ifconfig_IFACE%% *}