mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 18:10:26 +01:00
core: handle blackhole/unreachable/prohibit route types in core
Specifically, in nm_utils_ip_route_attribute_to_platform() and in _l3_config_data_add_obj() handle such new route type. For the moment, they cannot be stored in a valid NMSettingIPConfig, but later this will be necessary.
This commit is contained in:
parent
e32bc6d248
commit
6255e0dcac
2 changed files with 17 additions and 2 deletions
|
|
@ -1347,7 +1347,8 @@ nm_utils_ip_route_attribute_to_platform(int addr_family,
|
|||
int type;
|
||||
|
||||
type = nm_net_aux_rtnl_rtntype_a2n(g_variant_get_string(variant, NULL));
|
||||
nm_assert(NM_IN_SET(type, RTN_UNICAST, RTN_LOCAL));
|
||||
nm_assert(
|
||||
NM_IN_SET(type, RTN_UNICAST, RTN_LOCAL, RTN_BLACKHOLE, RTN_UNREACHABLE, RTN_PROHIBIT));
|
||||
|
||||
r->type_coerced = nm_platform_route_type_coerce(type);
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -1094,8 +1094,22 @@ _l3_config_data_add_obj(NMDedupMultiIndex *multi_idx,
|
|||
NMP_OBJECT_TYPE_IP4_ROUTE,
|
||||
NMP_OBJECT_TYPE_IP6_ADDRESS,
|
||||
NMP_OBJECT_TYPE_IP6_ROUTE));
|
||||
nm_assert((!!obj_new) != (!!pl_new));
|
||||
|
||||
if (NM_IN_SET(idx_type->obj_type, NMP_OBJECT_TYPE_IP4_ROUTE, NMP_OBJECT_TYPE_IP6_ROUTE)) {
|
||||
const NMPlatformIPRoute *r;
|
||||
|
||||
r = obj_new ? NMP_OBJECT_CAST_IP_ROUTE(obj_new) : (NMPlatformIPRoute *) pl_new;
|
||||
|
||||
if (nm_platform_route_type_is_nodev(nm_platform_route_type_uncoerce(r->type_coerced))) {
|
||||
/* such routes don't have a device/next-hop. We track them without ifindex. */
|
||||
ifindex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* we go through extra lengths to accept a full obj_new object. That one,
|
||||
* can be reused by increasing the ref-count. */
|
||||
* can be reused by increasing the ref-count. We thus accept any ifindex, and
|
||||
* set it here. */
|
||||
if (!obj_new) {
|
||||
nm_assert(pl_new);
|
||||
obj_new = nmp_object_stackinit(&obj_new_stackinit, idx_type->obj_type, pl_new);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue