diff options
-rw-r--r-- | extensions/libxt_conntrack.c | 15 | ||||
-rw-r--r-- | iptables/xtables.c | 4 | ||||
-rw-r--r-- | iptables/xtoptions.c | 6 |
3 files changed, 18 insertions, 7 deletions
diff --git a/extensions/libxt_conntrack.c b/extensions/libxt_conntrack.c index 060b9477..fff69f8a 100644 --- a/extensions/libxt_conntrack.c +++ b/extensions/libxt_conntrack.c @@ -129,13 +129,20 @@ static const struct xt_option_entry conntrack2_mt_opts[] = { .flags = XTOPT_INVERT}, {.name = "ctexpire", .id = O_CTEXPIRE, .type = XTTYPE_UINT32RC, .flags = XTOPT_INVERT}, - {.name = "ctorigsrcport", .id = O_CTORIGSRCPORT, .type = XTTYPE_PORT, + /* + * Rev 1 and 2 only store one port, and we would normally use + * %XTTYPE_PORT (rather than %XTTYPE_PORTRC) for that. The resulting + * error message - in case a user passed a range nevertheless - + * "port 22:23 resolved to nothing" is not quite as useful as using + * %XTTYPE_PORTC and libxt_conntrack's own range test. + */ + {.name = "ctorigsrcport", .id = O_CTORIGSRCPORT, .type = XTTYPE_PORTRC, .flags = XTOPT_INVERT | XTOPT_NBO}, - {.name = "ctorigdstport", .id = O_CTORIGDSTPORT, .type = XTTYPE_PORT, + {.name = "ctorigdstport", .id = O_CTORIGDSTPORT, .type = XTTYPE_PORTRC, .flags = XTOPT_INVERT | XTOPT_NBO}, - {.name = "ctreplsrcport", .id = O_CTREPLSRCPORT, .type = XTTYPE_PORT, + {.name = "ctreplsrcport", .id = O_CTREPLSRCPORT, .type = XTTYPE_PORTRC, .flags = XTOPT_INVERT | XTOPT_NBO}, - {.name = "ctrepldstport", .id = O_CTREPLDSTPORT, .type = XTTYPE_PORT, + {.name = "ctrepldstport", .id = O_CTREPLDSTPORT, .type = XTTYPE_PORTRC, .flags = XTOPT_INVERT | XTOPT_NBO}, {.name = "ctdir", .id = O_CTDIR, .type = XTTYPE_STRING}, XTOPT_TABLEEND, diff --git a/iptables/xtables.c b/iptables/xtables.c index 233efa30..e72aa284 100644 --- a/iptables/xtables.c +++ b/iptables/xtables.c @@ -515,15 +515,13 @@ void xtables_parse_interface(const char *arg, char *vianame, strcpy(vianame, arg); if (vialen == 0) - memset(mask, 0, IFNAMSIZ); + return; else if (vianame[vialen - 1] == '+') { memset(mask, 0xFF, vialen - 1); - memset(mask + vialen - 1, 0, IFNAMSIZ - vialen + 1); /* Don't remove `+' here! -HW */ } else { /* Include nul-terminator in match */ memset(mask, 0xFF, vialen + 1); - memset(mask + vialen + 1, 0, IFNAMSIZ - vialen - 1); for (i = 0; vianame[i]; i++) { if (vianame[i] == '/' || vianame[i] == ' ') { diff --git a/iptables/xtoptions.c b/iptables/xtoptions.c index 04344af4..5f617a42 100644 --- a/iptables/xtoptions.c +++ b/iptables/xtoptions.c @@ -826,6 +826,12 @@ void xtables_option_parse(struct xt_option_call *cb) xt_params->exit_err(PARAMETER_PROBLEM, "%s: option \"--%s\" requires an argument.\n", cb->ext_name, entry->name); + /* + * Fill in fallback value for "nvals", in case an extension (as it + * happened with libxt_conntrack.2) tries to read it, despite not using + * a *RC option type. + */ + cb->nvals = 1; if (entry->type <= ARRAY_SIZE(xtopt_subparse) && xtopt_subparse[entry->type] != NULL) xtopt_subparse[entry->type](cb); |