All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] extensions: libarpt_mangle.c : Constify option struct
@ 2017-04-02  7:05 Arushi Singhal
  2017-04-02  7:05 ` [PATCH 2/2] iptables: iptables: " Arushi Singhal
  0 siblings, 1 reply; 3+ messages in thread
From: Arushi Singhal @ 2017-04-02  7:05 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

The struct arpmangle_opts of the type option is only used to
initialise a field inside the xtables_target struct and is
not modified anywhere.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 extensions/libarpt_mangle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extensions/libarpt_mangle.c b/extensions/libarpt_mangle.c
index fdd2104..358b35d 100644
--- a/extensions/libarpt_mangle.c
+++ b/extensions/libarpt_mangle.c
@@ -32,7 +32,7 @@ static void arpmangle_print_help(void)
 #define MANGLE_DEVT   '4'
 #define MANGLE_TARGET '5'
 
-static struct option arpmangle_opts[] = {
+static const struct option arpmangle_opts[] = {
 	{ .name = "mangle-ip-s",	.has_arg = true, .val = MANGLE_IPS },
 	{ .name = "mangle-ip-d",	.has_arg = true, .val = MANGLE_IPT },
 	{ .name = "mangle-mac-s",	.has_arg = true, .val = MANGLE_DEVS },
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] iptables: iptables: Constify option struct
  2017-04-02  7:05 [PATCH 1/2] extensions: libarpt_mangle.c : Constify option struct Arushi Singhal
@ 2017-04-02  7:05 ` Arushi Singhal
  2017-04-07 18:33   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Arushi Singhal @ 2017-04-02  7:05 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Arushi Singhal

The structs of the type option are not modified anywhere.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/ip6tables.c    | 2 +-
 iptables/iptables-xml.c | 2 +-
 iptables/xtables-arp.c  | 2 +-
 iptables/xtables-eb.c   | 2 +-
 iptables/xtables.c      | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/iptables/ip6tables.c b/iptables/ip6tables.c
index 579d347..fd1c541 100644
--- a/iptables/ip6tables.c
+++ b/iptables/ip6tables.c
@@ -78,7 +78,7 @@ static const char optflags[]
 
 static const char unsupported_rev[] = " [unsupported revision]";
 
-static struct option original_opts[] = {
+static const struct option original_opts[] = {
 	{.name = "append",        .has_arg = 1, .val = 'A'},
 	{.name = "delete",        .has_arg = 1, .val = 'D'},
 	{.name = "check" ,        .has_arg = 1, .val = 'C'},
diff --git a/iptables/iptables-xml.c b/iptables/iptables-xml.c
index 740a563..abe7bbe 100644
--- a/iptables/iptables-xml.c
+++ b/iptables/iptables-xml.c
@@ -38,7 +38,7 @@ static int verbose = 0;
 /* Whether to combine actions of sequential rules with identical conditions */
 static int combine = 0;
 /* Keeping track of external matches and targets.  */
-static struct option options[] = {
+static const struct option options[] = {
 	{"verbose", 0, NULL, 'v'},
 	{"combine", 0, NULL, 'c'},
 	{"help", 0, NULL, 'h'},
diff --git a/iptables/xtables-arp.c b/iptables/xtables-arp.c
index 6aa000a..85feb48 100644
--- a/iptables/xtables-arp.c
+++ b/iptables/xtables-arp.c
@@ -107,7 +107,7 @@ static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
 static const char optflags[NUMBER_OF_OPT]
 = { 'n', 's', 'd', 2, 3, 7, 8, 4, 5, 6, 'j', 'v', 'i', 'o', '0', 'c'};
 
-static struct option original_opts[] = {
+static const struct option original_opts[] = {
 	{ "append", 1, 0, 'A' },
 	{ "delete", 1, 0,  'D' },
 	{ "insert", 1, 0,  'I' },
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index c8b5d4f..60ec935 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -247,7 +247,7 @@ static int get_current_chain(const char *chain)
 
 /* Default command line options. Do not mess around with the already
  * assigned numbers unless you know what you are doing */
-static struct option ebt_original_options[] =
+static const struct option ebt_original_options[] =
 {
 	{ "append"         , required_argument, 0, 'A' },
 	{ "insert"         , required_argument, 0, 'I' },
diff --git a/iptables/xtables.c b/iptables/xtables.c
index 286866f..636aa87 100644
--- a/iptables/xtables.c
+++ b/iptables/xtables.c
@@ -59,7 +59,7 @@ static const char cmdflags[] = { 'I', 'D', 'D', 'R', 'A', 'L', 'F', 'Z',
 static const char optflags[]
 = { 'n', 's', 'd', 'p', 'j', 'v', 'x', 'i', 'o', '0', 'c', 'f'};
 
-static struct option original_opts[] = {
+static const struct option original_opts[] = {
 	{.name = "append",	  .has_arg = 1, .val = 'A'},
 	{.name = "delete",	  .has_arg = 1, .val = 'D'},
 	{.name = "check",	  .has_arg = 1, .val = 'C'},
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] iptables: iptables: Constify option struct
  2017-04-02  7:05 ` [PATCH 2/2] iptables: iptables: " Arushi Singhal
@ 2017-04-07 18:33   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2017-04-07 18:33 UTC (permalink / raw)
  To: Arushi Singhal; +Cc: netfilter-devel

On Sun, Apr 02, 2017 at 12:35:08PM +0530, Arushi Singhal wrote:
> The structs of the type option are not modified anywhere.

xtables-eb.c: In function ‘ebt_load_match_extensions’:
xtables-eb.c:653:7: warning: assignment discards ‘const’ qualifier
from pointer target type
  opts = ebt_original_options;


You don't compile test your patches :(

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-07 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-02  7:05 [PATCH 1/2] extensions: libarpt_mangle.c : Constify option struct Arushi Singhal
2017-04-02  7:05 ` [PATCH 2/2] iptables: iptables: " Arushi Singhal
2017-04-07 18:33   ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.