diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-22 10:49:41 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-22 10:49:41 +0200 |
commit | 020936c8c3375e1efe44a3087c891a4b2cbfe044 (patch) | |
tree | a94751e6f1f11bcf118129c343d1942bbf53e808 /kernel/ip_set_list_set.c | |
parent | 97a12ba3f184a76c406eb5622ec21a4d4d6fc8bf (diff) |
ipset 5: last new feature addedv5.0-pre3
- the hash types can now store protocol together port, not only port
- lots of fixes everywhere: parser, error reporting, manpage
The last bits on the todo list before announcing ipset 5:
- recheck all the error messages
- add possibly more tests
- polish manpage
Diffstat (limited to 'kernel/ip_set_list_set.c')
-rw-r--r-- | kernel/ip_set_list_set.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/kernel/ip_set_list_set.c b/kernel/ip_set_list_set.c index ce6c4d1..94c5702 100644 --- a/kernel/ip_set_list_set.c +++ b/kernel/ip_set_list_set.c @@ -119,6 +119,7 @@ list_set_adt_policy[IPSET_ATTR_ADT_MAX+1] __read_mostly = { [IPSET_ATTR_NAMEREF] = { .type = NLA_STRING, .len = IPSET_MAXNAMELEN }, [IPSET_ATTR_TIMEOUT] = { .type = NLA_U32 }, + [IPSET_ATTR_LINENO] = { .type = NLA_U32 }, [IPSET_ATTR_CADT_FLAGS] = { .type = NLA_U32 }, }; @@ -210,8 +211,7 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len, { struct list_set *map = set->data; struct nlattr *tb[IPSET_ATTR_ADT_MAX]; - bool eexist = flags & IPSET_FLAG_EXIST, - with_timeout = with_timeout(map->timeout); + bool with_timeout = with_timeout(map->timeout); int before = 0; u32 timeout = map->timeout; ip_set_id_t id, refid = IPSET_INVALID_ID; @@ -224,6 +224,9 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len, list_set_adt_policy)) return -IPSET_ERR_PROTOCOL; + if (tb[IPSET_ATTR_LINENO]) + *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); + if (tb[IPSET_ATTR_NAME]) { id = ip_set_get_byname(nla_data(tb[IPSET_ATTR_NAME]), &s); if (id == IPSET_INVALID_ID) @@ -334,12 +337,7 @@ finish: if (adt != IPSET_ADD || ret) ip_set_put_byindex(id); - if (ret && !(ret == -IPSET_ERR_EXIST && eexist)) { - if (tb[IPSET_ATTR_LINENO]) - *lineno = nla_get_u32(tb[IPSET_ATTR_LINENO]); - return ret; - } - return ret; + return ip_set_eexist(ret, flags) ? 0 : ret; } static void @@ -565,7 +563,7 @@ list_set_create(struct ip_set *set, struct nlattr *head, int len, static struct ip_set_type list_set_type = { .name = "list:set", .protocol = IPSET_PROTOCOL, - .features = IPSET_TYPE_NAME, + .features = IPSET_TYPE_NAME | IPSET_DUMP_LAST, .dimension = IPSET_DIM_ONE, .family = AF_UNSPEC, .revision = 0, |