aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Solano Gómez <daniel@solanogomez.org>2013-04-05 19:13:12 -0500
committerRobin H. Johnson <robbat2@gentoo.org>2013-08-28 13:14:07 -0700
commitbd7bd3a513c8ddc554e211316c990b5f98110982 (patch)
treeff3d79f54b4d5ce73bf6505f4f2fa8f162455b3c /net/iproute2.sh
parentUpdate credits. (diff)
downloadnetifrc-bug450326.tar.gz
netifrc-bug450326.tar.bz2
netifrc-bug450326.zip
dhclientv6: Add DHCPv6 support via dhclientbug450326
This adds DHCPv6 support to OpenRC in Linux using dhclient as outlined by Stuart Longland at <http://stuartl.longlandclan.yi.org/blog/2011/02/15/gentoo-and-dhcpv6/>. The main place where the new support is added is via a modified copy of the dhclient.sh script that: - Renames functions using a 'v6' suffix - Uses a different pid file - Uses the '-6' argument when invoking dhclient - Recognizes new DHCPv6-specific configuration variables with a fallback to the DHCP configuration variables. Additionally: 1. The iproute2 and Linux ifconfig scripts have been ammended to be able to return IPv6 addresses using new '_get_inet6_address' and '_get_inet6_addresses' functions. 2. The 'net.lo' init script now has a '_show_address6' function. 3. The documentation in the Linux net.example now contains some DHCPv6 information. Reported-by: Dustin C. Hatch <admiralnemo@gmail.com> X-Gentoo-Bug: 150908 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=150908 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'net/iproute2.sh')
-rw-r--r--net/iproute2.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 096e724..ed5750f 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -84,8 +84,16 @@ _set_mac_address()
_get_inet_addresses()
{
- LC_ALL=C ip -family inet addr show "${IFACE}" | \
- sed -n -e 's/.*inet \([^ ]*\).*/\1/p'
+ local family="$1";
+ if [ -z "$family" ]; then
+ family="inet"
+ fi
+ LC_ALL=C ip -family $family addr show "${IFACE}" | \
+ sed -n -e 's/.*inet6\? \([^ ]*\).*/\1/p'
+}
+
+_get_inet6_addresses() {
+ _get_inet_addresses "inet6"
}
_get_inet_address()
@@ -95,6 +103,13 @@ _get_inet_address()
echo "$1"
}
+_get_inet6_address()
+{
+ set -- $(_get_inet6_addresses)
+ [ $# = "0" ] && return 1
+ echo "$1"
+}
+
_add_address()
{
if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ]; then