summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-eb.c
diff options
context:
space:
mode:
Diffstat (limited to 'iptables/xtables-eb.c')
-rw-r--r--iptables/xtables-eb.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/iptables/xtables-eb.c b/iptables/xtables-eb.c
index a6cb3f1f..5f8f0fb5 100644
--- a/iptables/xtables-eb.c
+++ b/iptables/xtables-eb.c
@@ -584,19 +584,18 @@ invalid:
xtables_error(PARAMETER_PROBLEM,"Packet counter '%s' invalid", argv[optind]);
}
-static int parse_iface(char *iface, char *option)
+static void ebtables_parse_interface(const char *arg, char *vianame)
{
+ unsigned char mask[IFNAMSIZ];
char *c;
- if ((c = strchr(iface, '+'))) {
- if (*(c + 1) != '\0') {
+ xtables_parse_interface(arg, vianame, mask);
+
+ if ((c = strchr(vianame, '+'))) {
+ if (*(c + 1) != '\0')
xtables_error(PARAMETER_PROBLEM,
- "Spurious characters after '+' wildcard for '%s'", option);
- return -1;
- } else
- *c = IF_WILDCARD;
+ "Spurious characters after '+' wildcard");
}
- return 0;
}
/* This code is very similar to iptables/xtables.c:command_match() */
@@ -1008,12 +1007,7 @@ print_zero:
if (ebt_check_inverse2(optarg, argc, argv))
cs.eb.invflags |= EBT_IIN;
- if (strlen(optarg) >= IFNAMSIZ)
-big_iface_length:
- xtables_error(PARAMETER_PROBLEM,
- "Interface name length cannot exceed %d characters",
- IFNAMSIZ - 1);
- xtables_parse_interface(optarg, cs.eb.in, cs.eb.in_mask);
+ ebtables_parse_interface(optarg, cs.eb.in);
break;
} else if (c == 2) {
ebt_check_option2(&flags, OPT_LOGICALIN);
@@ -1023,11 +1017,7 @@ big_iface_length:
if (ebt_check_inverse2(optarg, argc, argv))
cs.eb.invflags |= EBT_ILOGICALIN;
- if (strlen(optarg) >= IFNAMSIZ)
- goto big_iface_length;
- strcpy(cs.eb.logical_in, optarg);
- if (parse_iface(cs.eb.logical_in, "--logical-in"))
- return -1;
+ ebtables_parse_interface(optarg, cs.eb.logical_in);
break;
} else if (c == 'o') {
ebt_check_option2(&flags, OPT_OUT);
@@ -1037,10 +1027,7 @@ big_iface_length:
if (ebt_check_inverse2(optarg, argc, argv))
cs.eb.invflags |= EBT_IOUT;
- if (strlen(optarg) >= IFNAMSIZ)
- goto big_iface_length;
-
- xtables_parse_interface(optarg, cs.eb.out, cs.eb.out_mask);
+ ebtables_parse_interface(optarg, cs.eb.out);
break;
} else if (c == 3) {
ebt_check_option2(&flags, OPT_LOGICALOUT);
@@ -1050,11 +1037,7 @@ big_iface_length:
if (ebt_check_inverse2(optarg, argc, argv))
cs.eb.invflags |= EBT_ILOGICALOUT;
- if (strlen(optarg) >= IFNAMSIZ)
- goto big_iface_length;
- strcpy(cs.eb.logical_out, optarg);
- if (parse_iface(cs.eb.logical_out, "--logical-out"))
- return -1;
+ ebtables_parse_interface(optarg, cs.eb.logical_out);
break;
} else if (c == 'j') {
ebt_check_option2(&flags, OPT_JUMP);