From 3fd6b24ace319b139ec3c4e3031a5f05d21e304e Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 15 Jun 2010 13:30:55 +0200 Subject: ipset 5 in an almost ready state - milestone 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 --- src/errcode.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/errcode.c') 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 */ #include /* strerror */ +#include /* D() */ #include /* ipset_data_get */ #include /* ipset_err */ #include /* struct ipset_type */ @@ -15,6 +16,7 @@ #include /* prototypes */ #include /* bitmap specific errcodes */ #include /* hash specific errcodes */ +#include /* 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; } } -- cgit v1.2.3