[arch-projects] [netctl][PATCH] Support for IPv6-only connections in mixed profiles
Jiri Tyr
jiri.tyr at gmail.com
Sun Feb 1 11:48:06 UTC 2015
This patch fixes the behavior when IPv4 and IPv6 is configured in the same
profile file but only IPv6 address can be acquired. Without this patch,
the process finishes right after the attempt to acquire IPv4 address and
never gets to the point where IPv6 address can be acquired.
Signed-off-by: Jiri Tyr <jiri.tyr at gmail.com>
---
src/lib/ip | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/lib/ip b/src/lib/ip
index 2dc67fc..5b0eab2 100644
--- a/src/lib/ip
+++ b/src/lib/ip
@@ -62,9 +62,17 @@ ip_set() {
;;
esac
+ OnlyIPv6=no
case $IP in
dhcp)
- dhcp_call "${DHCPClient:-dhcpcd}" start 4 || return
+ dhcp_call "${DHCPClient:-dhcpcd}" start 4
+ # Do not fail yet, maybe only IPV6 address will be acquired
+ if [[ $? > 0 ]] && [[ $IP6 != @(dhcp|dhcp-noaddr) ]]; then
+ return
+ elif [[ $? > 0 ]]; then
+ report_debug "Could not get IPv4 address. Will try IPv6."
+ fi
+ OnlyIPv6=yes
;;
static)
for addr in "${Address[@]}"; do
@@ -82,7 +90,7 @@ ip_set() {
;;
esac
- if [[ $IP != @(|no) ]]; then
+ if [[ $OnlyIPv6 == 'no' ]] && [[ $IP != @(|no) ]]; then
# Add static IP routes
for route in "${Routes[@]}"; do
if ! do_debug ip route add $route dev "$Interface"; then
--
2.2.2
More information about the arch-projects
mailing list