diff options
author | Olivier Mehani <olivier.mehani@nicta.com.au> | 2011-06-11 16:41:47 +0200 |
---|---|---|
committer | Rémy Oudompheng <remy@archlinux.org> | 2011-06-11 16:42:26 +0200 |
commit | 84567a517c7c671e2eb295bbce67c5f58e97be9f (patch) | |
tree | a534c649ede5cc3b021afd687a1e44530d3f3e28 /src/connections/ethernet | |
parent | 68786de7a2224f81c2190491b2956b4f4276e0cd (diff) | |
download | netctl-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/connections/ethernet')
-rw-r--r-- | src/connections/ethernet | 22 |
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 |