diff --git a/local.c b/local.c index 59d18cdd..59ee9cc9 100644 --- a/local.c +++ b/local.c @@ -95,21 +95,15 @@ local_notify_interface_1(struct local_socket *s, { char buf[512], v4[INET_ADDRSTRLEN]; int rc; - int up; - up = if_up(ifp); - if(up && ifp->ipv4) - inet_ntop(AF_INET, ifp->ipv4, v4, INET_ADDRSTRLEN); - else - v4[0] = '\0'; - - if(up) + if(if_up(ifp)) rc = snprintf(buf, 512, "%s interface %s up true%s%s%s%s%s%s\n", local_kind(kind), ifp->name, ifp->ll ? " ipv6 " : "", ifp->ll ? format_address(*ifp->ll) : "", - v4[0] ? " ipv4 " : "", v4, + ifp->ipv4 ? " ipv4 " : "", + ifp->ipv4 ? inet_ntop(AF_INET, ifp->ipv4, v4, INET_ADDRSTRLEN) : "", ifp->conf->use_prefsrc ? " pref-src ": "", ifp->conf->use_prefsrc ? format_address(ifp->conf->prefsrc) : ""); else