Jozsef Kadlecsik says: ==================== ipset patches for nf-next - Remove useless memset() calls, nla_parse_nested/nla_parse erase the tb array properly, from Florent Fourcot. - Merge the uadd and udel functions, the code is nicer this way, also from Florent Fourcot. - Add a missing check for the return value of a nla_parse[_deprecated] call, from Aditya Pakki. - Add the last missing check for the return value of nla_parse[_deprecated] call. - Fix error path and release the references properly in set_target_v3_checkentry(). - Fix memory accounting which is reported to userspace for hash types on resize, from Stefano Brivio. - Update my email address to kadlec@netfilter.org. The patch covers all places in the source tree where my kadlec@blackhole.kfki.hu address could be found. ====================
Unified · Split
| @@ -1800,7 +1800,7 @@ S: 2300 Copenhagen S. · 1799 unmodified lines | |||
| 1800 | S: Denmark | 1800 | S: Denmark |
| 1801 | 1801 | ||
| 1802 | N: Jozsef Kadlecsik | 1802 | N: Jozsef Kadlecsik |
| 1803 | E: kadlec@blackhole.kfki.hu | 1803 | E: kadlec@netfilter.org |
| 1804 | P: 1024D/470DB964 4CB3 1A05 713E 9BF7 FAC5 5809 DD8C B7B1 470D B964 | 1804 | P: 1024D/470DB964 4CB3 1A05 713E 9BF7 FAC5 5809 DD8C B7B1 470D B964 |
| 1805 | D: netfilter: TCP window tracking code | 1805 | D: netfilter: TCP window tracking code |
| 1806 | D: netfilter: raw table | 1806 | D: netfilter: raw table |
| @@ -10858,7 +10858,7 @@ F: drivers/net/ethernet/neterion/ · 10857 unmodified lines | |||
| 10858 | 10858 | ||
| 10859 | NETFILTER | 10859 | NETFILTER |
| 10860 | M: Pablo Neira Ayuso <pablo@netfilter.org> | 10860 | M: Pablo Neira Ayuso <pablo@netfilter.org> |
| 10861 | M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 10861 | M: Jozsef Kadlecsik <kadlec@netfilter.org> |
| 10862 | M: Florian Westphal <fw@strlen.de> | 10862 | M: Florian Westphal <fw@strlen.de> |
| 10863 | L: netfilter-devel@vger.kernel.org | 10863 | L: netfilter-devel@vger.kernel.org |
| 10864 | L: coreteam@netfilter.org | 10864 | L: coreteam@netfilter.org |
| @@ -17,7 +17,7 @@ · 16 unmodified lines | |||
| 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in | 17 | * if SELF_TEST is defined. You can use this free for any purpose. It's in |
| 18 | * the public domain. It has no warranty. | 18 | * the public domain. It has no warranty. |
| 19 | * | 19 | * |
| 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) | 20 | * Copyright (C) 2009-2010 Jozsef Kadlecsik (kadlec@netfilter.org) |
| 21 | * | 21 | * |
| 22 | * I've modified Bob's hash to be useful in the Linux kernel, and | 22 | * I've modified Bob's hash to be useful in the Linux kernel, and |
| 23 | * any bugs present are my fault. | 23 | * any bugs present are my fault. |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Martin Josefsson <gandalf@wlug.westbo.se> | 3 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _IP_SET_COUNTER_H | 1 | #ifndef _IP_SET_COUNTER_H |
| 2 | #define _IP_SET_COUNTER_H | 2 | #define _IP_SET_COUNTER_H |
| 3 | 3 | ||
| 4 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _IP_SET_SKBINFO_H | 1 | #ifndef _IP_SET_SKBINFO_H |
| 2 | #define _IP_SET_SKBINFO_H | 2 | #define _IP_SET_SKBINFO_H |
| 3 | 3 | ||
| 4 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef _IP_SET_TIMEOUT_H | 1 | #ifndef _IP_SET_TIMEOUT_H |
| 2 | #define _IP_SET_TIMEOUT_H | 2 | #define _IP_SET_TIMEOUT_H |
| 3 | 3 | ||
| 4 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 2 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 3 | * Patrick Schaaf <bof@bof.de> | 3 | * Patrick Schaaf <bof@bof.de> |
| 4 | * Martin Josefsson <gandalf@wlug.westbo.se> | 4 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 5 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * 'raw' table, which is the very first hooked in at PRE_ROUTING and LOCAL_OUT . | 3 | * 'raw' table, which is the very first hooked in at PRE_ROUTING and LOCAL_OUT . |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 6 | */ | 6 | */ |
| 7 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 7 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * This source code is licensed under General Public License version 2. | 7 | * This source code is licensed under General Public License version 2. |
| 8 | * | 8 | * |
| 9 | * Based on the 'brute force' H.323 NAT module by | 9 | * Based on the 'brute force' H.323 NAT module by |
| 10 | * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 10 | * Jozsef Kadlecsik <kadlec@netfilter.org> |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * IPv6 raw table, a port of the IPv4 raw table to IPv6 | 3 | * IPv6 raw table, a port of the IPv4 raw table to IPv6 |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 5 | * Copyright (C) 2003 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 6 | */ | 6 | */ |
| 7 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 7 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 3 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as | 6 | * it under the terms of the GNU General Public License version 2 as |
| @@ -31,7 +31,7 @@ · 24 unmodified lines | |||
| 31 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ | 31 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ |
| 32 | 32 | ||
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 35 | IP_SET_MODULE_DESC("bitmap:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 35 | IP_SET_MODULE_DESC("bitmap:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 36 | MODULE_ALIAS("ip_set_bitmap:ip"); | 36 | MODULE_ALIAS("ip_set_bitmap:ip"); |
| 37 | 37 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Martin Josefsson <gandalf@wlug.westbo.se> | 3 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -31,7 +31,7 @@ · 23 unmodified lines | |||
| 31 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ | 31 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ |
| 32 | 32 | ||
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 35 | IP_SET_MODULE_DESC("bitmap:ip,mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 35 | IP_SET_MODULE_DESC("bitmap:ip,mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 36 | MODULE_ALIAS("ip_set_bitmap:ip,mac"); | 36 | MODULE_ALIAS("ip_set_bitmap:ip,mac"); |
| 37 | 37 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -26,7 +26,7 @@ · 21 unmodified lines | |||
| 26 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ | 26 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ |
| 27 | 27 | ||
| 28 | MODULE_LICENSE("GPL"); | 28 | MODULE_LICENSE("GPL"); |
| 29 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 29 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 30 | IP_SET_MODULE_DESC("bitmap:port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 30 | IP_SET_MODULE_DESC("bitmap:port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 31 | MODULE_ALIAS("ip_set_bitmap:port"); | 31 | MODULE_ALIAS("ip_set_bitmap:port"); |
| 32 | 32 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 3 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 4 | * | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as | 6 | * it under the terms of the GNU General Public License version 2 as |
| @@ -51,7 +51,7 @@ static unsigned int max_sets; · 44 unmodified lines | |||
| 51 | module_param(max_sets, int, 0600); | 51 | module_param(max_sets, int, 0600); |
| 52 | MODULE_PARM_DESC(max_sets, "maximal number of sets"); | 52 | MODULE_PARM_DESC(max_sets, "maximal number of sets"); |
| 53 | MODULE_LICENSE("GPL"); | 53 | MODULE_LICENSE("GPL"); |
| 54 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 54 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 55 | MODULE_DESCRIPTION("core IP set support"); | 55 | MODULE_DESCRIPTION("core IP set support"); |
| 56 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET); | 56 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET); |
| 57 | 57 | ||
| @@ -1293,11 +1293,13 @@ dump_init(struct netlink_callback *cb, struct ip_set_net *inst) · 1235 unmodified lines | |||
| 1293 | struct nlattr *attr = (void *)nlh + min_len; | 1293 | struct nlattr *attr = (void *)nlh + min_len; |
| 1294 | u32 dump_type; | 1294 | u32 dump_type; |
| 1295 | ip_set_id_t index; | 1295 | ip_set_id_t index; |
| 1296 | int ret; | ||
| 1296 | 1297 | ||
| 1297 | /* Second pass, so parser can't fail */ | 1298 | ret = nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, attr, |
| 1298 | nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, attr, | 1299 | nlh->nlmsg_len - min_len, |
| 1299 | nlh->nlmsg_len - min_len, ip_set_setname_policy, | 1300 | ip_set_setname_policy, NULL); |
| 1300 | NULL); | 1301 | if (ret) |
| 1302 | return ret; | ||
| 1301 | 1303 | ||
| 1302 | cb->args[IPSET_CB_PROTO] = nla_get_u8(cda[IPSET_ATTR_PROTOCOL]); | 1304 | cb->args[IPSET_CB_PROTO] = nla_get_u8(cda[IPSET_ATTR_PROTOCOL]); |
| 1303 | if (cda[IPSET_ATTR_SETNAME]) { | 1305 | if (cda[IPSET_ATTR_SETNAME]) { |
| @@ -1544,10 +1546,14 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, · 240 unmodified lines | |||
| 1544 | memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); | 1546 | memcpy(&errmsg->msg, nlh, nlh->nlmsg_len); |
| 1545 | cmdattr = (void *)&errmsg->msg + min_len; | 1547 | cmdattr = (void *)&errmsg->msg + min_len; |
| 1546 | 1548 | ||
| 1547 | nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr, | 1549 | ret = nla_parse_deprecated(cda, IPSET_ATTR_CMD_MAX, cmdattr, |
| 1548 | nlh->nlmsg_len - min_len, | 1550 | nlh->nlmsg_len - min_len, |
| 1549 | ip_set_adt_policy, NULL); | 1551 | ip_set_adt_policy, NULL); |
| 1550 | 1552 | ||
| 1553 | if (ret) { | ||
| 1554 | nlmsg_free(skb2); | ||
| 1555 | return ret; | ||
| 1556 | } | ||
| 1551 | errline = nla_data(cda[IPSET_ATTR_LINENO]); | 1557 | errline = nla_data(cda[IPSET_ATTR_LINENO]); |
| 1552 | 1558 | ||
| 1553 | *errline = lineno; | 1559 | *errline = lineno; |
| @@ -1561,10 +1567,12 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, · 7 unmodified lines | |||
| 1561 | return ret; | 1567 | return ret; |
| 1562 | } | 1568 | } |
| 1563 | 1569 | ||
| 1564 | static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb, | 1570 | static int ip_set_ad(struct net *net, struct sock *ctnl, |
| 1565 | const struct nlmsghdr *nlh, | 1571 | struct sk_buff *skb, |
| 1566 | const struct nlattr * const attr[], | 1572 | enum ipset_adt adt, |
| 1567 | struct netlink_ext_ack *extack) | 1573 | const struct nlmsghdr *nlh, |
| 1574 | const struct nlattr * const attr[], | ||
| 1575 | struct netlink_ext_ack *extack) | ||
| 1568 | { | 1576 | { |
| 1569 | struct ip_set_net *inst = ip_set_pernet(net); | 1577 | struct ip_set_net *inst = ip_set_pernet(net); |
| 1570 | struct ip_set *set; | 1578 | struct ip_set *set; |
| @@ -1593,18 +1601,17 @@ static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 22 unmodified lines | |||
| 1593 | if (attr[IPSET_ATTR_DATA]) { | 1601 | if (attr[IPSET_ATTR_DATA]) { |
| 1594 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) | 1602 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) |
| 1595 | return -IPSET_ERR_PROTOCOL; | 1603 | return -IPSET_ERR_PROTOCOL; |
| 1596 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, flags, | 1604 | ret = call_ad(ctnl, skb, set, tb, adt, flags, |
| 1597 | use_lineno); | 1605 | use_lineno); |
| 1598 | } else { | 1606 | } else { |
| 1599 | int nla_rem; | 1607 | int nla_rem; |
| 1600 | 1608 | ||
| 1601 | nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) { | 1609 | nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) { |
| 1602 | memset(tb, 0, sizeof(tb)); | ||
| 1603 | if (nla_type(nla) != IPSET_ATTR_DATA || | 1610 | if (nla_type(nla) != IPSET_ATTR_DATA || |
| 1604 | !flag_nested(nla) || | 1611 | !flag_nested(nla) || |
| 1605 | nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) | 1612 | nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) |
| 1606 | return -IPSET_ERR_PROTOCOL; | 1613 | return -IPSET_ERR_PROTOCOL; |
| 1607 | ret = call_ad(ctnl, skb, set, tb, IPSET_ADD, | 1614 | ret = call_ad(ctnl, skb, set, tb, adt, |
| 1608 | flags, use_lineno); | 1615 | flags, use_lineno); |
| 1609 | if (ret < 0) | 1616 | if (ret < 0) |
| 1610 | return ret; | 1617 | return ret; |
| @@ -1613,56 +1620,22 @@ static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb, · 2 unmodified lines | |||
| 1613 | return ret; | 1620 | return ret; |
| 1614 | } | 1621 | } |
| 1615 | 1622 | ||
| 1616 | static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb, | 1623 | static int ip_set_uadd(struct net *net, struct sock *ctnl, |
| 1617 | const struct nlmsghdr *nlh, | 1624 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 1618 | const struct nlattr * const attr[], | 1625 | const struct nlattr * const attr[], |
| 1619 | struct netlink_ext_ack *extack) | 1626 | struct netlink_ext_ack *extack) |
| 1620 | { | 1627 | { |
| 1621 | struct ip_set_net *inst = ip_set_pernet(net); | 1628 | return ip_set_ad(net, ctnl, skb, |
| 1622 | struct ip_set *set; | 1629 | IPSET_ADD, nlh, attr, extack); |
| 1623 | struct nlattr *tb[IPSET_ATTR_ADT_MAX + 1] = {}; | 1630 | } |
| 1624 | const struct nlattr *nla; | ||
| 1625 | u32 flags = flag_exist(nlh); | ||
| 1626 | bool use_lineno; | ||
| 1627 | int ret = 0; | ||
| 1628 | |||
| 1629 | if (unlikely(protocol_min_failed(attr) || | ||
| 1630 | !attr[IPSET_ATTR_SETNAME] || | ||
| 1631 | !((attr[IPSET_ATTR_DATA] != NULL) ^ | ||
| 1632 | (attr[IPSET_ATTR_ADT] != NULL)) || | ||
| 1633 | (attr[IPSET_ATTR_DATA] && | ||
| 1634 | !flag_nested(attr[IPSET_ATTR_DATA])) || | ||
| 1635 | (attr[IPSET_ATTR_ADT] && | ||
| 1636 | (!flag_nested(attr[IPSET_ATTR_ADT]) || | ||
| 1637 | !attr[IPSET_ATTR_LINENO])))) | ||
| 1638 | return -IPSET_ERR_PROTOCOL; | ||
| 1639 | |||
| 1640 | set = find_set(inst, nla_data(attr[IPSET_ATTR_SETNAME])); | ||
| 1641 | if (!set) | ||
| 1642 | return -ENOENT; | ||
| 1643 | |||
| 1644 | use_lineno = !!attr[IPSET_ATTR_LINENO]; | ||
| 1645 | if (attr[IPSET_ATTR_DATA]) { | ||
| 1646 | if (nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, attr[IPSET_ATTR_DATA], set->type->adt_policy, NULL)) | ||
| 1647 | return -IPSET_ERR_PROTOCOL; | ||
| 1648 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, flags, | ||
| 1649 | use_lineno); | ||
| 1650 | } else { | ||
| 1651 | int nla_rem; | ||
| 1652 | 1631 | ||
| 1653 | nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) { | 1632 | static int ip_set_udel(struct net *net, struct sock *ctnl, |
| 1654 | memset(tb, 0, sizeof(*tb)); | 1633 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
| 1655 | if (nla_type(nla) != IPSET_ATTR_DATA || | 1634 | const struct nlattr * const attr[], |
| 1656 | !flag_nested(nla) || | 1635 | struct netlink_ext_ack *extack) |
| 1657 | nla_parse_nested_deprecated(tb, IPSET_ATTR_ADT_MAX, nla, set->type->adt_policy, NULL)) | 1636 | { |
| 1658 | return -IPSET_ERR_PROTOCOL; | 1637 | return ip_set_ad(net, ctnl, skb, |
| 1659 | ret = call_ad(ctnl, skb, set, tb, IPSET_DEL, | 1638 | IPSET_DEL, nlh, attr, extack); |
| 1660 | flags, use_lineno); | ||
| 1661 | if (ret < 0) | ||
| 1662 | return ret; | ||
| 1663 | } | ||
| 1664 | } | ||
| 1665 | return ret; | ||
| 1666 | } | 1639 | } |
| 1667 | 1640 | ||
| 1668 | static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, | 1641 | static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb, |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -625,7 +625,7 @@ retry: · 620 unmodified lines | |||
| 625 | goto cleanup; | 625 | goto cleanup; |
| 626 | } | 626 | } |
| 627 | m->size = AHASH_INIT_SIZE; | 627 | m->size = AHASH_INIT_SIZE; |
| 628 | extsize = ext_size(AHASH_INIT_SIZE, dsize); | 628 | extsize += ext_size(AHASH_INIT_SIZE, dsize); |
| 629 | RCU_INIT_POINTER(hbucket(t, key), m); | 629 | RCU_INIT_POINTER(hbucket(t, key), m); |
| 630 | } else if (m->pos >= m->size) { | 630 | } else if (m->pos >= m->size) { |
| 631 | struct hbucket *ht; | 631 | struct hbucket *ht; |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -30,7 +30,7 @@ · 25 unmodified lines | |||
| 30 | #define IPSET_TYPE_REV_MAX 4 /* skbinfo support */ | 30 | #define IPSET_TYPE_REV_MAX 4 /* skbinfo support */ |
| 31 | 31 | ||
| 32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
| 33 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 33 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 34 | IP_SET_MODULE_DESC("hash:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 34 | IP_SET_MODULE_DESC("hash:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 35 | MODULE_ALIAS("ip_set_hash:ip"); | 35 | MODULE_ALIAS("ip_set_hash:ip"); |
| 36 | 36 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * Copyright (C) 2013 Smoothwall Ltd. <vytas.dauksa@smoothwall.net> | 2 | * Copyright (C) 2013 Smoothwall Ltd. <vytas.dauksa@smoothwall.net> |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -32,7 +32,7 @@ · 27 unmodified lines | |||
| 32 | #define IPSET_TYPE_REV_MAX 5 /* skbinfo support added */ | 32 | #define IPSET_TYPE_REV_MAX 5 /* skbinfo support added */ |
| 33 | 33 | ||
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 36 | IP_SET_MODULE_DESC("hash:ip,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 36 | IP_SET_MODULE_DESC("hash:ip,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 37 | MODULE_ALIAS("ip_set_hash:ip,port"); | 37 | MODULE_ALIAS("ip_set_hash:ip,port"); |
| 38 | 38 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -32,7 +32,7 @@ · 27 unmodified lines | |||
| 32 | #define IPSET_TYPE_REV_MAX 5 /* skbinfo support added */ | 32 | #define IPSET_TYPE_REV_MAX 5 /* skbinfo support added */ |
| 33 | 33 | ||
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 36 | IP_SET_MODULE_DESC("hash:ip,port,ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 36 | IP_SET_MODULE_DESC("hash:ip,port,ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 37 | MODULE_ALIAS("ip_set_hash:ip,port,ip"); | 37 | MODULE_ALIAS("ip_set_hash:ip,port,ip"); |
| 38 | 38 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -34,7 +34,7 @@ · 29 unmodified lines | |||
| 34 | #define IPSET_TYPE_REV_MAX 7 /* skbinfo support added */ | 34 | #define IPSET_TYPE_REV_MAX 7 /* skbinfo support added */ |
| 35 | 35 | ||
| 36 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 37 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 37 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 38 | IP_SET_MODULE_DESC("hash:ip,port,net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 38 | IP_SET_MODULE_DESC("hash:ip,port,net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 39 | MODULE_ALIAS("ip_set_hash:ip,port,net"); | 39 | MODULE_ALIAS("ip_set_hash:ip,port,net"); |
| 40 | 40 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2014 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2014 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -23,7 +23,7 @@ · 18 unmodified lines | |||
| 23 | #define IPSET_TYPE_REV_MAX 0 | 23 | #define IPSET_TYPE_REV_MAX 0 |
| 24 | 24 | ||
| 25 | MODULE_LICENSE("GPL"); | 25 | MODULE_LICENSE("GPL"); |
| 26 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 26 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 27 | IP_SET_MODULE_DESC("hash:mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 27 | IP_SET_MODULE_DESC("hash:mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 28 | MODULE_ALIAS("ip_set_hash:mac"); | 28 | MODULE_ALIAS("ip_set_hash:mac"); |
| 29 | 29 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -31,7 +31,7 @@ · 26 unmodified lines | |||
| 31 | #define IPSET_TYPE_REV_MAX 6 /* skbinfo mapping support added */ | 31 | #define IPSET_TYPE_REV_MAX 6 /* skbinfo mapping support added */ |
| 32 | 32 | ||
| 33 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
| 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 34 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 35 | IP_SET_MODULE_DESC("hash:net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 35 | IP_SET_MODULE_DESC("hash:net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 36 | MODULE_ALIAS("ip_set_hash:net"); | 36 | MODULE_ALIAS("ip_set_hash:net"); |
| 37 | 37 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2011-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2011-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -32,7 +32,7 @@ · 27 unmodified lines | |||
| 32 | #define IPSET_TYPE_REV_MAX 6 /* skbinfo support added */ | 32 | #define IPSET_TYPE_REV_MAX 6 /* skbinfo support added */ |
| 33 | 33 | ||
| 34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
| 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 35 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 36 | IP_SET_MODULE_DESC("hash:net,iface", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 36 | IP_SET_MODULE_DESC("hash:net,iface", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 37 | MODULE_ALIAS("ip_set_hash:net,iface"); | 37 | MODULE_ALIAS("ip_set_hash:net,iface"); |
| 38 | 38 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * Copyright (C) 2013 Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa> | 2 | * Copyright (C) 2013 Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa> |
| 3 | * | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -33,7 +33,7 @@ · 28 unmodified lines | |||
| 33 | #define IPSET_TYPE_REV_MAX 7 /* skbinfo support added */ | 33 | #define IPSET_TYPE_REV_MAX 7 /* skbinfo support added */ |
| 34 | 34 | ||
| 35 | MODULE_LICENSE("GPL"); | 35 | MODULE_LICENSE("GPL"); |
| 36 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 36 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 37 | IP_SET_MODULE_DESC("hash:net,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 37 | IP_SET_MODULE_DESC("hash:net,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 38 | MODULE_ALIAS("ip_set_hash:net,port"); | 38 | MODULE_ALIAS("ip_set_hash:net,port"); |
| 39 | 39 | ||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2008-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 1 | /* Copyright (C) 2008-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 2 | * | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify | 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 as | 4 | * it under the terms of the GNU General Public License version 2 as |
| @@ -22,7 +22,7 @@ · 17 unmodified lines | |||
| 22 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ | 22 | #define IPSET_TYPE_REV_MAX 3 /* skbinfo support added */ |
| 23 | 23 | ||
| 24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
| 25 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 25 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 26 | IP_SET_MODULE_DESC("list:set", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); | 26 | IP_SET_MODULE_DESC("list:set", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX); |
| 27 | MODULE_ALIAS("ip_set_list:set"); | 27 | MODULE_ALIAS("ip_set_list:set"); |
| 28 | 28 | ||
| @@ -7,7 +7,7 @@ · 6 unmodified lines | |||
| 7 | * This source code is licensed under General Public License version 2. | 7 | * This source code is licensed under General Public License version 2. |
| 8 | * | 8 | * |
| 9 | * Based on the 'brute force' H.323 connection tracking module by | 9 | * Based on the 'brute force' H.323 connection tracking module by |
| 10 | * Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 10 | * Jozsef Kadlecsik <kadlec@netfilter.org> |
| 11 | * | 11 | * |
| 12 | * For more information, please see http://nath323.sourceforge.net/ | 12 | * For more information, please see http://nath323.sourceforge.net/ |
| 13 | */ | 13 | */ |
| @@ -1,6 +1,6 @@ | |||
| 1 | /* (C) 1999-2001 Paul `Rusty' Russell | 1 | /* (C) 1999-2001 Paul `Rusty' Russell |
| 2 | * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> | 2 | * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org> |
| 3 | * (C) 2002-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 3 | * (C) 2002-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 4 | * (C) 2006-2012 Patrick McHardy <kaber@trash.net> | 4 | * (C) 2006-2012 Patrick McHardy <kaber@trash.net> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * xt_iprange - Netfilter module to match IP address ranges | 2 | * xt_iprange - Netfilter module to match IP address ranges |
| 3 | * | 3 | * |
| 4 | * (C) 2003 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * (C) 2003 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * (C) CC Computer Consultants GmbH, 2008 | 5 | * (C) CC Computer Consultants GmbH, 2008 |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -133,7 +133,7 @@ static void __exit iprange_mt_exit(void) · 125 unmodified lines | |||
| 133 | module_init(iprange_mt_init); | 133 | module_init(iprange_mt_init); |
| 134 | module_exit(iprange_mt_exit); | 134 | module_exit(iprange_mt_exit); |
| 135 | MODULE_LICENSE("GPL"); | 135 | MODULE_LICENSE("GPL"); |
| 136 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 136 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 137 | MODULE_AUTHOR("Jan Engelhardt <jengelh@medozas.de>"); | 137 | MODULE_AUTHOR("Jan Engelhardt <jengelh@medozas.de>"); |
| 138 | MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching"); | 138 | MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching"); |
| 139 | MODULE_ALIAS("ipt_iprange"); | 139 | MODULE_ALIAS("ipt_iprange"); |
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> | 1 | /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> |
| 2 | * Patrick Schaaf <bof@bof.de> | 2 | * Patrick Schaaf <bof@bof.de> |
| 3 | * Martin Josefsson <gandalf@wlug.westbo.se> | 3 | * Martin Josefsson <gandalf@wlug.westbo.se> |
| 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 4 | * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@netfilter.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
| @@ -21,7 +21,7 @@ · 13 unmodified lines | |||
| 21 | #include <uapi/linux/netfilter/xt_set.h> | 21 | #include <uapi/linux/netfilter/xt_set.h> |
| 22 | 22 | ||
| 23 | MODULE_LICENSE("GPL"); | 23 | MODULE_LICENSE("GPL"); |
| 24 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>"); | 24 | MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>"); |
| 25 | MODULE_DESCRIPTION("Xtables: IP set match and target module"); | 25 | MODULE_DESCRIPTION("Xtables: IP set match and target module"); |
| 26 | MODULE_ALIAS("xt_SET"); | 26 | MODULE_ALIAS("xt_SET"); |
| 27 | MODULE_ALIAS("ipt_set"); | 27 | MODULE_ALIAS("ipt_set"); |
| @@ -439,6 +439,7 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par) · 411 unmodified lines | |||
| 439 | { | 439 | { |
| 440 | const struct xt_set_info_target_v3 *info = par->targinfo; | 440 | const struct xt_set_info_target_v3 *info = par->targinfo; |
| 441 | ip_set_id_t index; | 441 | ip_set_id_t index; |
| 442 | int ret = 0; | ||
| 442 | 443 | ||
| 443 | if (info->add_set.index != IPSET_INVALID_ID) { | 444 | if (info->add_set.index != IPSET_INVALID_ID) { |
| 444 | index = ip_set_nfnl_get_byindex(par->net, | 445 | index = ip_set_nfnl_get_byindex(par->net, |
| @@ -456,17 +457,16 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par) · 11 unmodified lines | |||
| 456 | if (index == IPSET_INVALID_ID) { | 457 | if (index == IPSET_INVALID_ID) { |
| 457 | pr_info_ratelimited("Cannot find del_set index %u as target\n", | 458 | pr_info_ratelimited("Cannot find del_set index %u as target\n", |
| 458 | info->del_set.index); | 459 | info->del_set.index); |
| 459 | if (info->add_set.index != IPSET_INVALID_ID) | 460 | ret = -ENOENT; |
| 460 | ip_set_nfnl_put(par->net, | 461 | goto cleanup_add; |
| 461 | info->add_set.index); | ||
| 462 | return -ENOENT; | ||
| 463 | } | 462 | } |
| 464 | } | 463 | } |
| 465 | 464 | ||
| 466 | if (info->map_set.index != IPSET_INVALID_ID) { | 465 | if (info->map_set.index != IPSET_INVALID_ID) { |
| 467 | if (strncmp(par->table, "mangle", 7)) { | 466 | if (strncmp(par->table, "mangle", 7)) { |
| 468 | pr_info_ratelimited("--map-set only usable from mangle table\n"); | 467 | pr_info_ratelimited("--map-set only usable from mangle table\n"); |
| 469 | return -EINVAL; | 468 | ret = -EINVAL; |
| 469 | goto cleanup_del; | ||
| 470 | } | 470 | } |
| 471 | if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) | | 471 | if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) | |
| 472 | (info->flags & IPSET_FLAG_MAP_SKBQUEUE)) && | 472 | (info->flags & IPSET_FLAG_MAP_SKBQUEUE)) && |
| @@ -474,20 +474,16 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par) · 1 unmodified line | |||
| 474 | 1 << NF_INET_LOCAL_OUT | | 474 | 1 << NF_INET_LOCAL_OUT | |
| 475 | 1 << NF_INET_POST_ROUTING))) { | 475 | 1 << NF_INET_POST_ROUTING))) { |
| 476 | pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n"); | 476 | pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n"); |
| 477 | return -EINVAL; | 477 | ret = -EINVAL; |
| 478 | goto cleanup_del; | ||
| 478 | } | 479 | } |
| 479 | index = ip_set_nfnl_get_byindex(par->net, | 480 | index = ip_set_nfnl_get_byindex(par->net, |
| 480 | info->map_set.index); | 481 | info->map_set.index); |
| 481 | if (index == IPSET_INVALID_ID) { | 482 | if (index == IPSET_INVALID_ID) { |
| 482 | pr_info_ratelimited("Cannot find map_set index %u as target\n", | 483 | pr_info_ratelimited("Cannot find map_set index %u as target\n", |
| 483 | info->map_set.index); | 484 | info->map_set.index); |
| 484 | if (info->add_set.index != IPSET_INVALID_ID) | 485 | ret = -ENOENT; |
| 485 | ip_set_nfnl_put(par->net, | 486 | goto cleanup_del; |
| 486 | info->add_set.index); | ||
| 487 | if (info->del_set.index != IPSET_INVALID_ID) | ||
| 488 | ip_set_nfnl_put(par->net, | ||
| 489 | info->del_set.index); | ||
| 490 | return -ENOENT; | ||
| 491 | } | 487 | } |
| 492 | } | 488 | } |
| 493 | 489 | ||
| @@ -495,16 +491,21 @@ set_target_v3_checkentry(const struct xt_tgchk_param *par) · 1 unmodified line | |||
| 495 | info->del_set.dim > IPSET_DIM_MAX || | 491 | info->del_set.dim > IPSET_DIM_MAX || |
| 496 | info->map_set.dim > IPSET_DIM_MAX) { | 492 | info->map_set.dim > IPSET_DIM_MAX) { |
| 497 | pr_info_ratelimited("SET target dimension over the limit!\n"); | 493 | pr_info_ratelimited("SET target dimension over the limit!\n"); |
| 498 | if (info->add_set.index != IPSET_INVALID_ID) | 494 | ret = -ERANGE; |
| 499 | ip_set_nfnl_put(par->net, info->add_set.index); | 495 | goto cleanup_mark; |
| 500 | if (info->del_set.index != IPSET_INVALID_ID) | ||
| 501 | ip_set_nfnl_put(par->net, info->del_set.index); | ||
| 502 | if (info->map_set.index != IPSET_INVALID_ID) | ||
| 503 | ip_set_nfnl_put(par->net, info->map_set.index); | ||
| 504 | return -ERANGE; | ||
| 505 | } | 496 | } |
| 506 | 497 | ||
| 507 | return 0; | 498 | return 0; |
| 499 | cleanup_mark: | ||
| 500 | if (info->map_set.index != IPSET_INVALID_ID) | ||
| 501 | ip_set_nfnl_put(par->net, info->map_set.index); | ||
| 502 | cleanup_del: | ||
| 503 | if (info->del_set.index != IPSET_INVALID_ID) | ||
| 504 | ip_set_nfnl_put(par->net, info->del_set.index); | ||
| 505 | cleanup_add: | ||
| 506 | if (info->add_set.index != IPSET_INVALID_ID) | ||
| 507 | ip_set_nfnl_put(par->net, info->add_set.index); | ||
| 508 | return ret; | ||
| 508 | } | 509 | } |
| 509 | 510 | ||
| 510 | static void | 511 | static void |