ptr.option = "ip";
ptr.o = NULL;
- if (uci_lookup_ptr(uci, &ptr, NULL, true) || ptr.o == NULL)
- continue;
-
- if (ptr.o->type != UCI_TYPE_STRING)
- continue;
+ if (!uci_lookup_ptr(uci, &ptr, NULL, true) && ptr.o != NULL &&
+ ptr.o->type != UCI_TYPE_STRING)
+ n = ptr.o->v.string;
+ else
+ n = NULL;
- if (inet_pton(AF_INET, ptr.o->v.string, &in) != 1)
- continue;
+ if (!n || inet_pton(AF_INET, n, &in) != 1)
+ in.s_addr = 0;
ptr.option = "name";
ptr.o = NULL;
if (!hint)
continue;
- if (hint->ip.s_addr == 0)
+ if (hint->ip.s_addr == 0 && in.s_addr != 0)
hint->ip = in;
if (n && !hint->hostname)
if (!hint)
continue;
- if (hint->ip.s_addr == 0)
+ if (hint->ip.s_addr == 0 && in.s_addr != 0)
hint->ip = in;
if (n && !hint->hostname)