]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: add sd_dhcp_route_get_option() accessor
authorThomas Haller <thaller@redhat.com>
Tue, 27 Nov 2018 11:09:52 +0000 (12:09 +0100)
committerThomas Haller <thaller@redhat.com>
Tue, 27 Nov 2018 11:20:19 +0000 (12:20 +0100)
Since sd_dhcp_lease_get_routes() returns the list of all routes,
the caller may need to differenciate whether the route was option
33 (static-routes) or 121 (classless-static-route).

Add an accessor for the internal field.

src/libsystemd-network/sd-dhcp-lease.c
src/systemd/sd-dhcp-lease.h

index a90c01d7db0618835a82ff33b54a766e7cae8643..c2455c7133b54494938c9acc6cb56b8077be8f3b 100644 (file)
@@ -1299,3 +1299,9 @@ int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway) {
         *gateway = route->gw_addr;
         return 0;
 }
+
+int sd_dhcp_route_get_option(sd_dhcp_route *route) {
+        assert_return(route, -EINVAL);
+
+        return route->option;
+}
index 2a60145f5b00f403c00e3f74b911c0ddf08216c2..4875f10555c717080a64c9c3618d0a268defae9e 100644 (file)
@@ -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_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_option(sd_dhcp_route *route);
 
 _SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);