From c5e5b784fd1a919b8dd34a4d9e88c8d022f259bf Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 4 Mar 2018 09:28:56 +0100 Subject: Move ICMP type handling functions from ebt_ip6 to useful_functions.c Allow using these functions for ebt_ip as well. Signed-off-by: Matthias Schiffer Signed-off-by: Pablo Neira Ayuso --- include/ebtables_u.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ebtables_u.h b/include/ebtables_u.h index 35a5bcc..17afa94 100644 --- a/include/ebtables_u.h +++ b/include/ebtables_u.h @@ -222,6 +222,15 @@ struct ebt_u_target struct ebt_u_target *next; }; + +struct ebt_icmp_names { + const char *name; + uint8_t type; + uint8_t code_min, code_max; +}; + + + /* libebtc.c */ extern struct ebt_u_table *ebt_tables; @@ -300,11 +309,17 @@ void ebt_print_mac_and_mask(const unsigned char *mac, const unsigned char *mask) int ebt_get_mac_and_mask(const char *from, unsigned char *to, unsigned char *mask); void ebt_parse_ip_address(char *address, uint32_t *addr, uint32_t *msk); char *ebt_mask_to_dotted(uint32_t mask); -void ebt_parse_ip6_address(char *address, struct in6_addr *addr, +void ebt_parse_ip6_address(char *address, struct in6_addr *addr, struct in6_addr *msk); char *ebt_ip6_to_numeric(const struct in6_addr *addrp); char *ebt_ip6_mask_to_string(const struct in6_addr *msk); +int ebt_parse_icmp(const struct ebt_icmp_names *icmp_codes, size_t n_codes, + const char *icmptype, uint8_t type[], uint8_t code[]); +void ebt_print_icmp_type(const struct ebt_icmp_names *icmp_codes, + size_t n_codes, uint8_t *type, uint8_t *code); +void ebt_print_icmp_types(const struct ebt_icmp_names *icmp_codes, + size_t n_codes); int do_command(int argc, char *argv[], int exec_style, struct ebt_u_replace *replace_); -- cgit v1.2.3