diff options
Diffstat (limited to 'src/dhcp/nm-dhcp-utils.c')
| -rw-r--r-- | src/dhcp/nm-dhcp-utils.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/dhcp/nm-dhcp-utils.c b/src/dhcp/nm-dhcp-utils.c index 9b1653b8..5227eea7 100644 --- a/src/dhcp/nm-dhcp-utils.c +++ b/src/dhcp/nm-dhcp-utils.c @@ -19,8 +19,6 @@ #include "nm-default.h" -#include <string.h> -#include <errno.h> #include <unistd.h> #include <arpa/inet.h> @@ -197,7 +195,8 @@ ip4_process_dhclient_rfc3442_routes (const char *iface, /* gateway passed as classless static route */ *gwaddr = route.gateway; } else { - char addr[INET_ADDRSTRLEN]; + char b1[INET_ADDRSTRLEN]; + char b2[INET_ADDRSTRLEN]; /* normal route */ route.rt_source = NM_IP_CONFIG_SOURCE_DHCP; @@ -206,8 +205,9 @@ ip4_process_dhclient_rfc3442_routes (const char *iface, nm_ip4_config_add_route (ip4_config, &route, NULL); _LOG2I (LOGD_DHCP4, iface, " classless static route %s/%d gw %s", - nm_utils_inet4_ntop (route.network, addr), route.plen, - nm_utils_inet4_ntop (route.gateway, NULL)); + nm_utils_inet4_ntop (route.network, b1), + route.plen, + nm_utils_inet4_ntop (route.gateway, b2)); } } @@ -408,6 +408,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx, gboolean gateway_has = FALSE; guint32 gateway = 0; guint8 plen = 0; + char sbuf[NM_UTILS_INET_ADDRSTRLEN]; g_return_val_if_fail (options != NULL, NULL); @@ -439,7 +440,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx, process_classful_routes (iface, options, route_table, route_metric, ip4_config); if (gateway) { - _LOG2I (LOGD_DHCP4, iface, " gateway %s", nm_utils_inet4_ntop (gateway, NULL)); + _LOG2I (LOGD_DHCP4, iface, " gateway %s", nm_utils_inet4_ntop (gateway, sbuf)); gateway_has = TRUE; } else { /* If the gateway wasn't provided as a classless static route with a @@ -543,7 +544,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx, errno = 0; int_mtu = strtol (str, NULL, 10); - if ((errno == EINVAL) || (errno == ERANGE)) + if (NM_IN_SET (errno, EINVAL, ERANGE)) goto error; if (int_mtu > 576) @@ -729,7 +730,7 @@ nm_dhcp_utils_duid_to_string (GBytes *duid) g_return_val_if_fail (duid, NULL); data = g_bytes_get_data (duid, &len); - return _nm_utils_bin2hexstr_full (data, len, ':', FALSE, NULL); + return nm_utils_bin2hexstr_full (data, len, ':', FALSE, NULL); } /** |