diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-15 13:30:55 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-15 13:30:55 +0200 |
commit | 3fd6b24ace319b139ec3c4e3031a5f05d21e304e (patch) | |
tree | e6ac952e95fa44968196149e0172b1ef13e8236f /src/errcode.c | |
parent | 00bcb2b40450eca4c7ad785bf85b12692e8d29af (diff) |
ipset 5 in an almost ready state - milestonev5.0-pre1
Reworked protocol and internal interfaces, missing set types added,
backward compatibility verified, lots of tests added (and thanks to the tests,
bugs fixed), even the manpage is rewritten ;-). Countless changes everywhere...
The missing bits before announcing ipset 5:
- net namespace support
- new iptables/ip6tables extension library
- iptables/ip6tables match and target tests (backward/forward compatibility)
- tests on catching syntax errors
Diffstat (limited to 'src/errcode.c')
-rw-r--r-- | src/errcode.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/errcode.c b/src/errcode.c index 34b87a3..c30ecb6 100644 --- a/src/errcode.c +++ b/src/errcode.c @@ -8,6 +8,7 @@ #include <errno.h> /* errno */ #include <string.h> /* strerror */ +#include <libipset/debug.h> /* D() */ #include <libipset/data.h> /* ipset_data_get */ #include <libipset/session.h> /* ipset_err */ #include <libipset/types.h> /* struct ipset_type */ @@ -15,6 +16,7 @@ #include <libipset/errcode.h> /* prototypes */ #include <libipset/linux_ip_set_bitmap.h> /* bitmap specific errcodes */ #include <libipset/linux_ip_set_hash.h> /* hash specific errcodes */ +#include <libipset/linux_ip_set_list.h> /* list specific errcodes */ /* Core kernel error codes */ static const struct ipset_errcode_table core_errcode_table[] = { @@ -45,6 +47,8 @@ static const struct ipset_errcode_table core_errcode_table[] = { /* RENAME specific error codes */ { IPSET_ERR_EXIST_SETNAME2, IPSET_CMD_RENAME, "Set cannot be renamed: a set with the new name already exists" }, + { IPSET_ERR_REFERENCED, IPSET_CMD_RENAME, + "Set cannot be renamed: it is in use by another system" }, /* SWAP specific error codes */ { IPSET_ERR_EXIST_SETNAME2, IPSET_CMD_SWAP, @@ -101,6 +105,24 @@ static const struct ipset_errcode_table hash_errcode_table[] = { { }, }; +/* List type-specific error codes */ +static const struct ipset_errcode_table list_errcode_table[] = { + /* Generic (CADT) error codes */ + { IPSET_ERR_NAME, 0, + "Set to be added/deleted/tested as element does not exist." }, + { IPSET_ERR_LOOP, 0, + "Sets with list:set type cannot be added to the set." }, + { IPSET_ERR_BEFORE, 0, + "No reference set specified." }, + { IPSET_ERR_NAMEREF, 0, + "The set to which you referred with 'before' or 'after' does not exist." }, + { IPSET_ERR_LIST_FULL, 0, + "The set is full, more elements cannot be added." }, + { IPSET_ERR_REF_EXIST, 0, + "The set to which you referred with 'before' or 'after' is not added to the set." }, + { }, +}; + #define MATCH_TYPENAME(a, b) STRNEQ(a, b, strlen(b)) /** @@ -126,8 +148,10 @@ ipset_errcode(struct ipset_session *session, enum ipset_cmd cmd, int errcode) if (type) { if (MATCH_TYPENAME(type->name, "bitmap:")) table = bitmap_errcode_table; - if (MATCH_TYPENAME(type->name, "hash:")) + else if (MATCH_TYPENAME(type->name, "hash:")) table = hash_errcode_table; + else if (MATCH_TYPENAME(type->name, "list:")) + table = list_errcode_table; } } |