diff options
author | Thomas Haller <thaller@redhat.com> | 2015-07-14 12:12:32 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-07-14 13:36:50 +0200 |
commit | cf4b1a0c3d05d498d87e30b68246b71f4eaab914 (patch) | |
tree | 3685843303be9c0312380c60a669815f18825a05 | |
parent | 6f8fcd2f47541ff78aa83c584a731fedec6e3a8f (diff) | |
download | NetworkManager-cf4b1a0c3d05d498d87e30b68246b71f4eaab914.tar.gz |
test: add nmtst_platform_ip4_route() utils
-rw-r--r-- | include/nm-test-utils.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 14d4bb4514..3007674e13 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -812,6 +812,38 @@ nmtst_platform_ip6_address_full (const char *address, const char *peer_address, return addr; } +inline static NMPlatformIP4Route * +nmtst_platform_ip4_route (const char *network, guint plen, const char *gateway) +{ + static NMPlatformIP4Route route; + + memset (&route, 0, sizeof (route)); + route.network = nmtst_inet4_from_string (network); + route.plen = plen; + route.gateway = nmtst_inet4_from_string (gateway); + + return &route; +} + +inline static NMPlatformIP4Route * +nmtst_platform_ip4_route_full (const char *network, guint plen, const char *gateway, + int ifindex, NMIPConfigSource source, + guint metric, guint mss, + guint8 scope, + const char *pref_src) +{ + NMPlatformIP4Route *route = nmtst_platform_ip4_route (network, plen, gateway); + + route->ifindex = ifindex; + route->source = source; + route->metric = metric; + route->mss = mss; + route->scope_inv = nm_platform_route_scope_inv (scope); + route->pref_src = nmtst_inet4_from_string (pref_src); + + return route; +} + inline static NMPlatformIP6Route * nmtst_platform_ip6_route (const char *network, guint plen, const char *gateway) { |