From 6731d6eb86c5fbdb1ffdd1d167162594c8b8beb7 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Tue, 8 Feb 2005 20:02:28 +0000 Subject: general cleanup + add -C and -c --- userspace/ebtables2/extensions/ebt_pkttype.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'userspace/ebtables2/extensions/ebt_pkttype.c') diff --git a/userspace/ebtables2/extensions/ebt_pkttype.c b/userspace/ebtables2/extensions/ebt_pkttype.c index f7893bb..7894d0d 100644 --- a/userspace/ebtables2/extensions/ebt_pkttype.c +++ b/userspace/ebtables2/extensions/ebt_pkttype.c @@ -1,9 +1,9 @@ -/* - * ebtables ebt_pkttype +/* ebt_pkttype * - * Authors: - * Bart De Schuymer + * Authors: + * Bart De Schuymer * + * April, 2003 */ #include @@ -38,7 +38,7 @@ static void print_help() printf( "pkttype options:\n" "--pkttype-type [!] type: class the packet belongs to\n" -"Possible values: broadcast, multicast, host, otherhost any byte value.\n"); +"Possible values: broadcast, multicast, host, otherhost, or any other byte value (which would be pretty useless).\n"); } static void init(struct ebt_entry_match *match) @@ -58,25 +58,21 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, switch (c) { case '1': ebt_check_option(flags, 1); - if (ebt_check_inverse(optarg)) + if (ebt_check_inverse2(optarg)) ptinfo->invert = 1; - if (optind > argc) - ebt_print_error("Missing pkttype class specification"); - - i = strtol(argv[optind - 1], &end, 16); + i = strtol(optarg, &end, 16); if (*end != '\0') { int j = 0; i = -1; while (classes[j][0]) - if (!strcasecmp(argv[optind - 1], classes[j++])) { + if (!strcasecmp(optarg, classes[j++])) { i = j - 1; break; } } if (i < 0 || i > 255) - ebt_print_error("Problem with specified pkttype class"); + ebt_print_error2("Problem with specified pkttype class"); ptinfo->pkt_type = (uint8_t)i; - break; default: return 0; -- cgit v1.2.3