[PATCH] unit: Fix iptables test to work with iptables 1.8.11 changes.

Jussi Laakkonen <[email protected]> Wed, 6 May 2026 19:30:19 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Fix the unit test to work with the changes made to code to work with
iptables 1.8.11 and above.
---
 unit/test-iptables.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/unit/test-iptables.c b/unit/test-iptables.c
index a96d8679..101d873c 100644
--- a/unit/test-iptables.c
+++ b/unit/test-iptables.c
@@ -272,8 +272,12 @@ struct option *xtables_options_xfrm(struct option *opt1, struct option *opt2,
 {
 	if (test_config_type & TEST_CONFIG_OPTIONS_XFRM_FAIL)
 		call_error("xtables_options_xfrm");
-
+#if XTABLES_VERSION_CODE > 11
+	g_free(opt2);
+	return g_malloc0(sizeof(opt1));
+#else
 	return opt1;
+#endif
 }
 
 struct option *xtables_merge_options(struct option *orig_opts,
@@ -283,7 +287,12 @@ struct option *xtables_merge_options(struct option *orig_opts,
 	if (test_config_type & TEST_CONFIG_MERGE_OPTIONS_FAIL)
 		call_error("xtables_merge_options");
 
+#if XTABLES_VERSION_CODE > 11
+	g_free(oldopts);
+	return g_malloc0(sizeof(orig_opts));
+#else
 	return orig_opts;
+#endif
 }
 
 /* End of xtables dummies */
-- 
2.47.3