Skip to contentSkip to conversation

xt: use struct xt_xlate_{mt,tg}_params

PATCH New Pablo Neira Ayuso 1 participant 1 message Jul 24, 2016 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 xt: use struct xt_xlate_{mt,tg}_params

Adapt this code to the new interface that introduces struct xt_xlate_{mt,tg}_params.

---
 src/xt.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
src/xt.c +15 -5
index afcc836..0777d9c 100644
@@ -35,9 +35,14 @@ void xt_stmt_xlate(const struct stmt *stmt)
 		if (stmt->xt.match == NULL && stmt->xt.opts) {
 			printf("%s", stmt->xt.opts);
 		} else if (stmt->xt.match->xlate) {
-			stmt->xt.match->xlate(stmt->xt.entry,
-					      stmt->xt.match->m, xl, 0);
-				printf("%s", xt_xlate_get(xl));
+			struct xt_xlate_mt_params params = {
+				.ip		= stmt->xt.entry,
+				.match		= stmt->xt.match->m,
+				.numeric        = 0,
+			};
+
+			stmt->xt.match->xlate(xl, &params);
+			printf("%s", xt_xlate_get(xl));
 		} else if (stmt->xt.match->print) {
 			printf("#");
 			stmt->xt.match->print(&stmt->xt.entry,
@@ -49,8 +54,13 @@ void xt_stmt_xlate(const struct stmt *stmt)
 		if (stmt->xt.target == NULL && stmt->xt.opts) {
 			printf("%s", stmt->xt.opts);
 		} else if (stmt->xt.target->xlate) {
-			stmt->xt.target->xlate(stmt->xt.entry,
-					       stmt->xt.target->t, xl, 0);
+			struct xt_xlate_tg_params params = {
+				.ip		= stmt->xt.entry,
+				.target		= stmt->xt.target->t,
+				.numeric        = 0,
+			};
+
+			stmt->xt.target->xlate(xl, &params);
 			printf("%s", xt_xlate_get(xl));
 		} else if (stmt->xt.target->print) {
 			printf("#");
Signature · 1 line
2.1.4