diff options
author | Christian Mehlis <christian@m3hlis.de> | 2014-08-18 13:37:03 +0200 |
---|---|---|
committer | Christian Mehlis <christian@m3hlis.de> | 2014-08-18 13:37:15 +0200 |
commit | da9b89e3894c53ecb3c2dc37dff9ae1fb8e36460 (patch) | |
tree | 197ccba48e08b797c3b090bb375cf3823f4fb513 /src | |
parent | 1476c281d2a310831b5bf1cf130f170891104a51 (diff) |
dhcpv4: log reply in a more precise way
Diffstat (limited to 'src')
-rw-r--r-- | src/dhcpv4.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c index ebddb22..92a1397 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -479,10 +479,24 @@ static void handle_dhcpv4(void *addr, void *data, size_t len, ioctl(sock, SIOCSARP, &arp); } - syslog(LOG_WARNING, "sending %s to %x:%x:%x:%x:%x:%x", - dhcpv4_msg_to_string(msg), - req->chaddr[0],req->chaddr[1],req->chaddr[2], - req->chaddr[3],req->chaddr[4],req->chaddr[5]); + if (dest.sin_addr.s_addr == INADDR_BROADCAST) { + /* + * reply goes to IP broadcast -> MAC broadcast + */ + syslog(LOG_WARNING, "sending %s to ff:ff:ff:ff:ff:ff - %s", + dhcpv4_msg_to_string(msg), + inet_ntoa(dest.sin_addr)); + } else { + /* + * reply is send directly to IP, + * MAC is assumed to be the same as the request + */ + syslog(LOG_WARNING, "sending %s to %x:%x:%x:%x:%x:%x - %s", + dhcpv4_msg_to_string(msg), + req->chaddr[0],req->chaddr[1],req->chaddr[2], + req->chaddr[3],req->chaddr[4],req->chaddr[5], + inet_ntoa(dest.sin_addr)); + } sendto(sock, &reply, sizeof(reply), MSG_DONTWAIT, (struct sockaddr*)&dest, sizeof(dest)); |