From ff587205009a0d49e2d086765de87dc619b028bb 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 --- extensions/ebt_arpreply.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'extensions/ebt_arpreply.c') diff --git a/extensions/ebt_arpreply.c b/extensions/ebt_arpreply.c index 9c50519..32e50b4 100644 --- a/extensions/ebt_arpreply.c +++ b/extensions/ebt_arpreply.c @@ -1,3 +1,12 @@ +/* ebt_arpreply + * + * Authors: + * Grzegorz Borowiak + * Bart De Schuymer + * + * August, 2003 + */ + #include #include #include @@ -48,17 +57,16 @@ static int parse(int c, char **argv, int argc, switch (c) { case REPLY_MAC: - ebt_check_option(flags, OPT_REPLY_MAC); + ebt_check_option2(flags, OPT_REPLY_MAC); if (!(addr = ether_aton(optarg))) - ebt_print_error("Problem with specified " - "--arpreply-mac mac"); + ebt_print_error2("Problem with specified --arpreply-mac mac"); memcpy(replyinfo->mac, addr, ETH_ALEN); mac_supplied = 1; break; case REPLY_TARGET: - ebt_check_option(flags, OPT_REPLY_TARGET); + ebt_check_option2(flags, OPT_REPLY_TARGET); if (FILL_TARGET(optarg, replyinfo->target)) - ebt_print_error("Illegal --arpreply-target target"); + ebt_print_error2("Illegal --arpreply-target target"); break; default: @@ -74,17 +82,17 @@ static void final_check(const struct ebt_u_entry *entry, struct ebt_arpreply_info *replyinfo = (struct ebt_arpreply_info *)target->data; - if (entry->ethproto != ETH_P_ARP || entry->invflags & EBT_IPROTO) - ebt_print_error("For ARP replying the protocol must be " - "specified as ARP"); - if (time == 0 && mac_supplied == 0) + if (entry->ethproto != ETH_P_ARP || entry->invflags & EBT_IPROTO) { + ebt_print_error("For ARP replying the protocol must be specified as ARP"); + } else if (time == 0 && mac_supplied == 0) { ebt_print_error("No arpreply mac supplied"); - if (BASE_CHAIN && replyinfo->target == EBT_RETURN) - ebt_print_error("--arpreply-target RETURN not allowed on " - "base chain"); - CLEAR_BASE_CHAIN_BIT; - if (strcmp(name, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING)) - ebt_print_error("arpreply only allowed in PREROUTING"); + } else if (BASE_CHAIN && replyinfo->target == EBT_RETURN) { + ebt_print_error("--arpreply-target RETURN not allowed on base chain"); + } else { + CLEAR_BASE_CHAIN_BIT; + if (strcmp(name, "nat") || hookmask & ~(1 << NF_BR_PRE_ROUTING)) + ebt_print_error("arpreply only allowed in PREROUTING"); + } } static void print(const struct ebt_u_entry *entry, -- cgit v1.2.3