From: Roy Marples Date: Fri, 30 Apr 2010 18:22:48 +0000 (+0000) Subject: Indicate if we have a server id or not by using from/via. X-Git-Tag: v5.2.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66b86dec8cc1a5f17ee06722ca8ec07154afeea1;p=thirdparty%2Fdhcpcd.git Indicate if we have a server id or not by using from/via. --- diff --git a/dhcpcd.c b/dhcpcd.c index 051b73cc..007c71ce 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -410,6 +410,7 @@ log_dhcp(int lvl, const char *msg, const struct interface *iface, const struct dhcp_message *dhcp, const struct in_addr *from) { + const char *tfrom; char *a; struct in_addr addr; int r; @@ -421,19 +422,23 @@ log_dhcp(int lvl, const char *msg, a = xstrdup(inet_ntoa(addr)); } else a = NULL; + + tfrom = "from"; r = get_option_addr(&addr, dhcp, DHO_SERVERID); if (dhcp->servername[0] && r == 0) - syslog(lvl, "%s: %s %s from %s `%s'", iface->name, msg, a, - inet_ntoa(addr), dhcp->servername); + syslog(lvl, "%s: %s %s %s %s `%s'", iface->name, msg, a, + tfrom, inet_ntoa(addr), dhcp->servername); else { - if (r != 0) + if (r != 0) { + tfrom = "via"; addr = *from; + } if (a == NULL) - syslog(lvl, "%s: %s from %s", - iface->name, msg, inet_ntoa(addr)); + syslog(lvl, "%s: %s %s %s", + iface->name, msg, tfrom, inet_ntoa(addr)); else - syslog(lvl, "%s: %s %s from %s", - iface->name, msg, a, inet_ntoa(addr)); + syslog(lvl, "%s: %s %s %s %s", + iface->name, msg, a, tfrom, inet_ntoa(addr)); } free(a); }