mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 03:20:18 +01:00
platform/tests/trivial: rename ip4_route_exists() functions to have nmtstp prefix
(cherry picked from commit f8f8c516e0)
This commit is contained in:
parent
7d6b286e1f
commit
bd76c1e2d0
3 changed files with 25 additions and 25 deletions
|
|
@ -185,7 +185,7 @@ link_callback (NMPlatform *platform, NMPObjectType obj_type, int ifindex, NMPlat
|
|||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric)
|
||||
nmtstp_ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric)
|
||||
{
|
||||
gs_free char *arg_network = NULL;
|
||||
const char *argv[] = {
|
||||
|
|
@ -263,7 +263,7 @@ ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric)
|
|||
}
|
||||
|
||||
void
|
||||
_assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric)
|
||||
_nmtstp_assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric)
|
||||
{
|
||||
int ifindex;
|
||||
gboolean exists_checked;
|
||||
|
|
@ -271,7 +271,7 @@ _assert_ip4_route_exists (const char *file, guint line, const char *func, gboole
|
|||
/* Check for existance of the route by spawning iproute2. Do this because platform
|
||||
* code might be entirely borked, but we expect ip-route to give a correct result.
|
||||
* If the ip command cannot be found, we accept this as success. */
|
||||
exists_checked = ip4_route_exists (ifname, network, plen, metric);
|
||||
exists_checked = nmtstp_ip4_route_exists (ifname, network, plen, metric);
|
||||
if (exists_checked != -1 && !exists_checked != !exists) {
|
||||
g_error ("[%s:%u] %s(): We expect the ip4 route %s/%d metric %u %s, but it %s",
|
||||
file, line, func,
|
||||
|
|
|
|||
|
|
@ -104,10 +104,10 @@ gboolean nmtstp_run_command_check_external (int external_command);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
gboolean ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric);
|
||||
gboolean nmtstp_ip4_route_exists (const char *ifname, guint32 network, int plen, guint32 metric);
|
||||
|
||||
void _assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric);
|
||||
#define assert_ip4_route_exists(exists, ifname, network, plen, metric) _assert_ip4_route_exists (__FILE__, __LINE__, G_STRFUNC, exists, ifname, network, plen, metric)
|
||||
void _nmtstp_assert_ip4_route_exists (const char *file, guint line, const char *func, gboolean exists, const char *ifname, guint32 network, int plen, guint32 metric);
|
||||
#define nmtstp_assert_ip4_route_exists(exists, ifname, network, plen, metric) _nmtstp_assert_ip4_route_exists (__FILE__, __LINE__, G_STRFUNC, exists, ifname, network, plen, metric)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -82,50 +82,50 @@ test_ip4_route_metric0 (void)
|
|||
int mss = 1000;
|
||||
|
||||
/* No routes initially */
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* add the first route */
|
||||
g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, metric, mss));
|
||||
accept_signal (route_added);
|
||||
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* Deleting route with metric 0 does nothing */
|
||||
g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, 0));
|
||||
ensure_no_signal (route_removed);
|
||||
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* add the second route */
|
||||
g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, INADDR_ANY, 0, 0, mss));
|
||||
accept_signal (route_added);
|
||||
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* Delete route with metric 0 */
|
||||
g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, 0));
|
||||
accept_signal (route_removed);
|
||||
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* Delete route with metric 0 again (we expect nothing to happen) */
|
||||
g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, 0));
|
||||
ensure_no_signal (route_removed);
|
||||
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
/* Delete the other route */
|
||||
g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, metric));
|
||||
accept_signal (route_removed);
|
||||
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, 0);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
|
||||
free_signal (route_added);
|
||||
free_signal (route_changed);
|
||||
|
|
@ -156,9 +156,9 @@ test_ip4_route (void)
|
|||
accept_signal (route_added);
|
||||
|
||||
/* Add route */
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, network, plen, gateway, 0, metric, mss));
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, network, plen, metric);
|
||||
accept_signal (route_added);
|
||||
|
||||
/* Add route again */
|
||||
|
|
@ -166,9 +166,9 @@ test_ip4_route (void)
|
|||
accept_signals (route_changed, 0, 1);
|
||||
|
||||
/* Add default route */
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, 0, 0, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, 0, 0, metric);
|
||||
g_assert (nm_platform_ip4_route_add (NM_PLATFORM_GET, ifindex, NM_IP_CONFIG_SOURCE_USER, 0, 0, gateway, 0, metric, mss));
|
||||
assert_ip4_route_exists (TRUE, DEVICE_NAME, 0, 0, metric);
|
||||
nmtstp_assert_ip4_route_exists (TRUE, DEVICE_NAME, 0, 0, metric);
|
||||
accept_signal (route_added);
|
||||
|
||||
/* Add default route again */
|
||||
|
|
@ -208,7 +208,7 @@ test_ip4_route (void)
|
|||
|
||||
/* Remove route */
|
||||
g_assert (nm_platform_ip4_route_delete (NM_PLATFORM_GET, ifindex, network, plen, metric));
|
||||
assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
nmtstp_assert_ip4_route_exists (FALSE, DEVICE_NAME, network, plen, metric);
|
||||
accept_signal (route_removed);
|
||||
|
||||
/* Remove route again */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue