summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2014-06-17 13:20:22 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2014-06-17 13:20:22 +0200
commit92e906ee327fa32ab30bffa3a2769c437456d257 (patch)
treec3c5d644afffe108990e519ceca95a67287a44ce /src
parent64e6da091adcbd7759ef36ae4a58887e5eb00d3f (diff)
downloadnetctl-92e906ee327fa32ab30bffa3a2769c437456d257.tar.gz
netctl-92e906ee327fa32ab30bffa3a2769c437456d257.tar.xz
Add support for IPv6 with dhcpcd (FS#39531)
This requires dhcpcd 6.4.0 or newer.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dhcp/dhclient4
-rw-r--r--src/lib/dhcp/dhcpcd20
2 files changed, 15 insertions, 9 deletions
diff --git a/src/lib/dhcp/dhclient b/src/lib/dhcp/dhclient
index 0970aee..87e9a92 100644
--- a/src/lib/dhcp/dhclient
+++ b/src/lib/dhcp/dhclient
@@ -1,7 +1,7 @@
type dhclient &> /dev/null || return
dhclient_start() {
- local options pidfile="/run/dhclient$1-$Interface.pid"
+ local options pidfile="/run/dhclient-$Interface-$1.pid"
case $1 in
4) options=$DhclientOptions;;
6) options=$DhclientOptions6;;
@@ -15,7 +15,7 @@ dhclient_start() {
}
dhclient_stop() {
- local stop="-x" pidfile="/run/dhclient$1-$Interface.pid"
+ local stop="-x" pidfile="/run/dhclient-$Interface-$1.pid"
if [[ -f $pidfile ]]; then
is_yes "${DHCPReleaseOnStop:-no}" && stop="-r"
do_debug dhclient -$1 -q $stop "$Interface" -pf "$pidfile" > /dev/null
diff --git a/src/lib/dhcp/dhcpcd b/src/lib/dhcp/dhcpcd
index b85b668..5dba10a 100644
--- a/src/lib/dhcp/dhcpcd
+++ b/src/lib/dhcp/dhcpcd
@@ -1,25 +1,31 @@
type dhcpcd &> /dev/null || return
dhcpcd_start() {
- if [[ $1 != "4" ]]; then
- report_error "Using 'dhcpcd' for IPv6 is currently not possible in netctl"
+ local options
+ case $1 in
+ 4) options="$DhcpcdOptions -L";;
+ 6) options=$DhcpcdOptions6;;
+ *) return 1;;
+ esac
+ if [[ $2 == "noaddr" ]]; then
+ report_error "Using 'dhcpcd' for configuration without address assignment is unsupported"
return 1
fi
# If using own dns, tell dhcpcd to NOT replace resolv.conf
- [[ $DNS ]] && DhcpcdOptions+=" -C resolv.conf"
- do_debug do_readable dhcpcd -4qL -t "${TimeoutDHCP:-30}" $DhcpcdOptions "$Interface"
+ [[ $DNS ]] && options+=" -C resolv.conf"
+ do_debug do_readable dhcpcd -$1 -q -t "${TimeoutDHCP:-30}" $options "$Interface"
# The first array value of PIPESTATUS is the exit status of dhcpcd
if (( PIPESTATUS != 0 )); then
- report_error "DHCP IP lease attempt failed on interface '$Interface'"
+ report_error "DHCP IPv$1 lease attempt failed on interface '$Interface'"
return 1
fi
}
dhcpcd_stop() {
local stop="-x"
- if [[ -f "/run/dhcpcd-$Interface.pid" ]]; then
+ if [[ -f "/run/dhcpcd-$Interface-$1.pid" ]]; then
is_yes "${DHCPReleaseOnStop:-no}" && stop="-k"
- do_debug dhcpcd -q $stop "$Interface" > /dev/null
+ do_debug dhcpcd -$1 -q $stop "$Interface" > /dev/null
fi
}