diff options
author | Thomas Haller <thaller@redhat.com> | 2022-02-07 19:35:05 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-02-09 19:13:05 +0100 |
commit | 84598adddffc5e135cc6c7ee632e028dc9d8201a (patch) | |
tree | 1a4f80c27da40749a39f7a9df521c3ce43dabc9e | |
parent | 9ab53e561a636a48e772d48c96d6bd2e0be13329 (diff) | |
download | NetworkManager-84598adddffc5e135cc6c7ee632e028dc9d8201a.tar.gz |
libnm: allow configuring blackhole/unreachable/prohibit routes
-rw-r--r-- | src/libnm-core-impl/nm-setting-ip-config.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/libnm-core-impl/nm-setting-ip-config.c b/src/libnm-core-impl/nm-setting-ip-config.c index 3cc0486e2a..52aa651570 100644 --- a/src/libnm-core-impl/nm-setting-ip-config.c +++ b/src/libnm-core-impl/nm-setting-ip-config.c @@ -1385,7 +1385,12 @@ _ip_route_attribute_validate(const char *name, string = g_variant_get_string(value, NULL); type = nm_net_aux_rtnl_rtntype_a2n(string); - if (!NM_IN_SET(type, RTN_UNICAST, RTN_LOCAL)) { + if (!NM_IN_SET(type, + RTN_UNICAST, + RTN_LOCAL, + RTN_BLACKHOLE, + RTN_UNREACHABLE, + RTN_PROHIBIT)) { g_set_error(error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, @@ -1486,6 +1491,18 @@ _nm_ip_route_attribute_validate_all(const NMIPRoute *route, GError **error) return FALSE; } break; + case RTN_BLACKHOLE: + case RTN_UNREACHABLE: + case RTN_PROHIBIT: + if (route->next_hop) { + g_set_error(error, + NM_CONNECTION_ERROR, + NM_CONNECTION_ERROR_INVALID_PROPERTY, + _("a %s route cannot have a next-hop"), + nm_net_aux_rtnl_rtntype_n2a(parse_data.type)); + return FALSE; + } + break; } return TRUE; |