diff options
author | Thomas Haller <thaller@redhat.com> | 2018-11-27 15:18:17 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-12-19 09:23:08 +0100 |
commit | b05ebd54b7f595c961ef407927e777eda5a07505 (patch) | |
tree | 0fff5a1a460861be4e39802fd043f4864f61e832 | |
parent | 3f99d01c1a90bdaea16b256711eb7f87a98da499 (diff) | |
download | NetworkManager-b05ebd54b7f595c961ef407927e777eda5a07505.tar.gz |
dhcp: minor cleanup parsing default route for internal client
Combine same code.
-rw-r--r-- | src/dhcp/nm-dhcp-systemd.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index 4e1ef7b80a..688fcd71eb 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -409,10 +409,6 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx, static_default_gateway = TRUE; gateway_has = TRUE; gateway = r_gateway.s_addr; - - s = nm_utils_inet4_ntop (gateway, addr_str); - LOG_LEASE (LOGD_DHCP4, "gateway %s", s); - add_option (options, dhcp4_requests, SD_DHCP_OPTION_ROUTER, s); } } } @@ -429,18 +425,18 @@ lease_to_ip4_config (NMDedupMultiIndex *multi_idx, && sd_dhcp_lease_get_router (lease, &a_router) >= 0) { gateway_has = TRUE; gateway = a_router.s_addr; - s = nm_utils_inet4_ntop (a_router.s_addr, addr_str); - LOG_LEASE (LOGD_DHCP4, "gateway %s", s); - add_option (options, dhcp4_requests, SD_DHCP_OPTION_ROUTER, s); } if (gateway_has) { + s = nm_utils_inet4_ntop (gateway, addr_str); + LOG_LEASE (LOGD_DHCP4, "gateway %s", s); + add_option (options, dhcp4_requests, SD_DHCP_OPTION_ROUTER, s); nm_ip4_config_add_route (ip4_config, &((const NMPlatformIP4Route) { - .rt_source = NM_IP_CONFIG_SOURCE_DHCP, - .gateway = gateway, + .rt_source = NM_IP_CONFIG_SOURCE_DHCP, + .gateway = gateway, .table_coerced = nm_platform_route_table_coerce (route_table), - .metric = route_metric, + .metric = route_metric, }), NULL); } |