History

Merge branch 'master' of git://blackhole.kfki.hu/nf-next

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. ====================

Pablo Neira Ayuso committed 7 years ago

Commit 667ec212 parents 2256759 fe03d4734 files · +104 −130Browse files

Unified · Split

34 files
  1. CREDITS +1 −1
  2. MAINTAINERS +1 −1
  3. include/linux/jhash.h +1 −1
  4. include/linux/netfilter/ipset/ip_set.h +1 −1
  5. include/linux/netfilter/ipset/ip_set_counter.h +1 −1
  6. include/linux/netfilter/ipset/ip_set_skbinfo.h +1 −1
  7. include/linux/netfilter/ipset/ip_set_timeout.h +1 −1
  8. include/uapi/linux/netfilter/ipset/ip_set.h +1 −1
  9. net/ipv4/netfilter/iptable_raw.c +1 −1
  10. net/ipv4/netfilter/nf_nat_h323.c +1 −1
  11. net/ipv6/netfilter/ip6table_raw.c +1 −1
  12. net/netfilter/ipset/ip_set_bitmap_gen.h +1 −1
  13. net/netfilter/ipset/ip_set_bitmap_ip.c +2 −2
  14. net/netfilter/ipset/ip_set_bitmap_ipmac.c +2 −2
  15. net/netfilter/ipset/ip_set_bitmap_port.c +2 −2
  16. net/netfilter/ipset/ip_set_core.c +35 −62
  17. net/netfilter/ipset/ip_set_getport.c +1 −1
  18. net/netfilter/ipset/ip_set_hash_gen.h +2 −2
  19. net/netfilter/ipset/ip_set_hash_ip.c +2 −2
  20. net/netfilter/ipset/ip_set_hash_ipmark.c +1 −1
  21. net/netfilter/ipset/ip_set_hash_ipport.c +2 −2
  22. net/netfilter/ipset/ip_set_hash_ipportip.c +2 −2
  23. net/netfilter/ipset/ip_set_hash_ipportnet.c +2 −2
  24. net/netfilter/ipset/ip_set_hash_mac.c +2 −2
  25. net/netfilter/ipset/ip_set_hash_net.c +2 −2
  26. net/netfilter/ipset/ip_set_hash_netiface.c +2 −2
  27. net/netfilter/ipset/ip_set_hash_netnet.c +1 −1
  28. net/netfilter/ipset/ip_set_hash_netport.c +2 −2
  29. net/netfilter/ipset/ip_set_hash_netportnet.c +1 −1
  30. net/netfilter/ipset/ip_set_list_set.c +2 −2
  31. net/netfilter/nf_conntrack_h323_main.c +1 −1
  32. net/netfilter/nf_conntrack_proto_tcp.c +1 −1
  33. net/netfilter/xt_iprange.c +2 −2
  34. net/netfilter/xt_set.c +23 −22
CREDITS+1−1
@@ -1800,7 +1800,7 @@ S: 2300 Copenhagen S. · 1799 unmodified lines
1800S: Denmark1800S: Denmark
1801 1801
1802N: Jozsef Kadlecsik1802N: Jozsef Kadlecsik
1803E: kadlec@blackhole.kfki.hu1803E: kadlec@netfilter.org
1804P: 1024D/470DB964 4CB3 1A05 713E 9BF7 FAC5 5809 DD8C B7B1 470D B9641804P: 1024D/470DB964 4CB3 1A05 713E 9BF7 FAC5 5809 DD8C B7B1 470D B964
1805D: netfilter: TCP window tracking code1805D: netfilter: TCP window tracking code
1806D: netfilter: raw table1806D: netfilter: raw table
MAINTAINERS+1−1
@@ -10858,7 +10858,7 @@ F: drivers/net/ethernet/neterion/ · 10857 unmodified lines
10858 10858
10859NETFILTER10859NETFILTER
10860M: Pablo Neira Ayuso <pablo@netfilter.org>10860M: Pablo Neira Ayuso <pablo@netfilter.org>
10861M: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>10861M: Jozsef Kadlecsik <kadlec@netfilter.org>
10862M: Florian Westphal <fw@strlen.de>10862M: Florian Westphal <fw@strlen.de>
10863L: netfilter-devel@vger.kernel.org10863L: netfilter-devel@vger.kernel.org
10864L: coreteam@netfilter.org10864L: coreteam@netfilter.org
include/linux/jhash.h+1−1
@@ -17,7 +17,7 @@ · 16 unmodified lines
17 * if SELF_TEST is defined. You can use this free for any purpose. It's in17 * 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, and22 * 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.
include/linux/netfilter/ipset/ip_set.h+1−1
@@ -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 modify6 * 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 as7 * it under the terms of the GNU General Public License version 2 as
include/linux/netfilter/ipset/ip_set_counter.h+1−1
@@ -1,7 +1,7 @@
1#ifndef _IP_SET_COUNTER_H1#ifndef _IP_SET_COUNTER_H
2#define _IP_SET_COUNTER_H2#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 modify6 * 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 as7 * it under the terms of the GNU General Public License version 2 as
include/linux/netfilter/ipset/ip_set_skbinfo.h+1−1
@@ -1,7 +1,7 @@
1#ifndef _IP_SET_SKBINFO_H1#ifndef _IP_SET_SKBINFO_H
2#define _IP_SET_SKBINFO_H2#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 modify6 * 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 as7 * it under the terms of the GNU General Public License version 2 as
include/linux/netfilter/ipset/ip_set_timeout.h+1−1
@@ -1,7 +1,7 @@
1#ifndef _IP_SET_TIMEOUT_H1#ifndef _IP_SET_TIMEOUT_H
2#define _IP_SET_TIMEOUT_H2#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 modify6 * 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 as7 * it under the terms of the GNU General Public License version 2 as
include/uapi/linux/netfilter/ipset/ip_set.h+1−1
@@ -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 modify7 * 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 as8 * it under the terms of the GNU General Public License version 2 as
net/ipv4/netfilter/iptable_raw.c+1−1
@@ -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 ": " fmt7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8#include <linux/module.h>8#include <linux/module.h>
net/ipv4/netfilter/nf_nat_h323.c+1−1
@@ -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 by9 * 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>
net/ipv6/netfilter/ip6table_raw.c+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
2/*2/*
3 * IPv6 raw table, a port of the IPv4 raw table to IPv63 * 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 ": " fmt7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8#include <linux/module.h>8#include <linux/module.h>
net/netfilter/ipset/ip_set_bitmap_gen.h+1−1
@@ -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 modify3 * 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 as4 * it under the terms of the GNU General Public License version 2 as
net/netfilter/ipset/ip_set_bitmap_ip.c+2−2
@@ -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 modify5 * 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 as6 * 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
33MODULE_LICENSE("GPL");33MODULE_LICENSE("GPL");
34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
35IP_SET_MODULE_DESC("bitmap:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);35IP_SET_MODULE_DESC("bitmap:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
36MODULE_ALIAS("ip_set_bitmap:ip");36MODULE_ALIAS("ip_set_bitmap:ip");
37 37
net/netfilter/ipset/ip_set_bitmap_ipmac.c+2−2
@@ -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 modify6 * 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 as7 * 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
33MODULE_LICENSE("GPL");33MODULE_LICENSE("GPL");
34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
35IP_SET_MODULE_DESC("bitmap:ip,mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);35IP_SET_MODULE_DESC("bitmap:ip,mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
36MODULE_ALIAS("ip_set_bitmap:ip,mac");36MODULE_ALIAS("ip_set_bitmap:ip,mac");
37 37
net/netfilter/ipset/ip_set_bitmap_port.c+2−2
@@ -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 modify3 * 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 as4 * 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
28MODULE_LICENSE("GPL");28MODULE_LICENSE("GPL");
29MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");29MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
30IP_SET_MODULE_DESC("bitmap:port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);30IP_SET_MODULE_DESC("bitmap:port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
31MODULE_ALIAS("ip_set_bitmap:port");31MODULE_ALIAS("ip_set_bitmap:port");
32 32
net/netfilter/ipset/ip_set_core.c+35−62
@@ -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 modify5 * 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 as6 * 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
51module_param(max_sets, int, 0600);51module_param(max_sets, int, 0600);
52MODULE_PARM_DESC(max_sets, "maximal number of sets");52MODULE_PARM_DESC(max_sets, "maximal number of sets");
53MODULE_LICENSE("GPL");53MODULE_LICENSE("GPL");
54MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");54MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
55MODULE_DESCRIPTION("core IP set support");55MODULE_DESCRIPTION("core IP set support");
56MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);56MODULE_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
1564static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb,1570static 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
1616static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb,1623static 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) {1632static 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
1668static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb,1641static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb,
net/netfilter/ipset/ip_set_getport.c+1−1
@@ -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 modify3 * 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 as4 * it under the terms of the GNU General Public License version 2 as
net/netfilter/ipset/ip_set_hash_gen.h+2−2
@@ -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 modify3 * 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 as4 * 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;
net/netfilter/ipset/ip_set_hash_ip.c+2−2
@@ -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 modify3 * 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 as4 * 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
32MODULE_LICENSE("GPL");32MODULE_LICENSE("GPL");
33MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");33MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
34IP_SET_MODULE_DESC("hash:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);34IP_SET_MODULE_DESC("hash:ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
35MODULE_ALIAS("ip_set_hash:ip");35MODULE_ALIAS("ip_set_hash:ip");
36 36
net/netfilter/ipset/ip_set_hash_ipmark.c+1−1
@@ -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 modify4 * This program is free software; you can redistribute it and/or modify
net/netfilter/ipset/ip_set_hash_ipport.c+2−2
@@ -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 modify3 * 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 as4 * 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
34MODULE_LICENSE("GPL");34MODULE_LICENSE("GPL");
35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
36IP_SET_MODULE_DESC("hash:ip,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);36IP_SET_MODULE_DESC("hash:ip,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
37MODULE_ALIAS("ip_set_hash:ip,port");37MODULE_ALIAS("ip_set_hash:ip,port");
38 38
net/netfilter/ipset/ip_set_hash_ipportip.c+2−2
@@ -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 modify3 * 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 as4 * 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
34MODULE_LICENSE("GPL");34MODULE_LICENSE("GPL");
35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
36IP_SET_MODULE_DESC("hash:ip,port,ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);36IP_SET_MODULE_DESC("hash:ip,port,ip", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
37MODULE_ALIAS("ip_set_hash:ip,port,ip");37MODULE_ALIAS("ip_set_hash:ip,port,ip");
38 38
net/netfilter/ipset/ip_set_hash_ipportnet.c+2−2
@@ -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 modify3 * 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 as4 * 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
36MODULE_LICENSE("GPL");36MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");37MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
38IP_SET_MODULE_DESC("hash:ip,port,net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);38IP_SET_MODULE_DESC("hash:ip,port,net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
39MODULE_ALIAS("ip_set_hash:ip,port,net");39MODULE_ALIAS("ip_set_hash:ip,port,net");
40 40
net/netfilter/ipset/ip_set_hash_mac.c+2−2
@@ -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 modify3 * 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 as4 * 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 023#define IPSET_TYPE_REV_MAX 0
24 24
25MODULE_LICENSE("GPL");25MODULE_LICENSE("GPL");
26MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");26MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
27IP_SET_MODULE_DESC("hash:mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);27IP_SET_MODULE_DESC("hash:mac", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
28MODULE_ALIAS("ip_set_hash:mac");28MODULE_ALIAS("ip_set_hash:mac");
29 29
net/netfilter/ipset/ip_set_hash_net.c+2−2
@@ -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 modify3 * 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 as4 * 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
33MODULE_LICENSE("GPL");33MODULE_LICENSE("GPL");
34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");34MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
35IP_SET_MODULE_DESC("hash:net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);35IP_SET_MODULE_DESC("hash:net", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
36MODULE_ALIAS("ip_set_hash:net");36MODULE_ALIAS("ip_set_hash:net");
37 37
net/netfilter/ipset/ip_set_hash_netiface.c+2−2
@@ -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 modify3 * 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 as4 * 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
34MODULE_LICENSE("GPL");34MODULE_LICENSE("GPL");
35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");35MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
36IP_SET_MODULE_DESC("hash:net,iface", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);36IP_SET_MODULE_DESC("hash:net,iface", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
37MODULE_ALIAS("ip_set_hash:net,iface");37MODULE_ALIAS("ip_set_hash:net,iface");
38 38
net/netfilter/ipset/ip_set_hash_netnet.c+1−1
@@ -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 modify4 * This program is free software; you can redistribute it and/or modify
net/netfilter/ipset/ip_set_hash_netport.c+2−2
@@ -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 modify3 * 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 as4 * 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
35MODULE_LICENSE("GPL");35MODULE_LICENSE("GPL");
36MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");36MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
37IP_SET_MODULE_DESC("hash:net,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);37IP_SET_MODULE_DESC("hash:net,port", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
38MODULE_ALIAS("ip_set_hash:net,port");38MODULE_ALIAS("ip_set_hash:net,port");
39 39
net/netfilter/ipset/ip_set_hash_netportnet.c+1−1
@@ -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 modify3 * 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 as4 * it under the terms of the GNU General Public License version 2 as
net/netfilter/ipset/ip_set_list_set.c+2−2
@@ -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 modify3 * 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 as4 * 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
24MODULE_LICENSE("GPL");24MODULE_LICENSE("GPL");
25MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");25MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
26IP_SET_MODULE_DESC("list:set", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);26IP_SET_MODULE_DESC("list:set", IPSET_TYPE_REV_MIN, IPSET_TYPE_REV_MAX);
27MODULE_ALIAS("ip_set_list:set");27MODULE_ALIAS("ip_set_list:set");
28 28
net/netfilter/nf_conntrack_h323_main.c+1−1
@@ -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 by9 * 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 */
net/netfilter/nf_conntrack_proto_tcp.c+1−1
@@ -1,6 +1,6 @@
1/* (C) 1999-2001 Paul `Rusty' Russell1/* (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 modify6 * This program is free software; you can redistribute it and/or modify
net/netfilter/xt_iprange.c+2−2
@@ -1,7 +1,7 @@
1/*1/*
2 * xt_iprange - Netfilter module to match IP address ranges2 * 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, 20085 * (C) CC Computer Consultants GmbH, 2008
6 *6 *
7 * This program is free software; you can redistribute it and/or modify7 * 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
133module_init(iprange_mt_init);133module_init(iprange_mt_init);
134module_exit(iprange_mt_exit);134module_exit(iprange_mt_exit);
135MODULE_LICENSE("GPL");135MODULE_LICENSE("GPL");
136MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");136MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
137MODULE_AUTHOR("Jan Engelhardt <jengelh@medozas.de>");137MODULE_AUTHOR("Jan Engelhardt <jengelh@medozas.de>");
138MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching");138MODULE_DESCRIPTION("Xtables: arbitrary IPv4 range matching");
139MODULE_ALIAS("ipt_iprange");139MODULE_ALIAS("ipt_iprange");
net/netfilter/xt_set.c+23−22
@@ -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 modify6 * 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 as7 * 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
23MODULE_LICENSE("GPL");23MODULE_LICENSE("GPL");
24MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>");24MODULE_AUTHOR("Jozsef Kadlecsik <kadlec@netfilter.org>");
25MODULE_DESCRIPTION("Xtables: IP set match and target module");25MODULE_DESCRIPTION("Xtables: IP set match and target module");
26MODULE_ALIAS("xt_SET");26MODULE_ALIAS("xt_SET");
27MODULE_ALIAS("ipt_set");27MODULE_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;
499cleanup_mark:
500 if (info->map_set.index != IPSET_INVALID_ID)
501 ip_set_nfnl_put(par->net, info->map_set.index);
502cleanup_del:
503 if (info->del_set.index != IPSET_INVALID_ID)
504 ip_set_nfnl_put(par->net, info->del_set.index);
505cleanup_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
510static void511static void