networkd: print the received DHCPv4 address and gateway

It seems that networkd stores in_addr.s_addr contents in reverse
order (little-endian, not network order). This is a bit confusing,
but sd_rtnl evidently likes this order.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2014-01-08 22:15:27 -05:00
parent 3333d748fa
commit 628706137e
2 changed files with 18 additions and 1 deletions
+13 -1
View File
@@ -379,7 +379,19 @@ static void dhcp_handler(sd_dhcp_client *client, int event, void *userdata) {
_cleanup_address_free_ Address *addr = NULL;
_cleanup_route_free_ Route *rt = NULL;
log_link_info(link, "received config over DHCPv4");
log_struct_link(LOG_INFO, link,
"MESSAGE=%s: DHCPv4 address %u.%u.%u.%u/%u via %u.%u.%u.%u",
link->ifname,
ADDRESS_FMT_VAL(address),
prefixlen,
ADDRESS_FMT_VAL(gateway),
"ADDRESS=%u.%u.%u.%u",
ADDRESS_FMT_VAL(address),
"PREFIXLEN=%u",
prefixlen,
"GATEWAY=%u.%u.%u.%u",
ADDRESS_FMT_VAL(gateway),
NULL);
r = address_new_dynamic(&addr);
if (r < 0) {