summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Mehani <olivier.mehani@nicta.com.au>2011-06-11 16:41:47 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-06-11 16:42:26 +0200
commit84567a517c7c671e2eb295bbce67c5f58e97be9f (patch)
treea534c649ede5cc3b021afd687a1e44530d3f3e28 /src
parent68786de7a2224f81c2190491b2956b4f4276e0cd (diff)
downloadnetctl-84567a517c7c671e2eb295bbce67c5f58e97be9f.tar.gz
netctl-84567a517c7c671e2eb295bbce67c5f58e97be9f.tar.xz
IPv6: add DHCPv6 support.
This needs dhclient to work properly. Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au> Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/connections/ethernet22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index ec03184..c824f18 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -123,6 +123,26 @@ ethernet_up() {
fi
case "$IP6" in
+ dhcp*)
+ if [[ -x /usr/sbin/dhclient ]]; then
+ _DHCLIENT_PIDFILE=/var/run/dhclient6-${INTERFACE}.pid
+ if [[ "$IP6" = "dhcp-noaddr" ]]; then
+ sysctl -q -w net.ipv6.conf.$INTERFACE.accept_ra=1
+ DHCLIENT6_OPTIONS="-S ${DHCLIENT6_OPTIONS}"
+ else
+ sysctl -q -w net.ipv6.conf.$INTERFACE.accept_ra=0
+ fi
+ rm -r ${_DHCLIENT_PIDFILE} &>/dev/null
+ report_debug ethernet_up dhclient -6 -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf ${_DHCLIENT_PIDFILE} "$INTERFACE"
+ if ! dhclient -6 -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf ${_DHCLIENT_PIDFILE} ${DHCLIENT6_OPTIONS} "$INTERFACE"; then
+ report_fail "DHCPv6 IP lease attempt failed."
+ stop_80211x
+ return 1
+ fi
+ else
+ report_fail "You need to install dhclient to use DHCPv6."
+ fi
+ ;;
stateless)
sysctl -q -w net.ipv6.conf.$INTERFACE.accept_ra=1
;;
@@ -155,7 +175,7 @@ ethernet_up() {
"")
;;
*)
- report_iproute "IP6 must be 'stateless' or 'static'"
+ report_iproute "IP6 must be 'dhcp', 'dhcp-noaddr', 'stateless' or 'static'"
;;
esac