Fix IPv6 parsing when a domain has an IPv4 address also.
authorRoy Marples <roy@marples.name>
Mon, 26 Mar 2012 14:28:34 +0000 (14:28 +0000)
committerRoy Marples <roy@marples.name>
Mon, 26 Mar 2012 14:28:34 +0000 (14:28 +0000)
dnsmasq.in

index 238ac2c17ce2e3e1e8990d830b6a7f96a90f7a84..1361327afa453b4680d5fbab051f581e6ea5a4da 100644 (file)
@@ -71,12 +71,13 @@ conf=
 for d in $DOMAINS; do
        dn="${d%%:*}"
        ns="${d#*:}"
+       n="${ns%%,*}"
        while [ -n "$ns" ]; do
-               case "$ns" in
+               case "$n" in
                *.*.*.*)
                        SIFS=${IFS-y} OIFS=$IFS
                        IFS=.
-                       set -- ${ns%%,*}
+                       set -- $n
                        num="0x$(printf %02x $1 $2 $3 $4)"
                        if [ "$SIFS" = y ]; then
                                unset IFS
@@ -89,7 +90,7 @@ for d in $DOMAINS; do
                *:*:*:*:*:*:*:*)
                        SIFS=${IFS-y} OIFS=$IFS bytes=
                        IFS=:
-                       set -- ${ns%%,*}
+                       set -- $n
                        while [ -n "$1" ]; do
                                addr="$1"
                                shift
@@ -111,11 +112,12 @@ for d in $DOMAINS; do
                        dbus=false
                        ;;
                esac
-               conf="${conf}server=/$dn/${ns%%,*}$NL"
+               conf="${conf}server=/$dn/$n$NL"
                [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
        done
 done
+
 if $dbus; then
        newconf="$newconf$NL# Domain specific servers will"
        newconf="$newconf be sent over dbus${NL}enable-dbus$NL"