network: minor coding style update

This commit is contained in:
Yu Watanabe
2019-02-15 10:23:40 +09:00
parent 93e4163e91
commit 860e636cf6
+7 -9
View File
@@ -70,7 +70,7 @@ static int link_set_dhcp_routes(Link *link) {
/* When the interface is part of an VRF use the VRFs routing table, unless
* there is a another table specified. */
table = link->network->dhcp_route_table;
if (!link->network->dhcp_route_table_set && link->network->vrf != NULL)
if (!link->network->dhcp_route_table_set && link->network->vrf)
table = VRF(link->network->vrf)->table;
r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
@@ -135,14 +135,7 @@ static int link_set_dhcp_routes(Link *link) {
log_link_warning(link, "Classless static routes received from DHCP server: ignoring static-route option and router option");
if (r >= 0 && !classless_route) {
_cleanup_(route_freep) Route *route = NULL;
_cleanup_(route_freep) Route *route_gw = NULL;
r = route_new(&route);
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate route: %m");
route->protocol = RTPROT_DHCP;
_cleanup_(route_freep) Route *route = NULL, *route_gw = NULL;
r = route_new(&route_gw);
if (r < 0)
@@ -166,9 +159,14 @@ static int link_set_dhcp_routes(Link *link) {
link->dhcp4_messages++;
r = route_new(&route);
if (r < 0)
return log_link_error_errno(link, r, "Could not allocate route: %m");
route->family = AF_INET;
route->gw.in = gateway;
route->prefsrc.in = address;
route->protocol = RTPROT_DHCP;
route->priority = link->network->dhcp_route_metric;
route->table = table;