From 836854599db7b31aeab6a72bf1c28e444e8c858a Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 12 Feb 2013 10:19:51 +0100 Subject: [PATCH] test-iptables: Add fallthrough unit test A fallthrough rule is a one which does not have a verdict, e.g. ACCEPT, DROP etc. --- unit/test-iptables.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/unit/test-iptables.c b/unit/test-iptables.c index e378a90..4fb8059 100644 --- a/unit/test-iptables.c +++ b/unit/test-iptables.c @@ -160,6 +160,24 @@ static void test_iptables_rule2(void) g_assert(err == 0); } +static void test_iptables_target0(void) +{ + int err; + + /* Test if 'fallthrough' targets work */ + + err = __connman_iptables_append("filter", "INPUT", + "-m mark --mark 1"); + g_assert(err == 0); + + err = __connman_iptables_append("filter", "INPUT", + "-m mark --mark 2"); + g_assert(err == 0); + + err = __connman_iptables_commit("filter"); + g_assert(err == 0); +} + struct connman_notifier *nat_notifier; struct connman_service { @@ -250,6 +268,7 @@ int main(int argc, char *argv[]) g_test_add_func("/iptables/rule0", test_iptables_rule0); g_test_add_func("/iptables/rule1", test_iptables_rule1); g_test_add_func("/iptables/rule2", test_iptables_rule2); + g_test_add_func("/iptables/target0", test_iptables_target0); g_test_add_func("/nat/basic0", test_nat_basic0); g_test_add_func("/nat/basic1", test_nat_basic1); -- 2.7.4