[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] resolvconf - Add option PREFER_IPV6



Forwarding email to debian-devel

-- 
Pali Rohár
pali.rohar@gmail.com
--- Begin Message ---
Hello,

I created small patch which adding new env option PREFER_IPV6.
When is set to YES then libc resolvconf updater will add ipv6
nameservers before ipv4 in /etc/resolv.conf. This is usefull if
you want to prefer using nameservers via ipv6 protocol.

Patch was generated against ubuntu resolvconf version 1.67ubuntu2.

--- etc/resolvconf/update.d/libc.orig	2013-04-02 15:27:34.017686814 +0200
+++ etc/resolvconf/update.d/libc	2013-04-02 15:37:55.121668638 +0200
@@ -87,6 +87,21 @@ uniquify()
 	done
 }
 
+ipv6_nameserver_list()
+{
+	while [ "$1" ] ; do
+		case "$1" in (*:*) : ;; (*) shift ; continue ;; esac
+		for E in $NMSRVRS ; do
+			[ "$1" = "$E" ] && { shift ; continue 2 ; }
+		done
+		NMSRVRS="${NMSRVRS:+$NMSRVRS }$1"
+		case "$TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS" in (y|Y|yes|YES|Yes) case "$1" in (127.*|::1) return 0 ;; 
esac ;; esac
+		N=$(($N + 1))
+		[ "$N" = 3 ] && return 0
+		shift
+	done
+}
+
 # Args are candidate items not containing spaces
 # Returns NSMSRVS -- space-separate list of no more than 3 items,
 #                    without duplicates,
@@ -95,6 +110,7 @@ uniquify_nameserver_list()
 {
 	NMSRVRS=""
 	N=0
+	case "$PREFER_IPV6" in (y|Y|yes|YES|Yes) ipv6_nameserver_list "$@" ;; esac
 	while [ "$1" ] ; do
 		for E in $NMSRVRS ; do
 			[ "$1" = "$E" ] && { shift ; continue 2 ; }


-- 
Pali Rohár
pali.rohar@gmail.com

Attachment: signature.asc
Description: This is a digitally signed message part.


--- End Message ---

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: