diff options
Diffstat (limited to 'userspace/ebtables2/extensions/ebt_802_3.c')
-rw-r--r-- | userspace/ebtables2/extensions/ebt_802_3.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/userspace/ebtables2/extensions/ebt_802_3.c b/userspace/ebtables2/extensions/ebt_802_3.c index e0b65ee..a43d060 100644 --- a/userspace/ebtables2/extensions/ebt_802_3.c +++ b/userspace/ebtables2/extensions/ebt_802_3.c @@ -1,3 +1,11 @@ +/* 802_3 + * + * Author: + * Chris Vitale <csv@bluetail.com> + * + * May 2003 + */ + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -43,28 +51,23 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, switch (c) { case _802_3_SAP: - ebt_check_option(flags, _802_3_SAP); - if (ebt_check_inverse(optarg)) + ebt_check_option2(flags, _802_3_SAP); + if (ebt_check_inverse2(optarg)) info->invflags |= EBT_802_3_SAP; - - if (optind > argc) - ebt_print_error("Missing 802.3-sap argument"); - i = strtoul(argv[optind - 1], &end, 16); + i = strtoul(optarg, &end, 16); if (i > 255 || *end != '\0') - ebt_print_error("Problem with specified " + ebt_print_error2("Problem with specified " "sap hex value, %x",i); info->sap = i; /* one byte, so no byte order worries */ info->bitmask |= EBT_802_3_SAP; break; case _802_3_TYPE: - ebt_check_option(flags, _802_3_TYPE); - if (ebt_check_inverse(optarg)) + ebt_check_option2(flags, _802_3_TYPE); + if (ebt_check_inverse2(optarg)) info->invflags |= EBT_802_3_TYPE; - if (optind > argc) - ebt_print_error("Missing 802.3-type argument"); - i = strtoul(argv[optind - 1], &end, 16); + i = strtoul(optarg, &end, 16); if (i > 65535 || *end != '\0') { - ebt_print_error("Problem with the specified " + ebt_print_error2("Problem with the specified " "type hex value, %x",i); } info->type = htons(i); |