diff options
author | luigi <luigi@FreeBSD.org> | 2001-11-04 23:19:46 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2001-11-04 23:19:46 +0000 |
commit | 707bb64e499d7477ce4456023cafe03c817b7877 (patch) | |
tree | 1f132ab0a90d0aea856deeded383a5f25fd1cb22 /sbin | |
parent | 1865b7516d61e2f1b73139bf9252dd7bc454e873 (diff) | |
download | FreeBSD-src-707bb64e499d7477ce4456023cafe03c817b7877.zip FreeBSD-src-707bb64e499d7477ce4456023cafe03c817b7877.tar.gz |
sync the code with the one in stable (mostly formatting changes).
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipfw/ipfw.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/sbin/ipfw/ipfw.c b/sbin/ipfw/ipfw.c index 99f7061..b6a21c9 100644 --- a/sbin/ipfw/ipfw.c +++ b/sbin/ipfw/ipfw.c @@ -400,7 +400,7 @@ show_ipfw(struct ip_fw *chain) for ( ; p->s != NULL ; p++) if (chain->limit_mask & p->x) printf(" %s", p->s); - printf(" %d", chain->conn_limit); + printf(" %d", chain->conn_limit); break ; } } @@ -1997,38 +1997,39 @@ add(int ac, char *av[]) rule.fw_flg |= IP_FW_F_IN; av++; ac--; } else if (!strncmp(*av,"limit",strlen(*av))) { - /* keep-state rules used to limit number of connections. */ - rule.fw_flg |= IP_FW_F_KEEP_S; - rule.dyn_type = DYN_LIMIT ; - rule.limit_mask = 0 ; - av++; ac--; - for (; ac >1 ;) { - struct _s_x *p = limit_masks; - for ( ; p->s != NULL ; p++) - if (!strncmp(*av, p->s, strlen(*av))) { - rule.limit_mask |= p->x ; - av++; ac-- ; + /* dyn. rule used to limit number of connections. */ + rule.fw_flg |= IP_FW_F_KEEP_S; + rule.dyn_type = DYN_LIMIT ; + rule.limit_mask = 0 ; + av++; ac--; + for (; ac >1 ;) { + struct _s_x *p = limit_masks; + for ( ; p->s != NULL ; p++) + if (!strncmp(*av, p->s, strlen(*av))) { + rule.limit_mask |= p->x ; + av++; ac-- ; + break ; + } + if (p->s == NULL) break ; - } - if (p->s == NULL) - break ; - } - if (rule.limit_mask == 0) - errx(EX_USAGE, "missing limit mask"); - if (ac < 1) - errx(EX_USAGE, "limit needs mask and # of connections"); - rule.conn_limit = atoi(*av); - if (rule.conn_limit == 0) - errx(EX_USAGE, "limit: limit must be >0"); - av++; ac--; + } + if (ac < 1) + errx(EX_USAGE, + "limit needs mask and # of connections"); + rule.conn_limit = atoi(*av); + if (rule.conn_limit == 0) + errx(EX_USAGE, "limit: limit must be >0"); + if (rule.limit_mask == 0) + errx(EX_USAGE, "missing limit mask"); + av++; ac--; } else if (!strncmp(*av, "keep-state", strlen(*av))) { u_long type; rule.fw_flg |= IP_FW_F_KEEP_S; av++; ac--; if (ac > 0 && (type = atoi(*av)) != 0) { - rule.dyn_type = type; - av++; ac--; + rule.dyn_type = type; + av++; ac--; } } else if (!strncmp(*av, "bridged", strlen(*av))) { rule.fw_flg |= IP_FW_BRIDGED; |