From 9895a8eaa4b29c33472a9ad34df0356c8d83cac2 Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Sat, 11 Jan 2003 10:14:24 +0000 Subject: cosmetic changes --- extensions/ebt_arp.c | 6 +++--- extensions/ebt_ip.c | 30 ++++++++++++++++-------------- extensions/ebt_log.c | 24 +++++++++++++----------- extensions/ebt_mark_m.c | 2 +- 4 files changed, 33 insertions(+), 29 deletions(-) (limited to 'extensions') diff --git a/extensions/ebt_arp.c b/extensions/ebt_arp.c index 7325270..6298d5e 100644 --- a/extensions/ebt_arp.c +++ b/extensions/ebt_arp.c @@ -23,7 +23,7 @@ static struct option opts[] = }; #define NUMOPCODES 9 -// a few names +/* a few names */ static char *opcodes[] = { "Request", @@ -64,7 +64,7 @@ static void init(struct ebt_entry_match *match) arpinfo->bitmask = 0; } -// defined in ebt_ip.c +/* defined in ebt_ip.c */ void parse_ip_address(char *address, uint32_t *addr, uint32_t *msk); #define OPT_OPCODE 0x01 @@ -188,7 +188,7 @@ static void final_check(const struct ebt_u_entry *entry, "specified as ARP or RARP"); } -// defined in the ebt_ip.c +/* defined in the ebt_ip.c */ char *mask_to_dotted(uint32_t mask); static void print(const struct ebt_u_entry *entry, diff --git a/extensions/ebt_ip.c b/extensions/ebt_ip.c index 916d7af..36cb3c9 100644 --- a/extensions/ebt_ip.c +++ b/extensions/ebt_ip.c @@ -2,7 +2,7 @@ * ebtables ebt_ip: IP extension module for userspace * * Authors: - * Bart De Schuymer + * Bart De Schuymer * * Changes: * added ip-sport and ip-dport; parsing of port arguments is @@ -36,7 +36,7 @@ #define IP_SOURCE '1' #define IP_DEST '2' -#define IP_myTOS '3' // include/bits/in.h seems to already define IP_TOS +#define IP_myTOS '3' /* include/bits/in.h seems to already define IP_TOS */ #define IP_PROTO '4' #define IP_SPORT '5' #define IP_DPORT '6' @@ -57,9 +57,7 @@ static struct option opts[] = { 0 } }; -struct protoent *pe; - -// put the ip string into 4 bytes +/* put the ip string into 4 bytes */ static int undot_ip(char *ip, unsigned char *ip2) { char *p, *q, *end; @@ -89,7 +87,7 @@ static int undot_ip(char *ip, unsigned char *ip2) return 0; } -// put the mask into 4 bytes +/* put the mask into 4 bytes */ static int ip_mask(char *mask, unsigned char *mask2) { char *end; @@ -97,7 +95,7 @@ static int ip_mask(char *mask, unsigned char *mask2) uint32_t mask22; if (undot_ip(mask, mask2)) { - // not the /a.b.c.e format, maybe the /x format + /* not the /a.b.c.e format, maybe the /x format */ bits = strtol(mask, &end, 10); if (*end != '\0' || bits > 32 || bits < 0) return -1; @@ -112,12 +110,12 @@ static int ip_mask(char *mask, unsigned char *mask2) return 0; } -// set the ip mask and ip address +/* set the ip mask and ip address */ void parse_ip_address(char *address, uint32_t *addr, uint32_t *msk) { char *p; - // first the mask + /* first the mask */ if ((p = strrchr(address, '/')) != NULL) { *p = '\0'; if (ip_mask(p + 1, (unsigned char *)msk)) @@ -131,7 +129,7 @@ void parse_ip_address(char *address, uint32_t *addr, uint32_t *msk) *addr = *addr & *msk; } -// transform the ip mask into a string ready for output +/* transform the ip mask into a string ready for output */ char *mask_to_dotted(uint32_t mask) { int i; @@ -140,14 +138,14 @@ char *mask_to_dotted(uint32_t mask) maskaddr = ntohl(mask); - // don't print /32 + /* don't print /32 */ if (mask == 0xFFFFFFFFL) { *buf = '\0'; return buf; } i = 32; - bits = 0xFFFFFFFEL; // case 0xFFFFFFFF has just been dealt with + bits = 0xFFFFFFFEL; /* case 0xFFFFFFFF has just been dealt with */ while (--i >= 0 && maskaddr != bits) bits <<= 1; @@ -156,7 +154,7 @@ char *mask_to_dotted(uint32_t mask) else if (!i) *buf = '\0'; else - // mask was not a decent combination of 1's and 0's + /* mask was not a decent combination of 1's and 0's */ sprintf(buf, "/%d.%d.%d.%d", ((unsigned char *)&mask)[0], ((unsigned char *)&mask)[1], ((unsigned char *)&mask)[2], ((unsigned char *)&mask)[3]); @@ -164,7 +162,7 @@ char *mask_to_dotted(uint32_t mask) return buf; } -// transform a protocol and service name into a port number +/* transform a protocol and service name into a port number */ static uint16_t parse_port(const char *protocol, const char *name) { struct servent *service; @@ -317,6 +315,8 @@ static int parse(int c, char **argv, int argc, const struct ebt_u_entry *entry, print_error("Missing IP protocol argument"); (unsigned char) i = strtoul(argv[optind - 1], &end, 10); if (*end != '\0') { + struct protoent *pe; + pe = getprotobyname(argv[optind - 1]); if (pe == NULL) print_error @@ -384,6 +384,8 @@ static void print(const struct ebt_u_entry *entry, printf("0x%02X ", ipinfo->tos); } if (ipinfo->bitmask & EBT_IP_PROTO) { + struct protoent *pe; + printf("--ip-proto "); if (ipinfo->invflags & EBT_IP_PROTO) printf("! "); diff --git a/extensions/ebt_log.c b/extensions/ebt_log.c index c9461b5..3c2409f 100644 --- a/extensions/ebt_log.c +++ b/extensions/ebt_log.c @@ -5,16 +5,18 @@ #include "../include/ebtables_u.h" #include -// copied from syslog.h -// used for the LOG target -#define LOG_EMERG 0 // system is unusable -#define LOG_ALERT 1 // action must be taken immediately -#define LOG_CRIT 2 // critical conditions -#define LOG_ERR 3 // error conditions -#define LOG_WARNING 4 // warning conditions -#define LOG_NOTICE 5 // normal but significant condition -#define LOG_INFO 6 // informational -#define LOG_DEBUG 7 // debug-level messages +/* + * copied from syslog.h + * used for the LOG target + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ #define LOG_DEFAULT_LEVEL LOG_INFO @@ -41,7 +43,7 @@ static int name_to_loglevel(char* arg) for (i = 0; i < 8; i++) if (!strcmp(arg, eight_priority[i].c_name)) return eight_priority[i].c_val; - // return bad loglevel + /* return bad loglevel */ return 9; } diff --git a/extensions/ebt_mark_m.c b/extensions/ebt_mark_m.c index 14b2540..4fdc41d 100644 --- a/extensions/ebt_mark_m.c +++ b/extensions/ebt_mark_m.c @@ -9,7 +9,7 @@ static struct option opts[] = { - { "mark" , required_argument, 0, MARK }, + { "mark", required_argument, 0, MARK }, { 0 } }; -- cgit v1.2.3