chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: get rid of condition.c and move the remaining call into util.c
[elogind.git]
/
src
/
network
/
networkd-dhcp4.c
diff --git
a/src/network/networkd-dhcp4.c
b/src/network/networkd-dhcp4.c
index b87fa730826daba3650477c430495523ab09054d..63bfa86f99a6cddb6df694f049e3f1f74892a477 100644
(file)
--- a/
src/network/networkd-dhcp4.c
+++ b/
src/network/networkd-dhcp4.c
@@
-103,7
+103,7
@@
static int link_set_dhcp_routes(Link *link) {
route_gw->dst_prefixlen = 32;
route_gw->prefsrc_addr.in = address;
route_gw->scope = RT_SCOPE_LINK;
route_gw->dst_prefixlen = 32;
route_gw->prefsrc_addr.in = address;
route_gw->scope = RT_SCOPE_LINK;
- route_gw->metrics =
DHCP_ROUTE_METRIC
;
+ route_gw->metrics =
link->network->dhcp_route_metric
;
r = route_configure(route_gw, link, &dhcp4_route_handler);
if (r < 0) {
r = route_configure(route_gw, link, &dhcp4_route_handler);
if (r < 0) {
@@
-118,7
+118,7
@@
static int link_set_dhcp_routes(Link *link) {
route->family = AF_INET;
route->in_addr.in = gateway;
route->prefsrc_addr.in = address;
route->family = AF_INET;
route->in_addr.in = gateway;
route->prefsrc_addr.in = address;
- route->metrics =
DHCP_ROUTE_METRIC
;
+ route->metrics =
link->network->dhcp_route_metric
;
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
@@
-157,7
+157,7
@@
static int link_set_dhcp_routes(Link *link) {
route->in_addr.in = static_routes[i].gw_addr;
route->dst_addr.in = static_routes[i].dst_addr;
route->dst_prefixlen = static_routes[i].dst_prefixlen;
route->in_addr.in = static_routes[i].gw_addr;
route->dst_addr.in = static_routes[i].dst_addr;
route->dst_prefixlen = static_routes[i].dst_prefixlen;
- route->metrics =
DHCP_ROUTE_METRIC
;
+ route->metrics =
link->network->dhcp_route_metric
;
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
r = route_configure(route, link, &dhcp4_route_handler);
if (r < 0) {
@@
-178,7
+178,7
@@
static int dhcp_lease_lost(Link *link) {
struct in_addr addr;
struct in_addr netmask;
struct in_addr gateway;
struct in_addr addr;
struct in_addr netmask;
struct in_addr gateway;
- unsigned prefixlen;
+ unsigned prefixlen
= 0
;
int r;
assert(link);
int r;
assert(link);
@@
-237,15
+237,18
@@
static int dhcp_lease_lost(Link *link) {
}
}
}
}
- sd_dhcp_lease_get_address(link->dhcp_lease, &addr);
- sd_dhcp_lease_get_netmask(link->dhcp_lease, &netmask);
- prefixlen = in_addr_netmask_to_prefixlen(&netmask);
+ r = sd_dhcp_lease_get_address(link->dhcp_lease, &addr);
+ if (r >= 0) {
+ r = sd_dhcp_lease_get_netmask(link->dhcp_lease, &netmask);
+ if (r >= 0)
+ prefixlen = in_addr_netmask_to_prefixlen(&netmask);
- address->family = AF_INET;
- address->in_addr.in = addr;
- address->prefixlen = prefixlen;
+
address->family = AF_INET;
+
address->in_addr.in = addr;
+
address->prefixlen = prefixlen;
- address_drop(address, link, &link_address_drop_handler);
+ address_drop(address, link, &link_address_drop_handler);
+ }
}
if (link->network->dhcp_mtu) {
}
if (link->network->dhcp_mtu) {
@@
-596,7
+599,9
@@
int dhcp4_configure(Link *link) {
if (r < 0)
return r;
if (r < 0)
return r;
- r = sd_dhcp_client_set_mac(link->dhcp_client, &link->mac);
+ r = sd_dhcp_client_set_mac(link->dhcp_client,
+ (const uint8_t *) &link->mac,
+ sizeof (link->mac), ARPHRD_ETHER);
if (r < 0)
return r;
if (r < 0)
return r;