mirror of
https://github.com/systemd/systemd.git
synced 2025-01-20 18:04:03 +03:00
Merge pull request #10951 from thom311/network-dhcp-route-option
add accessor for sd_dhcp_route's "option"
This commit is contained in:
commit
e849ae9524
@ -1299,3 +1299,9 @@ int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway) {
|
|||||||
*gateway = route->gw_addr;
|
*gateway = route->gw_addr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sd_dhcp_route_get_option(sd_dhcp_route *route) {
|
||||||
|
assert_return(route, -EINVAL);
|
||||||
|
|
||||||
|
return route->option;
|
||||||
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "dhcp-lease-internal.h"
|
|
||||||
#include "hostname-util.h"
|
#include "hostname-util.h"
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "netdev/vrf.h"
|
#include "netdev/vrf.h"
|
||||||
@ -87,11 +86,14 @@ static int link_set_dhcp_routes(Link *link) {
|
|||||||
log_link_debug_errno(link, n, "DHCP error: could not get routes: %m");
|
log_link_debug_errno(link, n, "DHCP error: could not get routes: %m");
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (static_routes[i]->option == SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE)
|
switch (sd_dhcp_route_get_option(static_routes[i])) {
|
||||||
|
case SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE:
|
||||||
classless_route = true;
|
classless_route = true;
|
||||||
|
break;
|
||||||
if (static_routes[i]->option == SD_DHCP_OPTION_STATIC_ROUTE)
|
case SD_DHCP_OPTION_STATIC_ROUTE:
|
||||||
static_route = true;
|
static_route = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -99,7 +101,8 @@ static int link_set_dhcp_routes(Link *link) {
|
|||||||
|
|
||||||
/* if the DHCP server returns both a Classless Static Routes option and a Static Routes option,
|
/* if the DHCP server returns both a Classless Static Routes option and a Static Routes option,
|
||||||
the DHCP client MUST ignore the Static Routes option. */
|
the DHCP client MUST ignore the Static Routes option. */
|
||||||
if (classless_route && static_routes[i]->option == SD_DHCP_OPTION_STATIC_ROUTE)
|
if (classless_route &&
|
||||||
|
sd_dhcp_route_get_option(static_routes[i]) != SD_DHCP_OPTION_CLASSLESS_STATIC_ROUTE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = route_new(&route);
|
r = route_new(&route);
|
||||||
|
@ -57,6 +57,7 @@ int sd_dhcp_lease_get_timezone(sd_dhcp_lease *lease, const char **timezone);
|
|||||||
int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination);
|
int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination);
|
||||||
int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length);
|
int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length);
|
||||||
int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway);
|
int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway);
|
||||||
|
int sd_dhcp_route_get_option(sd_dhcp_route *route);
|
||||||
|
|
||||||
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);
|
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user