From 510c9ce916464d6958c4394169fb5e885f4d3a06 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Mon, 23 Jan 2006 18:50:54 +0000 Subject: remove unsigned char * warning with gcc 4.0 --- communication.c | 4 ++-- extensions/ebt_among.c | 2 +- extensions/ebt_arp.c | 4 ++-- extensions/ebt_log.c | 4 ++-- extensions/ebt_stp.c | 14 +++++++++----- include/ebtables_u.h | 6 +++--- useful_functions.c | 9 +++++---- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/communication.c b/communication.c index dcfd8dc..bd7aa65 100644 --- a/communication.c +++ b/communication.c @@ -441,7 +441,7 @@ ebt_translate_watcher(struct ebt_entry_watcher *w, } static int -ebt_translate_entry(struct ebt_entry *e, unsigned int *hook, int *n, int *cnt, +ebt_translate_entry(struct ebt_entry *e, int *hook, int *n, int *cnt, int *totalcnt, struct ebt_u_entry **u_e, struct ebt_u_replace *u_repl, unsigned int valid_hooks, char *base, struct ebt_cntchanges **cc) { @@ -540,7 +540,7 @@ ebt_translate_entry(struct ebt_entry *e, unsigned int *hook, int *n, int *cnt, /* Initialize all chain headers */ static int -ebt_translate_chains(struct ebt_entry *e, unsigned int *hook, +ebt_translate_chains(struct ebt_entry *e, int *hook, struct ebt_u_replace *u_repl, unsigned int valid_hooks) { int i; diff --git a/extensions/ebt_among.c b/extensions/ebt_among.c index 65ce481..7e01b49 100644 --- a/extensions/ebt_among.c +++ b/extensions/ebt_among.c @@ -375,7 +375,7 @@ static void wormhash_printout(const struct ebt_mac_wormhash *wh) const struct ebt_mac_wormhash_tuple *p; p = (const struct ebt_mac_wormhash_tuple *)(&wh->pool[i]); - ebt_print_mac(((const char *) &p->cmp[0]) + 2); + ebt_print_mac(((const unsigned char *) &p->cmp[0]) + 2); if (p->ip) { ip = (unsigned char *) &p->ip; printf("=%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); diff --git a/extensions/ebt_arp.c b/extensions/ebt_arp.c index 9eed645..ffe6781 100644 --- a/extensions/ebt_arp.c +++ b/extensions/ebt_arp.c @@ -96,8 +96,8 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, char *end; uint32_t *addr; uint32_t *mask; - char *maddr; - char *mmask; + unsigned char *maddr; + unsigned char *mmask; switch (c) { case ARP_OPCODE: diff --git a/extensions/ebt_log.c b/extensions/ebt_log.c index 7429479..575d12e 100644 --- a/extensions/ebt_log.c +++ b/extensions/ebt_log.c @@ -118,7 +118,7 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, ebt_print_error2("Prefix too long"); if (strchr(optarg, '\"')) ebt_print_error2("Use of \\\" is not allowed in the prefix"); - strcpy(loginfo->prefix, optarg); + strcpy((char *)loginfo->prefix, (char *)optarg); break; case LOG_LEVEL: @@ -188,7 +188,7 @@ static int compare(const struct ebt_entry_watcher *w1, return 0; if (loginfo1->bitmask != loginfo2->bitmask) return 0; - return !strcmp(loginfo1->prefix, loginfo2->prefix); + return !strcmp((char *)loginfo1->prefix, (char *)loginfo2->prefix); } static struct ebt_u_watcher log_watcher = diff --git a/extensions/ebt_stp.c b/extensions/ebt_stp.c index 307131f..08a48fb 100644 --- a/extensions/ebt_stp.c +++ b/extensions/ebt_stp.c @@ -236,12 +236,14 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, break; case EBT_STP_ROOTADDR: if (ebt_get_mac_and_mask(argv[optind-1], - stpinfo->config.root_addr, stpinfo->config.root_addrmsk)) + (unsigned char *)stpinfo->config.root_addr, + (unsigned char *)stpinfo->config.root_addrmsk)) ebt_print_error("Bad --stp-root-addr address"); break; case EBT_STP_SENDERADDR: - if (ebt_get_mac_and_mask(argv[optind-1], stpinfo->config.sender_addr, - stpinfo->config.sender_addrmsk)) + if (ebt_get_mac_and_mask(argv[optind-1], + (unsigned char *)stpinfo->config.sender_addr, + (unsigned char *)stpinfo->config.sender_addrmsk)) ebt_print_error("Bad --stp-sender-addr address"); break; default: @@ -293,13 +295,15 @@ static void print(const struct ebt_u_entry *entry, } else if (EBT_STP_ROOTPRIO == (1 << i)) print_range(c->root_priol, c->root_priou); else if (EBT_STP_ROOTADDR == (1 << i)) - ebt_print_mac_and_mask(c->root_addr, c->root_addrmsk); + ebt_print_mac_and_mask((unsigned char *)c->root_addr, + (unsigned char*)c->root_addrmsk); else if (EBT_STP_ROOTCOST == (1 << i)) print_range(c->root_costl, c->root_costu); else if (EBT_STP_SENDERPRIO == (1 << i)) print_range(c->sender_priol, c->sender_priou); else if (EBT_STP_SENDERADDR == (1 << i)) - ebt_print_mac_and_mask(c->sender_addr, c->sender_addrmsk); + ebt_print_mac_and_mask((unsigned char *)c->sender_addr, + (unsigned char *)c->sender_addrmsk); else if (EBT_STP_PORT == (1 << i)) print_range(c->portl, c->portu); else if (EBT_STP_MSGAGE == (1 << i)) diff --git a/include/ebtables_u.h b/include/ebtables_u.h index 25f3fbb..f1f1dfd 100644 --- a/include/ebtables_u.h +++ b/include/ebtables_u.h @@ -292,9 +292,9 @@ extern int ebt_invert; void ebt_check_option(unsigned int *flags, unsigned int mask); #define ebt_check_inverse(arg) _ebt_check_inverse(arg, argc, argv) int _ebt_check_inverse(const char option[], int argc, char **argv); -void ebt_print_mac(const char *mac); -void ebt_print_mac_and_mask(const char *mac, const char *mask); -int ebt_get_mac_and_mask(char *from, char *to, char *mask); +void ebt_print_mac(const unsigned char *mac); +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); diff --git a/useful_functions.c b/useful_functions.c index 0cd3d51..131851a 100644 --- a/useful_functions.c +++ b/useful_functions.c @@ -44,18 +44,18 @@ const unsigned char msk_type_bridge_group[ETH_ALEN] = {255,255,255,255,255,255}; * then always has the same length */ int ebt_printstyle_mac; -void ebt_print_mac(const char *mac) +void ebt_print_mac(const unsigned char *mac) { if (ebt_printstyle_mac == 2) { int j; for (j = 0; j < ETH_ALEN; j++) - printf("%02x%s", (unsigned char)mac[j], + printf("%02x%s", mac[j], (j==ETH_ALEN-1) ? "" : ":"); } else printf("%s", ether_ntoa((struct ether_addr *) mac)); } -void ebt_print_mac_and_mask(const char *mac, const char *mask) +void ebt_print_mac_and_mask(const unsigned char *mac, const unsigned char *mask) { char hlpmsk[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; @@ -91,7 +91,8 @@ struct ethertypeent *parseethertypebynumber(int type) } /* Put the mac address into 6 (ETH_ALEN) bytes returns 0 on success. */ -int ebt_get_mac_and_mask(char *from, char *to, char *mask) +int ebt_get_mac_and_mask(const char *from, unsigned char *to, + unsigned char *mask) { char *p; int i; -- cgit v1.2.3