From afad78e259c0c81868064e2749cf19dba748fb94 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Fri, 18 Aug 2006 22:36:05 +0000 Subject: [PATCH] comply with style police Submitted by: ru MFC after: 1 month --- sbin/ipfw/ipfw.8 | 14 +++++++++----- sbin/ipfw/ipfw2.c | 23 ++++++++++------------- sys/netinet/ip_fw.h | 1 - sys/netinet/ip_fw2.c | 13 ++++++++----- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 63215897b9bd..9a746a013e10 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -689,8 +689,8 @@ Change the next-hop on matching packets to .Ar ipaddr , which can be an IP address or a host name. The next hop can also be supplied by the last table -looked up for the packet by using the -.Em tablearg +looked up for the packet by using the +.Cm tablearg keyword instead of an explicit address. The search terminates if this rule matches. .Pp @@ -1594,8 +1594,10 @@ action parameters: rule options: .Cm limit, tagged. .Pp -When used with 'fwd' it is possible to supply table entries with values -that are in the form of IP addresses or hostnames. +When used with +.Cm fwd +it is possible to supply table entries with values +that are in the form of IP addresses or hostnames. See the .Sx EXAMPLES Section for example usage of tables and the tablearg keyword. @@ -2388,7 +2390,9 @@ Then we classify traffic using a single rule: .Dl "..." .Dl "ipfw pipe tablearg ip from table(1) to any" .Pp -Using the fwd action, the table entries may include hostnames and IP addresses. +Using the +.Cn fwd +action, the table entries may include hostnames and IP addresses. .Pp .Dl "ipfw table 1 add 192.168.2.0/24 10.23.2.1" .Dl "ipfw table 1 add 192.168.0.0/27 router1.dmz" diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a486fbe25104..a461f766577e 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -4034,11 +4034,10 @@ add(int ac, char *av[]) "illegal forwarding port ``%s''", s); p->sa.sin_port = (u_short)i; } - if (_substrcmp(*av, "tablearg") == 0) { - p->sa.sin_addr.s_addr = INADDR_ANY; /* htonl not needed */ - } else { + if (_substrcmp(*av, "tablearg") == 0) + p->sa.sin_addr.s_addr = INADDR_ANY; + else lookup_host(*av, &(p->sa.sin_addr)); - } ac--; av++; break; } @@ -4998,23 +4997,21 @@ table_handler(int ac, char *av[]) err(EX_OSERR, "getsockopt(IP_FW_TABLE_LIST)"); for (a = 0; a < tbl->cnt; a++) { /* Heuristic to print it the right way */ - /* valuse < 64k are printed as numbers */ + /* values < 64k are printed as numbers */ unsigned int tval; tval = tbl->ent[a].value; if (tval > 0xffff) { char tbuf[128]; - strncpy(tbuf, - inet_ntoa(*(struct in_addr *) - &tbl->ent[a].addr), 127); + strncpy(tbuf, inet_ntoa(*(struct in_addr *) + &tbl->ent[a].addr), 127); /* inet_ntoa expects host order */ tval = htonl(tval); - printf("%s/%u %s\n", - tbuf, tbl->ent[a].masklen, - inet_ntoa(*(struct in_addr *)&tval)); + printf("%s/%u %s\n", tbuf, tbl->ent[a].masklen, + inet_ntoa(*(struct in_addr *)&tval)); } else { printf("%s/%u %u\n", - inet_ntoa(*(struct in_addr *)&tbl->ent[a].addr), - tbl->ent[a].masklen, tbl->ent[a].value); + inet_ntoa(*(struct in_addr *)&tbl->ent[a].addr), + tbl->ent[a].masklen, tbl->ent[a].value); } } } else diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index 086ce8eef31e..1f50e56737e7 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -522,7 +522,6 @@ struct ip_fw_args { struct _ip6dn_args dummypar; /* dummynet->ip6_output */ struct sockaddr_in hopstore; /* store here if cannot use a pointer */ - }; /* diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c index 47fc7f6988fb..e7d1405ca238 100644 --- a/sys/netinet/ip_fw2.c +++ b/sys/netinet/ip_fw2.c @@ -2791,7 +2791,8 @@ do { \ case O_LOG: if (fw_verbose) - ipfw_log(f, hlen, args, m, oif, offset, tablearg); + ipfw_log(f, hlen, args, m, + oif, offset, tablearg); match = 1; break; @@ -3156,15 +3157,17 @@ do { \ if (sa->sin_addr.s_addr == INADDR_ANY) { bcopy(sa, &args->hopstore, sizeof(*sa)); - args->hopstore.sin_addr.s_addr = htonl(tablearg); - args->next_hop = &args->hopstore; + args->hopstore.sin_addr.s_addr = + htonl(tablearg); + args->next_hop = + &args->hopstore; } else { args->next_hop = sa; } } retval = IP_FW_PASS; - } - goto done; + } + goto done; case O_NETGRAPH: case O_NGTEE: