net: ipv6: added tests that verify change route cache aging logic fix
This reverts commit e5c1e02a5db56458b8099ed3cd37b2179ecd8d3b.
Change-Id: I6d305b1f618a338f71b39b8d7cc265198fab9b15
Kunitconfig-Revision: c4ad34242571a1883bdd1db0dae32bb6cc69559d
Signed-off-by: Brendan Higgins <brendanhiggins@google.com>
diff --git a/net/ipv6/route-test.c b/net/ipv6/route-test.c
index beeb36d..627fe55 100644
--- a/net/ipv6/route-test.c
+++ b/net/ipv6/route-test.c
@@ -198,6 +198,40 @@ rt6_age_exceptions_test_pmtu_not_expire_with_router_neighbor(struct test *test)
}
static void
+rt6_age_exceptions_test_pmtu_eventually_expire_with_router_neighbor(struct test *test)
+{
+ struct rt6_test *ctx = test->priv;
+ struct fib6_info *rt_info = ctx->rt_info;
+ struct rt6_info *rt6_ex_info;
+ struct mock_expectation *handle;
+ struct fib6_gc_args gc_args;
+ struct inet6_dev *in6_dev;
+ struct neighbour *neigh;
+
+ rt6_ex_info = ip6_rt_pcpu_alloc(rt_info);
+ rt6_ex_info->rt6i_flags |= RTF_EXPIRES | RTF_GATEWAY;
+ rt6_ex_info->dst.expires = 1;
+ rt6_add_exception(test, rt_info, rt6_ex_info);
+
+ in6_dev = in6_dev_get(ctx->net->loopback_dev);
+ ASSERT_NOT_ERR_OR_NULL(test, in6_dev);
+ in6_dev->nd_parms = neigh_parms_clone(&nd_tbl.parms);
+ in6_dev_put(in6_dev);
+ neigh = __neigh_create(&nd_tbl, &rt6_ex_info->rt6i_gateway, ctx->net->loopback_dev, false);
+ ASSERT_NOT_ERR_OR_NULL(test, neigh);
+ neigh = __ipv6_neigh_lookup_noref(rt6_ex_info->dst.dev, &rt6_ex_info->rt6i_gateway);
+ ASSERT_NOT_ERR_OR_NULL(test, neigh);
+ neigh->flags |= NTF_ROUTER;
+
+ handle = EXPECT_CALL(rt6_remove_exception(any(test), any(test)));
+ handle->min_calls_expected = 1;
+ handle->max_calls_expected = 1;
+ handle->action = int_return(test, 0);
+
+ rt6_age_exceptions(rt_info, &gc_args, 2);
+}
+
+static void
rt6_age_exceptions_test_pmtu_expire_with_non_router_neighbor(struct test *test)
{
struct rt6_test *ctx = test->priv;
@@ -305,6 +339,7 @@ static struct test_case rt6_test_cases[] = {
TEST_CASE(rt6_age_exceptions_test_pmtu_expires_after_timeout),
TEST_CASE(rt6_age_exceptions_test_pmtu_expires_with_no_neighbor),
TEST_CASE(rt6_age_exceptions_test_pmtu_not_expire_with_router_neighbor),
+ TEST_CASE(rt6_age_exceptions_test_pmtu_eventually_expire_with_router_neighbor),
TEST_CASE(rt6_age_exceptions_test_pmtu_expire_with_non_router_neighbor),
{},
};