aboutsummaryrefslogtreecommitdiff
path: root/contrib/pf/pfctl/pfctl_radix.c
diff options
context:
space:
mode:
authorMax Laier <mlaier@FreeBSD.org>2004-06-16 23:26:00 +0000
committerMax Laier <mlaier@FreeBSD.org>2004-06-16 23:26:00 +0000
commitabff3868339c96bb3ce524f66fe7758d3870800a (patch)
tree91591a3c3277d8525d725da18322a0f9ba6078a2 /contrib/pf/pfctl/pfctl_radix.c
parent3178c893b859e7369b8cb4fde370daf272c62eb2 (diff)
downloadsrc-abff3868339c96bb3ce524f66fe7758d3870800a.tar.gz
src-abff3868339c96bb3ce524f66fe7758d3870800a.zip
Import userland of pf 3.5 from OpenBSD (OPENBSD_3_5_BASE).vendor/pf/3.5
Notes
Notes: svn path=/vendor/pf/dist/; revision=130614 svn path=/vendor/pf/3.5/; revision=130616; tag=vendor/pf/3.5
Diffstat (limited to 'contrib/pf/pfctl/pfctl_radix.c')
-rw-r--r--contrib/pf/pfctl/pfctl_radix.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/contrib/pf/pfctl/pfctl_radix.c b/contrib/pf/pfctl/pfctl_radix.c
index 788522c530d9..04fb4872ef6d 100644
--- a/contrib/pf/pfctl/pfctl_radix.c
+++ b/contrib/pf/pfctl/pfctl_radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_radix.c,v 1.21 2003/09/24 09:12:35 cedric Exp $ */
+/* $OpenBSD: pfctl_radix.c,v 1.24 2004/02/10 18:29:30 henning Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -259,7 +259,8 @@ pfr_get_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int *size,
{
struct pfioc_table io;
- if (tbl == NULL || size == NULL || *size < 0 || (*size && addr == NULL)) {
+ if (tbl == NULL || size == NULL || *size < 0 ||
+ (*size && addr == NULL)) {
errno = EINVAL;
return (-1);
}
@@ -281,7 +282,8 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size,
{
struct pfioc_table io;
- if (tbl == NULL || size == NULL || *size < 0 || (*size && addr == NULL)) {
+ if (tbl == NULL || size == NULL || *size < 0 ||
+ (*size && addr == NULL)) {
errno = EINVAL;
return (-1);
}
@@ -454,11 +456,40 @@ pfr_ina_define(struct pfr_table *tbl, struct pfr_addr *addr, int size,
return (0);
}
+/* interface management code */
+
+int
+pfi_get_ifaces(const char *filter, struct pfi_if *buf, int *size, int flags)
+{
+ struct pfioc_iface io;
+
+ if (size == NULL || *size < 0 || (*size && buf == NULL)) {
+ errno = EINVAL;
+ return (-1);
+ }
+ bzero(&io, sizeof io);
+ io.pfiio_flags = flags;
+ if (filter != NULL)
+ if (strlcpy(io.pfiio_name, filter, sizeof(io.pfiio_name)) >=
+ sizeof(io.pfiio_name)) {
+ errno = EINVAL;
+ return (-1);
+ }
+ io.pfiio_buffer = buf;
+ io.pfiio_esize = sizeof(*buf);
+ io.pfiio_size = *size;
+ if (ioctl(dev, DIOCIGETIFACES, &io))
+ return (-1);
+ *size = io.pfiio_size;
+ return (0);
+}
+
/* buffer management code */
size_t buf_esize[PFRB_MAX] = { 0,
sizeof(struct pfr_table), sizeof(struct pfr_tstats),
sizeof(struct pfr_addr), sizeof(struct pfr_astats),
+ sizeof(struct pfi_if), sizeof(struct pfioc_trans_e)
};
/*