* Re: [PATCH] libxtables: change option precedence order to be intuitive
@ 2010-11-15 12:28 Jan Engelhardt
2010-11-15 12:28 ` [PATCH] iptables: fix longopt reecognition and workaround getopt(3) behavior Jan Engelhardt
2010-11-15 12:56 ` [PATCH] libxtables: change option precedence order to be intuitive Patrick McHardy
0 siblings, 2 replies; 7+ messages in thread
From: Jan Engelhardt @ 2010-11-15 12:28 UTC (permalink / raw)
To: kaber; +Cc: netfilter-devel
The following changes since commit 648fd1ad68ae2ec675ac07efee80783912535404:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libxt_TOS: avoid an undesired overflowing computation (2010-11-02 09:17:09 +0100)
are available in the git repository at:
git://dev.medozas.de/iptables master
Jan Engelhardt (1):
iptables: fix longopt reecognition and workaround getopt(3) behavior
ip6tables.c | 1 +
iptables.c | 1 +
xtables.c | 3 ++-
3 files changed, 4 insertions(+), 1 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] iptables: fix longopt reecognition and workaround getopt(3) behavior
2010-11-15 12:28 [PATCH] libxtables: change option precedence order to be intuitive Jan Engelhardt
@ 2010-11-15 12:28 ` Jan Engelhardt
2010-11-15 12:56 ` [PATCH] libxtables: change option precedence order to be intuitive Patrick McHardy
1 sibling, 0 replies; 7+ messages in thread
From: Jan Engelhardt @ 2010-11-15 12:28 UTC (permalink / raw)
To: kaber; +Cc: netfilter-devel
* On the first call to getopt, opts was NULL, so long options would
not be recognized until a match/target was loaded.
Whacky getopt behavior:
* If the longopts parameter is NULL, getopt fails to recognize unknown
options, such that `iptables-multi main --append` will print a garbage
help message ("main needs an argument").
* If the longopts parameter is NULL on the first call, but not on
subsequent calls, it completely screws up option parsing, taking
the --dport in `iptables-multi main -A INPUT -p tcp --dport 1000`
as --destination instead, but not accepting "--destination 1.2.3.4"
either.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
ip6tables.c | 1 +
iptables.c | 1 +
xtables.c | 3 ++-
3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ip6tables.c b/ip6tables.c
index 150893d..8318f91 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -147,6 +147,7 @@ void ip6tables_exit_error(enum xtables_exittype status, const char *msg, ...) __
struct xtables_globals ip6tables_globals = {
.option_offset = 0,
.program_version = IPTABLES_VERSION,
+ .opts = original_opts,
.orig_opts = original_opts,
.exit_err = ip6tables_exit_error,
};
diff --git a/iptables.c b/iptables.c
index 4c8bd77..c800fff 100644
--- a/iptables.c
+++ b/iptables.c
@@ -147,6 +147,7 @@ void iptables_exit_error(enum xtables_exittype status, const char *msg, ...) __a
struct xtables_globals iptables_globals = {
.option_offset = 0,
.program_version = IPTABLES_VERSION,
+ .opts = original_opts,
.orig_opts = original_opts,
.exit_err = iptables_exit_error,
};
diff --git a/xtables.c b/xtables.c
index 7658038..d0aa868 100644
--- a/xtables.c
+++ b/xtables.c
@@ -75,7 +75,8 @@ void basic_exit_err(enum xtables_exittype status, const char *msg, ...)
void xtables_free_opts(int unused)
{
- free(xt_params->opts);
+ if (xt_params->opts != xt_params->orig_opts)
+ free(xt_params->opts);
}
struct option *xtables_merge_options(struct option *orig_opts,
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] libxtables: change option precedence order to be intuitive
2010-11-15 12:28 [PATCH] libxtables: change option precedence order to be intuitive Jan Engelhardt
2010-11-15 12:28 ` [PATCH] iptables: fix longopt reecognition and workaround getopt(3) behavior Jan Engelhardt
@ 2010-11-15 12:56 ` Patrick McHardy
2010-11-15 13:13 ` Jan Engelhardt
1 sibling, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2010-11-15 12:56 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 15.11.2010 13:28, Jan Engelhardt wrote:
> The following changes since commit 648fd1ad68ae2ec675ac07efee80783912535404:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> libxt_TOS: avoid an undesired overflowing computation (2010-11-02 09:17:09 +0100)
>
> are available in the git repository at:
> git://dev.medozas.de/iptables master
Well, as I'm sure you're aware this doesn't apply to the
current tree, so please rebase.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxtables: change option precedence order to be intuitive
2010-11-15 12:56 ` [PATCH] libxtables: change option precedence order to be intuitive Patrick McHardy
@ 2010-11-15 13:13 ` Jan Engelhardt
2010-11-15 13:15 ` Patrick McHardy
0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2010-11-15 13:13 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
On Monday 2010-11-15 13:56, Patrick McHardy wrote:
>On 15.11.2010 13:28, Jan Engelhardt wrote:
>> The following changes since commit 648fd1ad68ae2ec675ac07efee80783912535404:
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> libxt_TOS: avoid an undesired overflowing computation (2010-11-02 09:17:09 +0100)
>>
>> are available in the git repository at:
>> git://dev.medozas.de/iptables master
>
>Well, as I'm sure you're aware this doesn't apply to the
>current tree, so please rebase.
Revert the revert and merge?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxtables: change option precedence order to be intuitive
2010-11-15 13:13 ` Jan Engelhardt
@ 2010-11-15 13:15 ` Patrick McHardy
2010-11-15 13:41 ` Jan Engelhardt
0 siblings, 1 reply; 7+ messages in thread
From: Patrick McHardy @ 2010-11-15 13:15 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 15.11.2010 14:13, Jan Engelhardt wrote:
> On Monday 2010-11-15 13:56, Patrick McHardy wrote:
>
>> On 15.11.2010 13:28, Jan Engelhardt wrote:
>>> The following changes since commit 648fd1ad68ae2ec675ac07efee80783912535404:
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>
>>> libxt_TOS: avoid an undesired overflowing computation (2010-11-02 09:17:09 +0100)
>>>
>>> are available in the git repository at:
>>> git://dev.medozas.de/iptables master
>>
>> Well, as I'm sure you're aware this doesn't apply to the
>> current tree, so please rebase.
>
> Revert the revert and merge?
>
Yes please.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxtables: change option precedence order to be intuitive
2010-11-15 13:15 ` Patrick McHardy
@ 2010-11-15 13:41 ` Jan Engelhardt
2010-11-15 13:46 ` Patrick McHardy
0 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2010-11-15 13:41 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
On Monday 2010-11-15 14:15, Patrick McHardy wrote:
>>>>
>>>> are available in the git repository at:
>>>> git://dev.medozas.de/iptables master
>>
>> Revert the revert and merge?
>
>Yes please.
git://dev.medozas.de/iptables master
include/xtables.h.in | 5 +++--
ip6tables.c | 6 +++---
iptables.c | 12 +++++++++---
xtables.c | 49 ++++++++++++++++++++++++++++---------------------
4 files changed, 43 insertions(+), 29 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] libxtables: change option precedence order to be intuitive
2010-11-15 13:41 ` Jan Engelhardt
@ 2010-11-15 13:46 ` Patrick McHardy
0 siblings, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2010-11-15 13:46 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 15.11.2010 14:41, Jan Engelhardt wrote:
> git://dev.medozas.de/iptables master
Pulled, tested and pushed out again. Thanks Jan.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-15 13:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-15 12:28 [PATCH] libxtables: change option precedence order to be intuitive Jan Engelhardt
2010-11-15 12:28 ` [PATCH] iptables: fix longopt reecognition and workaround getopt(3) behavior Jan Engelhardt
2010-11-15 12:56 ` [PATCH] libxtables: change option precedence order to be intuitive Patrick McHardy
2010-11-15 13:13 ` Jan Engelhardt
2010-11-15 13:15 ` Patrick McHardy
2010-11-15 13:41 ` Jan Engelhardt
2010-11-15 13:46 ` Patrick McHardy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).