diff options
author | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2001-06-25 00:02:56 +0000 |
---|---|---|
committer | Daniel Hartmeier <dhartmei@cvs.openbsd.org> | 2001-06-25 00:02:56 +0000 |
commit | 3f538dc72c8ae7e4a261f8bf2d4becf66e88517d (patch) | |
tree | b262cb9e8d525198deef3e9ee18bfee7ff5440dd /sys/net/pf.c | |
parent | 7d83caee1620a10da905e3db3b57be77a510deba (diff) |
use only ioctl return values found in errno.h
Diffstat (limited to 'sys/net/pf.c')
-rw-r--r-- | sys/net/pf.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 72e02cb9fa3..edc7ad4f72c 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.17 2001/06/24 23:56:32 itojun Exp $ */ +/* $OpenBSD: pf.c,v 1.18 2001/06/25 00:02:54 dhartmei Exp $ */ /* * Copyright (c) 2001, Daniel Hartmeier @@ -518,13 +518,13 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) if ((cmd != DIOCSTART) && (cmd != DIOCSTOP) && (cmd != DIOCCLRSTATES)) { ub = (struct pfioc *)addr; if (ub == NULL) - return ERROR_INVALID_PARAMETERS; + return EINVAL; kb = malloc(ub->size, M_DEVBUF, M_NOWAIT); if (kb == NULL) - return ERROR_MALLOC; + return ENOMEM; if (copyin(ub->buffer, kb, ub->size)) { free(kb, M_DEVBUF); - return ERROR_INVALID_PARAMETERS; + return EIO; } } @@ -540,7 +540,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) case DIOCSTART: if (status.running) - error = ERROR_ALREADY_RUNNING; + error = EINVAL; else { u_int32_t states = status.states; bzero(&status, sizeof(struct status)); @@ -553,7 +553,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) case DIOCSTOP: if (!status.running) - error = ERROR_NOT_RUNNING; + error = EINVAL; else { status.running = 0; printf("packetfilter: stopped\n"); @@ -573,7 +573,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) rule = pool_get(&pf_rule_pl, PR_NOWAIT); if (rule == NULL) { - error = ERROR_MALLOC; + error = ENOMEM; goto done; } bcopy(rules + n, rule, sizeof(struct rule)); @@ -582,7 +582,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) rule->ifp = ifunit(rule->ifname); if (rule->ifp == NULL) { pool_put(&pf_rule_pl, rule); - error = ERROR_INVALID_PARAMETERS; + error = EINVAL; goto done; } } @@ -623,14 +623,14 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) nat = pool_get(&pf_nat_pl, PR_NOWAIT); if (nat == NULL) { - error = ERROR_MALLOC; + error = ENOMEM; goto done; } bcopy(nats + n, nat, sizeof(struct nat)); nat->ifp = ifunit(nat->ifname); if (nat->ifp == NULL) { pool_put(&pf_nat_pl, nat); - error = ERROR_INVALID_PARAMETERS; + error = EINVAL; goto done; } nat->next = nathead; @@ -666,14 +666,14 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) rdr = pool_get(&pf_rdr_pl, PR_NOWAIT); if (rdr == NULL) { - error = ERROR_MALLOC; + error = ENOMEM; goto done; } bcopy(rdrs + n, rdr, sizeof(struct rdr)); rdr->ifp = ifunit(rdr->ifname); if (rdr->ifp == NULL) { pool_put(&pf_rdr_pl, rdr); - error = ERROR_INVALID_PARAMETERS; + error = EINVAL; goto done; } rdr->next = rdrhead; @@ -728,7 +728,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) char *ifname = (char *)kb; struct ifnet *ifp = ifunit(ifname); if (ifp == NULL) - error = ERROR_INVALID_PARAMETERS; + error = EINVAL; else status_ifp = ifp; break; @@ -749,7 +749,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } default: - error = ERROR_INVALID_OP; + error = ENODEV; break; } @@ -757,7 +757,7 @@ done: splx(s); if (kb != NULL) { if (copyout(kb, ub->buffer, ub->size)) - error = ERROR_INVALID_PARAMETERS; + error = EIO; free(kb, M_DEVBUF); } return error; |