fix handling of sets
This commit is contained in:
parent
6429067819
commit
c751221af4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204717
@ -1625,13 +1625,21 @@ ipfw_sets_handler(char *av[])
|
|||||||
if (av[0] == NULL)
|
if (av[0] == NULL)
|
||||||
errx(EX_USAGE, "set needs command");
|
errx(EX_USAGE, "set needs command");
|
||||||
if (_substrcmp(*av, "show") == 0) {
|
if (_substrcmp(*av, "show") == 0) {
|
||||||
void *data;
|
void *data = NULL;
|
||||||
char const *msg;
|
char const *msg;
|
||||||
|
int nalloc;
|
||||||
|
|
||||||
nbytes = sizeof(struct ip_fw);
|
nalloc = nbytes = sizeof(struct ip_fw);
|
||||||
|
while (nbytes >= nalloc) {
|
||||||
|
if (data)
|
||||||
|
free(data);
|
||||||
|
nalloc = nalloc * 2 + 200;
|
||||||
|
nbytes = nalloc;
|
||||||
data = safe_calloc(1, nbytes);
|
data = safe_calloc(1, nbytes);
|
||||||
if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0)
|
if (do_cmd(IP_FW_GET, data, (uintptr_t)&nbytes) < 0)
|
||||||
err(EX_OSERR, "getsockopt(IP_FW_GET)");
|
err(EX_OSERR, "getsockopt(IP_FW_GET)");
|
||||||
|
}
|
||||||
|
|
||||||
bcopy(&((struct ip_fw *)data)->next_rule,
|
bcopy(&((struct ip_fw *)data)->next_rule,
|
||||||
&set_disable, sizeof(set_disable));
|
&set_disable, sizeof(set_disable));
|
||||||
|
|
||||||
@ -1661,7 +1669,7 @@ ipfw_sets_handler(char *av[])
|
|||||||
i = do_cmd(IP_FW_DEL, masks, sizeof(uint32_t));
|
i = do_cmd(IP_FW_DEL, masks, sizeof(uint32_t));
|
||||||
} else if (_substrcmp(*av, "move") == 0) {
|
} else if (_substrcmp(*av, "move") == 0) {
|
||||||
av++;
|
av++;
|
||||||
if (!av[0] && _substrcmp(*av, "rule") == 0) {
|
if (av[0] && _substrcmp(*av, "rule") == 0) {
|
||||||
cmd = 2;
|
cmd = 2;
|
||||||
av++;
|
av++;
|
||||||
} else
|
} else
|
||||||
@ -1685,7 +1693,7 @@ ipfw_sets_handler(char *av[])
|
|||||||
av++;
|
av++;
|
||||||
masks[0] = masks[1] = 0;
|
masks[0] = masks[1] = 0;
|
||||||
|
|
||||||
while (!av[0]) {
|
while (av[0]) {
|
||||||
if (isdigit(**av)) {
|
if (isdigit(**av)) {
|
||||||
i = atoi(*av);
|
i = atoi(*av);
|
||||||
if (i < 0 || i > RESVD_SET)
|
if (i < 0 || i > RESVD_SET)
|
||||||
|
Loading…
Reference in New Issue
Block a user