diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-08-01 15:17:46 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2014-08-01 15:17:46 +0000 |
commit | 4c0c07a5521fca479d04726beb4f7c38914461f4 (patch) | |
tree | 1039246d324a5e4fb33337aa1b6f3cc96b2763d2 /sbin/ipfw/ipfw2.c | |
parent | 95c3c1e25f9601f1d9b40ea13f518be8c33c7d0f (diff) | |
download | src-4c0c07a5521fca479d04726beb4f7c38914461f4.tar.gz src-4c0c07a5521fca479d04726beb4f7c38914461f4.zip |
* Permit limiting number of items in table.
Kernel changes:
* Add TEI_FLAGS_DONTADD entry flag to indicate that insert is not possible
* Support given flag in all algorithms
* Add "limit" field to ipfw_xtable_info
* Add actual limiting code into add_table_entry()
Userland changes:
* Add "limit" option as "create" table sub-option. Limit modification
is currently impossible.
* Print human-readable errors in table enry addition/deletion code.
Notes
Notes:
svn path=/projects/ipfw/; revision=269386
Diffstat (limited to 'sbin/ipfw/ipfw2.c')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a31451b5d41c..4595b04f3713 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -580,11 +580,12 @@ do_cmd(int optname, void *optval, uintptr_t optlen) * * Assumes op3 header is already embedded. * Calls setsockopt() with IP_FW3 as kernel-visible opcode. - * Returns 0 on success or -1 otherwise. + * Returns 0 on success or errno otherwise. */ int do_set3(int optname, ip_fw3_opheader *op3, uintptr_t optlen) { + int errno; if (co.test_only) return (0); @@ -596,7 +597,10 @@ do_set3(int optname, ip_fw3_opheader *op3, uintptr_t optlen) op3->opcode = optname; - return (setsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen)); + if (setsockopt(ipfw_socket, IPPROTO_IP, IP_FW3, op3, optlen) != 0) + return (errno); + + return (0); } int |