0f637a
From c1eaf1738533eeec3dc1bdc2285dbf28c68d5042 Mon Sep 17 00:00:00 2001
0f637a
From: Phil Sutter <phil@nwl.cc>
0f637a
Date: Fri, 30 Jul 2021 12:25:10 +0200
0f637a
Subject: [PATCH] ebtables: Dump atomic waste
0f637a
0f637a
With ebtables-nft.8 now educating people about the missing
0f637a
functionality, get rid of atomic remains in source code. This eliminates
0f637a
mostly comments except for --atomic-commit which was treated as alias of
0f637a
--init-table. People not using the latter are probably trying to
0f637a
atomic-commit from an atomic-file which in turn is not supported, so no
0f637a
point keeping it.
0f637a
0f637a
Signed-off-by: Phil Sutter <phil@nwl.cc>
0f637a
(cherry picked from commit 263186372dc4ae6a54a29bea644bcf1fc8dc3fc0)
0f637a
---
0f637a
 iptables/xtables-eb.c | 53 -------------------------------------------
0f637a
 1 file changed, 53 deletions(-)
0f637a
0f637a
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
0f637a
index c006bc95ac681..b836616ed0259 100644
0f637a
--- a/iptables/xtables-eb.c
0f637a
+++ b/iptables/xtables-eb.c
0f637a
@@ -262,10 +262,6 @@ struct option ebt_original_options[] =
0f637a
 	{ "new-chain"      , required_argument, 0, 'N' },
0f637a
 	{ "rename-chain"   , required_argument, 0, 'E' },
0f637a
 	{ "delete-chain"   , optional_argument, 0, 'X' },
0f637a
-	{ "atomic-init"    , no_argument      , 0, 7   },
0f637a
-	{ "atomic-commit"  , no_argument      , 0, 8   },
0f637a
-	{ "atomic-file"    , required_argument, 0, 9   },
0f637a
-	{ "atomic-save"    , no_argument      , 0, 10  },
0f637a
 	{ "init-table"     , no_argument      , 0, 11  },
0f637a
 	{ "concurrent"     , no_argument      , 0, 13  },
0f637a
 	{ 0 }
0f637a
@@ -371,10 +367,6 @@ static void print_help(const struct xtables_target *t,
0f637a
 "--new-chain -N chain          : create a user defined chain\n"
0f637a
 "--rename-chain -E old new     : rename a chain\n"
0f637a
 "--delete-chain -X [chain]     : delete a user defined chain\n"
0f637a
-"--atomic-commit               : update the kernel w/t table contained in <FILE>\n"
0f637a
-"--atomic-init                 : put the initial kernel table into <FILE>\n"
0f637a
-"--atomic-save                 : put the current kernel table into <FILE>\n"
0f637a
-"--atomic-file file            : set <FILE> to file\n\n"
0f637a
 "Options:\n"
0f637a
 "--proto  -p [!] proto         : protocol hexadecimal, by name or LENGTH\n"
0f637a
 "--src    -s [!] address[/mask]: source mac address\n"
0f637a
@@ -1116,54 +1108,9 @@ print_zero:
0f637a
 					       "Use --Lmac2 with -L");
0f637a
 			flags |= LIST_MAC2;
0f637a
 			break;
0f637a
-		case 8 : /* atomic-commit */
0f637a
-/*
0f637a
-			replace->command = c;
0f637a
-			if (OPT_COMMANDS)
0f637a
-				ebt_print_error2("Multiple commands are not allowed");
0f637a
-			replace->flags |= OPT_COMMAND;
0f637a
-			if (!replace->filename)
0f637a
-				ebt_print_error2("No atomic file specified");*/
0f637a
-			/* Get the information from the file */
0f637a
-			/*ebt_get_table(replace, 0);*/
0f637a
-			/* We don't want the kernel giving us its counters,
0f637a
-			 * they would overwrite the counters extracted from
0f637a
-			 * the file */
0f637a
-			/*replace->num_counters = 0;*/
0f637a
-			/* Make sure the table will be written to the kernel */
0f637a
-			/*free(replace->filename);
0f637a
-			replace->filename = NULL;
0f637a
-			break;*/
0f637a
-		/*case 7 :*/ /* atomic-init */
0f637a
-		/*case 10:*/ /* atomic-save */
0f637a
 		case 11: /* init-table */
0f637a
 			nft_table_flush(h, *table);
0f637a
 			return 1;
0f637a
-		/*
0f637a
-			replace->command = c;
0f637a
-			if (OPT_COMMANDS)
0f637a
-				ebt_print_error2("Multiple commands are not allowed");
0f637a
-			if (c != 11 && !replace->filename)
0f637a
-				ebt_print_error2("No atomic file specified");
0f637a
-			replace->flags |= OPT_COMMAND;
0f637a
-			{
0f637a
-				char *tmp = replace->filename;*/
0f637a
-
0f637a
-				/* Get the kernel table */
0f637a
-				/*replace->filename = NULL;
0f637a
-				ebt_get_kernel_table(replace, c == 10 ? 0 : 1);
0f637a
-				replace->filename = tmp;
0f637a
-			}
0f637a
-			break;
0f637a
-		case 9 :*/ /* atomic */
0f637a
-			/*
0f637a
-			if (OPT_COMMANDS)
0f637a
-				ebt_print_error2("--atomic has to come before the command");*/
0f637a
-			/* A possible memory leak here, but this is not
0f637a
-			 * executed in daemon mode */
0f637a
-			/*replace->filename = (char *)malloc(strlen(optarg) + 1);
0f637a
-			strcpy(replace->filename, optarg);
0f637a
-			break; */
0f637a
 		case 13 :
0f637a
 			break;
0f637a
 		case 1 :
0f637a
-- 
0f637a
2.33.0
0f637a