- term = *options;
- *options = 0;
-
- if (Ustrcmp(s, "randomize") == 0) randomize = TRUE;
- else if (Ustrcmp(s, "no_randomize") == 0) randomize = FALSE;
- else if (Ustrcmp(s, "byname") == 0) lookup_type = lk_byname;
- else if (Ustrcmp(s, "bydns") == 0) lookup_type = lk_bydns;
+ n = options-s;
+
+ if (Ustrncmp(s, "randomize", n) == 0) randomize = TRUE;
+ else if (Ustrncmp(s, "no_randomize", n) == 0) randomize = FALSE;
+ else if (Ustrncmp(s, "byname", n) == 0)
+ lookup_type = lookup_type & ~(LK_DEFAULT | LK_BYDNS) | LK_BYNAME;
+ else if (Ustrncmp(s, "bydns", n) == 0)
+ lookup_type = lookup_type & ~(LK_DEFAULT | LK_BYNAME) & LK_BYDNS;
+ else if (Ustrncmp(s, "ipv4_prefer", n) == 0) lookup_type |= LK_IPV4_PREFER;
+ else if (Ustrncmp(s, "ipv4_only", n) == 0) lookup_type |= LK_IPV4_ONLY;