mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 14:38:09 +02:00
platform: skip VRF test if kernel support is missing
Fixes: 7c73c6a038 ('platform: add VRF support')
This commit is contained in:
parent
fc7af10cca
commit
3d03900e91
3 changed files with 29 additions and 15 deletions
|
|
@ -1590,32 +1590,38 @@ const NMPlatformLink *
|
|||
nmtstp_link_vrf_add (NMPlatform *platform,
|
||||
gboolean external_command,
|
||||
const char *name,
|
||||
const NMPlatformLnkVrf *lnk)
|
||||
const NMPlatformLnkVrf *lnk,
|
||||
gboolean *out_not_supported)
|
||||
{
|
||||
const NMPlatformLink *pllink = NULL;
|
||||
int err;
|
||||
int r;
|
||||
int r = 0;
|
||||
|
||||
g_assert (nm_utils_is_valid_iface_name (name, NULL));
|
||||
|
||||
NM_SET_OUT (out_not_supported, FALSE);
|
||||
external_command = nmtstp_run_command_check_external (external_command);
|
||||
|
||||
_init_platform (&platform, external_command);
|
||||
|
||||
if (external_command) {
|
||||
err = nmtstp_run_command ("ip link add %s type vrf table %u",
|
||||
name,
|
||||
lnk->table);
|
||||
if (err == 0)
|
||||
r = nmtstp_run_command ("ip link add %s type vrf table %u",
|
||||
name,
|
||||
lnk->table);
|
||||
|
||||
if (r == 0)
|
||||
pllink = nmtstp_assert_wait_for_link (platform, name, NM_LINK_TYPE_VRF, 100);
|
||||
} else {
|
||||
r = nm_platform_link_vrf_add (platform, name, lnk, &pllink);
|
||||
g_assert (NMTST_NM_ERR_SUCCESS (r));
|
||||
g_assert (pllink);
|
||||
else
|
||||
_LOGI ("Adding vrf device via iproute2 failed. Assume iproute2 is not up to the task.");
|
||||
}
|
||||
|
||||
g_assert_cmpint (pllink->type, ==, NM_LINK_TYPE_VRF);
|
||||
g_assert_cmpstr (pllink->name, ==, name);
|
||||
if (!pllink) {
|
||||
r = nm_platform_link_vrf_add (platform, name, lnk, &pllink);
|
||||
if (r == -EOPNOTSUPP)
|
||||
NM_SET_OUT (out_not_supported, TRUE);
|
||||
}
|
||||
|
||||
_assert_pllink (platform, r == 0, pllink, name, NM_LINK_TYPE_VRF);
|
||||
|
||||
return pllink;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -363,7 +363,8 @@ const NMPlatformLink *nmtstp_link_tun_add (NMPlatform *platform,
|
|||
const NMPlatformLink *nmtstp_link_vrf_add (NMPlatform *platform,
|
||||
gboolean external_command,
|
||||
const char *name,
|
||||
const NMPlatformLnkVrf *lnk);
|
||||
const NMPlatformLnkVrf *lnk,
|
||||
gboolean *out_not_supported);
|
||||
const NMPlatformLink *nmtstp_link_vxlan_add (NMPlatform *platform,
|
||||
gboolean external_command,
|
||||
const char *name,
|
||||
|
|
|
|||
|
|
@ -1184,10 +1184,17 @@ test_software_detect (gconstpointer user_data)
|
|||
break;
|
||||
case NM_LINK_TYPE_VRF: {
|
||||
NMPlatformLnkVrf lnk_vrf = { };
|
||||
gboolean not_supported;
|
||||
|
||||
lnk_vrf.table = 9876;
|
||||
|
||||
nmtstp_link_vrf_add (NULL, ext, DEVICE_NAME, &lnk_vrf);
|
||||
if (!nmtstp_link_vrf_add (NULL, ext, DEVICE_NAME, &lnk_vrf, ¬_supported)) {
|
||||
if (not_supported) {
|
||||
g_test_skip ("Cannot create VRF interface because of missing kernel support");
|
||||
goto out_delete_parent;
|
||||
}
|
||||
g_error ("Failed adding VRF interface");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_VXLAN: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue