Netfilter updates for net-next
Subsystems (6)
Pablo Neira Ayuso
maintainercover Netfilter updates for net-next
Hi David,
The following patchset contains Netfilter/IPVS updates for your net-next tree. In sum, patches to address fallout from the previous round plus updates from the IPVS folks via Simon Horman, they are:
1) Add a new scheduler to IPVS: The weighted overflow scheduling algorithm directs network connections to the server with the highest weight that is currently available and overflows to the next when active connections exceed the node's weight. From Raducu Deaconu.
2) Fix locking ordering in IPVS, always take rtnl_lock in first place. Patch from Julian Anastasov.
3) Allow to indicate the MTU to the IPVS in-kernel state sync daemon. From Julian Anastasov.
4) Enhance multicast configuration for the IPVS state sync daemon. Also from Julian.
5) Resolve sparse warnings in the nf_dup modules.
6) Fix a linking problem when CONFIG_NF_DUP_IPV6 is not set.
7) Add ICMP codes 5 and 6 to IPv6 REJECT target, they are more informative subsets of code 1. From Andreas Herz.
8) Revert the jumpstack size calculation from mark_source_chains due to chain depth miscalculations, from Florian Westphal.
9) Calm down more sparse warning around the Netfilter tree, again from Florian Westphal.
You can pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
Thanks!
----------------------------------------------------------------
The following changes since commit 81bf1c64e7fe08f956c74fe2b0f1fa6eb163bd91:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next (2015-08-21 06:09:05 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
for you to fetch changes up to 851345c5bbb4644911f7c351c042559a71f57d19:
netfilter: reduce sparse warnings (2015-08-28 21:04:12 +0200)
----------------------------------------------------------------
Andreas Herz (1):
netfilter: ip6t_REJECT: added missing icmpv6 codes
Florian Westphal (2):
Revert "netfilter: xtables: compute exact size needed for jumpstack"
netfilter: reduce sparse warnings
Julian Anastasov (3):
ipvs: call rtnl_lock early
ipvs: add sync_maxlen parameter for the sync daemon
ipvs: add more mcast parameters for the sync daemon
Pablo Neira Ayuso (3):
netfilter: nf_dup: fix sparse warnings
netfilter: xt_TEE: use IS_ENABLED(CONFIG_NF_DUP_IPV6)
Merge tag 'ipvs2-for-v4.3' of https://git.kernel.org/.../horms/ipvs-next
Raducu Deaconu (1):
ipvs: Add ovf scheduler
include/net/ip_vs.h | 23 +- include/uapi/linux/ip_vs.h | 5 + include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h | 4 +- net/bridge/netfilter/ebtables.c | 2 +- net/ipv4/netfilter/arp_tables.c | 19 +- net/ipv4/netfilter/ip_tables.c | 28 +-- net/ipv4/netfilter/nft_dup_ipv4.c | 2 +- net/ipv6/netfilter/ip6_tables.c | 23 +- net/ipv6/netfilter/ip6t_REJECT.c | 6 + net/ipv6/netfilter/ip6t_SYNPROXY.c | 2 +- net/ipv6/netfilter/nf_dup_ipv6.c | 4 +- net/netfilter/core.c | 3 - net/netfilter/ipvs/Kconfig | 11 + net/netfilter/ipvs/Makefile | 1 + net/netfilter/ipvs/ip_vs_ctl.c | 143 +++++++++--- net/netfilter/ipvs/ip_vs_ovf.c | 86 ++++++++ net/netfilter/ipvs/ip_vs_sync.c | 269 +++++++++++++++-------- net/netfilter/nf_synproxy_core.c | 6 +- net/netfilter/xt_TEE.c | 4 +- 19 files changed, 446 insertions(+), 195 deletions(-) create mode 100644 net/netfilter/ipvs/ip_vs_ovf.c
Pablo Neira Ayuso
maintainerPATCH 1/9 ipvs: Add ovf scheduler
From: Raducu Deaconu <[email protected]>
The weighted overflow scheduling algorithm directs network connections to the server with the highest weight that is currently available and overflows to the next when active connections exceed the node's weight.
--- net/netfilter/ipvs/Kconfig | 11 +++++ net/netfilter/ipvs/Makefile | 1 + net/netfilter/ipvs/ip_vs_ovf.c | 86 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 net/netfilter/ipvs/ip_vs_ovf.c
net/netfilter/ipvs/Kconfig +11 -0
@@ -162,6 +162,17 @@ config IP_VS_FO If you want to compile it in kernel, say Y. To compile it as a module, choose M here. If unsure, say N. +config IP_VS_OVF + tristate "weighted overflow scheduling" + ---help--- + The weighted overflow scheduling algorithm directs network + connections to the server with the highest weight that is + currently available and overflows to the next when active + connections exceed the node's weight. + + If you want to compile it in kernel, say Y. To compile it as a + module, choose M here. If unsure, say N. + config IP_VS_LBLC tristate "locality-based least-connection scheduling" ---help---
net/netfilter/ipvs/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_IP_VS_WRR) += ip_vs_wrr.o obj-$(CONFIG_IP_VS_LC) += ip_vs_lc.o obj-$(CONFIG_IP_VS_WLC) += ip_vs_wlc.o obj-$(CONFIG_IP_VS_FO) += ip_vs_fo.o +obj-$(CONFIG_IP_VS_OVF) += ip_vs_ovf.o obj-$(CONFIG_IP_VS_LBLC) += ip_vs_lblc.o obj-$(CONFIG_IP_VS_LBLCR) += ip_vs_lblcr.o obj-$(CONFIG_IP_VS_DH) += ip_vs_dh.o
net/netfilter/ipvs/ip_vs_ovf.c new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 2/9 ipvs: call rtnl_lock early
In reply to Pablo Neira AyusoFrom: Julian Anastasov <[email protected]>
When the sync damon is started we need to hold rtnl lock while calling ip_mc_join_group. Currently, we have a wrong locking order because the correct one is rtnl_lock->__ip_vs_mutex. It is implied from the usage of __ip_vs_mutex in ip_vs_dst_event() which is called under rtnl lock during NETDEV_* notifications.
Fix the problem by calling rtnl_lock early only for the start_sync_thread call. As a bonus this fixes the usage __dev_get_by_name which was not called under rtnl lock.
This patch actually extends and depends on commit 54ff9ef36bdf ("ipv4, ipv6: kill ip_mc_{join, leave}_group and ipv6_sock_mc_{join, drop}").
--- net/netfilter/ipvs/ip_vs_ctl.c | 50 ++++++++++++++++++++++++++------------- net/netfilter/ipvs/ip_vs_sync.c | 2 -- 2 files changed, 33 insertions(+), 19 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +33 -17
@@ -2335,13 +2335,18 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) cmd == IP_VS_SO_SET_STOPDAEMON) {struct ip_vs_daemon_user *dm = (struct ip_vs_daemon_user *)arg; -mutex_lock (&ipvs->sync_mutex); -if (cmd ==IP_VS_SO_SET_STARTDAEMON ) +if (cmd ==IP_VS_SO_SET_STARTDAEMON ) { +rtnl_lock (); +mutex_lock (&ipvs->sync_mutex); ret =start_sync_thread (net, dm->state, dm->mcast_ifn, dm->syncid); -else +mutex_unlock (&ipvs->sync_mutex); +rtnl_unlock (); + }else { +mutex_lock (&ipvs->sync_mutex); ret =stop_sync_thread (net, dm->state); -mutex_unlock (&ipvs->sync_mutex); +mutex_unlock (&ipvs->sync_mutex); + } goto out_dec; }
@@ -3342,6 +3347,9 @@ nla_put_failure:static int ip_vs_genl_new_daemon (struct net *net,struct nlattr **attrs) { +struct netns_ipvs *ipvs =net_ipvs (net); +int ret; +if (!(attrs[IPVS_DAEMON_ATTR_STATE ] && attrs[IPVS_DAEMON_ATTR_MCAST_IFN ] && attrs[IPVS_DAEMON_ATTR_SYNC_ID ]))
@@ -3353,19 +3361,30 @@ static int ip_vs_genl_new_daemon(struct net *net, struct nlattr **attrs)if (net_ipvs (net)->mixed_address_family_dests >0 )return -EINVAL ; -return start_sync_thread (net, -nla_get_u32 (attrs[IPVS_DAEMON_ATTR_STATE ]), -nla_data (attrs[IPVS_DAEMON_ATTR_MCAST_IFN ]), -nla_get_u32 (attrs[IPVS_DAEMON_ATTR_SYNC_ID ])); +rtnl_lock (); +mutex_lock (&ipvs->sync_mutex); + ret =start_sync_thread (net, +nla_get_u32 (attrs[IPVS_DAEMON_ATTR_STATE ]), +nla_data (attrs[IPVS_DAEMON_ATTR_MCAST_IFN ]), +nla_get_u32 (attrs[IPVS_DAEMON_ATTR_SYNC_ID ])); +mutex_unlock (&ipvs->sync_mutex); +rtnl_unlock (); +return ret; }static int ip_vs_genl_del_daemon (struct net *net,struct nlattr **attrs) { +struct netns_ipvs *ipvs =net_ipvs (net); +int ret; +if (!attrs[IPVS_DAEMON_ATTR_STATE ])return -EINVAL ; -return stop_sync_thread (net, -nla_get_u32 (attrs[IPVS_DAEMON_ATTR_STATE ])); +mutex_lock (&ipvs->sync_mutex); + ret =stop_sync_thread (net, +nla_get_u32 (attrs[IPVS_DAEMON_ATTR_STATE ])); +mutex_unlock (&ipvs->sync_mutex); +return ret; }static int ip_vs_genl_set_config (struct net *net,struct nlattr **attrs)
@@ -3389,7 +3408,7 @@ static int ip_vs_genl_set_config(struct net *net, struct nlattr **attrs)static int ip_vs_genl_set_daemon (struct sk_buff *skb,struct genl_info *info) { -int ret =0 , cmd; +int ret = -EINVAL , cmd;struct net *net;struct netns_ipvs *ipvs;
@@ -3400,22 +3419,19 @@ static int ip_vs_genl_set_daemon(struct sk_buff *skb, struct genl_info *info)if (cmd ==IPVS_CMD_NEW_DAEMON || cmd ==IPVS_CMD_DEL_DAEMON ) {struct nlattr *daemon_attrs[IPVS_DAEMON_ATTR_MAX +1 ]; -mutex_lock (&ipvs->sync_mutex);if (!info->attrs[IPVS_CMD_ATTR_DAEMON ] ||nla_parse_nested (daemon_attrs,IPVS_DAEMON_ATTR_MAX , info->attrs[IPVS_CMD_ATTR_DAEMON ], - ip_vs_daemon_policy)) { - ret = -EINVAL ; + ip_vs_daemon_policy)) goto out; - }if (cmd ==IPVS_CMD_NEW_DAEMON ) ret =ip_vs_genl_new_daemon (net, daemon_attrs);else ret =ip_vs_genl_del_daemon (net, daemon_attrs); -out: -mutex_unlock (&ipvs->sync_mutex); } + +out:return ret; }
net/netfilter/ipvs/ip_vs_sync.c +0 -2
@@ -1405,11 +1405,9 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname) mreq.imr_ifindex = dev->ifindex; -rtnl_lock ();lock_sock (sk); ret =ip_mc_join_group (sk, &mreq);release_sock (sk); -rtnl_unlock ();return ret; }
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 3/9 ipvs: add sync_maxlen parameter for the sync daemon
In reply to Pablo Neira AyusoFrom: Julian Anastasov <[email protected]>
Allow setups with large MTU to send large sync packets by adding sync_maxlen parameter. The default value is now based on MTU but no more than 1500 for compatibility reasons.
To avoid problems if MTU changes allow fragmentation by sending packets with DF=0. Problem reported by Dan Carpenter.
--- include/net/ip_vs.h | 19 +++--- include/uapi/linux/ip_vs.h | 1 + net/netfilter/ipvs/ip_vs_ctl.c | 53 +++++++++------ net/netfilter/ipvs/ip_vs_sync.c | 137 ++++++++++++++++++--------------------- 4 files changed, 108 insertions(+), 102 deletions(-)
include/net/ip_vs.h +11 -8
@@ -846,6 +846,13 @@ struct ipvs_master_sync_state {/* How much time to keep dests in trash */ #define IP_VS_DEST_TRASH_PERIOD (120 * HZ) +struct ipvs_sync_daemon_cfg { +int syncid; +u16 sync_maxlen; +/* multicast interface name */ +char mcast_ifn[IP_VS_IFNAME_MAXLEN ]; +}; +/* IPVS in network namespace */ struct netns_ipvs {int gen;/* Generation */
@@ -961,15 +968,10 @@ struct netns_ipvs {spinlock_t sync_buff_lock;struct task_struct **backup_threads;int threads_mask; -int send_mesg_maxlen; -int recv_mesg_maxlen;volatile int sync_state; -volatile int master_syncid; -volatile int backup_syncid;struct mutex sync_mutex; -/* multicast interface name */ -char master_mcast_ifn[IP_VS_IFNAME_MAXLEN ]; -char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN ]; +struct ipvs_sync_daemon_cfg mcfg;/* Master Configuration */ +struct ipvs_sync_daemon_cfg bcfg;/* Backup Configuration */ /* net name space ptr */ struct net *net;/* Needed by timer routines */ /* Number of heterogeneous destinations, needed becaus heterogeneous
@@ -1408,7 +1410,8 @@ static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)/* IPVS sync daemon data and function prototypes * (from ip_vs_sync.c) */ -int start_sync_thread (struct net *net,int state,char *mcast_ifn,__u8 syncid); +int start_sync_thread (struct net *net,struct ipvs_sync_daemon_cfg *cfg, +int state);int stop_sync_thread (struct net *net,int state);void ip_vs_sync_conn (struct net *net,struct ip_vs_conn *cp,int pkts);
include/uapi/linux/ip_vs.h +1 -0
@@ -406,6 +406,7 @@ enum {IPVS_DAEMON_ATTR_STATE ,/* sync daemon state (master/backup) */ IPVS_DAEMON_ATTR_MCAST_IFN ,/* multicast interface name */ IPVS_DAEMON_ATTR_SYNC_ID ,/* SyncID we belong to */ +IPVS_DAEMON_ATTR_SYNC_MAXLEN ,/* UDP Payload Size */ __IPVS_DAEMON_ATTR_MAX, };
net/netfilter/ipvs/ip_vs_ctl.c +33 -20
134 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_sync.c +63 -74
318 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 4/9 ipvs: add more mcast parameters for the sync daemon
In reply to Pablo Neira AyusoFrom: Julian Anastasov <[email protected]>
- mcast_group: configure the multicast address, now IPv6 is supported too
- mcast_port: configure the multicast port
- mcast_ttl: configure the multicast TTL/HOP_LIMIT
--- include/net/ip_vs.h | 4 ++ include/uapi/linux/ip_vs.h | 4 ++ net/netfilter/ipvs/ip_vs_ctl.c | 50 +++++++++++++- net/netfilter/ipvs/ip_vs_sync.c | 138 ++++++++++++++++++++++++++++++++------- 4 files changed, 172 insertions(+), 24 deletions(-)
include/net/ip_vs.h +4 -0
@@ -847,8 +847,12 @@ struct ipvs_master_sync_state {#define IP_VS_DEST_TRASH_PERIOD (120 * HZ)struct ipvs_sync_daemon_cfg { +union nf_inet_addr mcast_group;int syncid;u16 sync_maxlen; +u16 mcast_port; +u8 mcast_af; +u8 mcast_ttl;/* multicast interface name */ char mcast_ifn[IP_VS_IFNAME_MAXLEN ]; };
include/uapi/linux/ip_vs.h +4 -0
@@ -407,6 +407,10 @@ enum {IPVS_DAEMON_ATTR_MCAST_IFN ,/* multicast interface name */ IPVS_DAEMON_ATTR_SYNC_ID ,/* SyncID we belong to */ IPVS_DAEMON_ATTR_SYNC_MAXLEN ,/* UDP Payload Size */ +IPVS_DAEMON_ATTR_MCAST_GROUP ,/* IPv4 Multicast Address */ +IPVS_DAEMON_ATTR_MCAST_GROUP6 ,/* IPv6 Multicast Address */ +IPVS_DAEMON_ATTR_MCAST_PORT ,/* Multicast Port (base) */ +IPVS_DAEMON_ATTR_MCAST_TTL ,/* Multicast TTL */ __IPVS_DAEMON_ATTR_MAX, };
net/netfilter/ipvs/ip_vs_ctl.c +49 -1
69 lines not on this page · raw message
net/netfilter/ipvs/ip_vs_sync.c +115 -23
239 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 5/9 netfilter: nf_dup: fix sparse warnings
In reply to Pablo Neira AyusoQuoted 1 line
Quoted 1 line
net/ipv4/netfilter/nft_dup_ipv4.c:29:37: sparse: incorrect type in initializer (different base types)
net/ipv4/netfilter/nft_dup_ipv4.c:29:37: expected restricted __be32 [user type] s_addr
net/ipv4/netfilter/nft_dup_ipv4.c:29:37: got unsigned int [unsigned] <noident>
Quoted 1 line
Quoted 1 line
net/ipv6/netfilter/nf_dup_ipv6.c:48:23: sparse: incorrect type in assignment (different base types)
net/ipv6/netfilter/nf_dup_ipv6.c:48:23: expected restricted __be32 [addressable] [assigned] [usertype] flowlabel
net/ipv6/netfilter/nf_dup_ipv6.c:48:23: got int
--- net/ipv4/netfilter/nft_dup_ipv4.c | 2 +- net/ipv6/netfilter/nf_dup_ipv6.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
net/ipv4/netfilter/nft_dup_ipv4.c +1 -1
@@ -26,7 +26,7 @@ static void nft_dup_ipv4_eval(const struct nft_expr *expr, {struct nft_dup_ipv4 *priv =nft_expr_priv (expr);struct in_addr gw = { - .s_addr = regs->data[priv->sreg_addr], + .s_addr = (__force __be32 )regs->data[priv->sreg_addr], };int oif = regs->data[priv->sreg_dev];
net/ipv6/netfilter/nf_dup_ipv6.c +2 -2
@@ -45,8 +45,8 @@ static bool nf_dup_ipv6_route(struct sk_buff *skb, const struct in6_addr *gw, fl6.flowi6_oif = oif; fl6.daddr = *gw; - fl6.flowlabel = ((iph->flow_lbl[0 ] &0xF ) <<16 ) | - (iph->flow_lbl[1 ] <<8 ) | iph->flow_lbl[2 ]; + fl6.flowlabel = (__force __be32)(((iph->flow_lbl[0 ] &0xF ) <<16 ) | + (iph->flow_lbl[1 ] <<8 ) | iph->flow_lbl[2 ]); dst =ip6_route_output (net,NULL , &fl6);if (dst->error) {dst_release (dst);
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 6/9 netfilter: xt_TEE: use IS_ENABLED(CONFIG_NF_DUP_IPV6)
In reply to Pablo Neira AyusoInstead of IS_ENABLED(CONFIG_IPV6), otherwise we hit:
et/built-in.o: In function `tee_tg6':
Quoted 1 line
Quoted 1 line
xt_TEE.c:(.text+0x6cd8c): undefined reference to `nf_dup_ipv6'
when:
CONFIG_IPV6=y
CONFIG_NF_DUP_IPV4=y
# CONFIG_NF_DUP_IPV6 is not set
CONFIG_NETFILTER_XT_TARGET_TEE=y
--- net/netfilter/xt_TEE.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/xt_TEE.c +2 -2
@@ -37,7 +37,7 @@ tee_tg4(struct sk_buff *skb, const struct xt_action_param *par)return XT_CONTINUE ; } -#if IS_ENABLED (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_NF_DUP_IPV6 )static unsigned int tee_tg6 (struct sk_buff *skb,const struct xt_action_param *par) {
@@ -129,7 +129,7 @@ static struct xt_target tee_tg_reg[] __read_mostly = { .destroy = tee_tg_destroy, .me = THIS_MODULE, }, -#if IS_ENABLED (CONFIG_IPV6 ) +#if IS_ENABLED (CONFIG_NF_DUP_IPV6 ) { .name = "TEE", .revision = 1,
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 7/9 netfilter: ip6t_REJECT: added missing icmpv6 codes
In reply to Pablo Neira AyusoFrom: Andreas Herz <[email protected]>
RFC 4443 added two new codes values for ICMPv6 type 1:
5 - Source address failed ingress/egress policy
6 - Reject route to destination
And RFC 7084 states in L-14 that IPv6 Router MUST send ICMPv6 Destination Unreachable with code 5 for packets forwarded to it that use an address from a prefix that has been invalidated.
Codes 5 and 6 are more informative subsets of code 1.
--- include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h | 4 +++- net/ipv6/netfilter/ip6t_REJECT.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h +3 -1
@@ -10,7 +10,9 @@ enum ip6t_reject_with {IP6T_ICMP6_ADDR_UNREACH ,IP6T_ICMP6_PORT_UNREACH ,IP6T_ICMP6_ECHOREPLY , -IP6T_TCP_RESET +IP6T_TCP_RESET , +IP6T_ICMP6_POLICY_FAIL , +IP6T_ICMP6_REJECT_ROUTE }; struct ip6t_reject_info {
net/ipv6/netfilter/ip6t_REJECT.c +6 -0
@@ -63,6 +63,12 @@ reject_tg6(struct sk_buff *skb, const struct xt_action_param *par)case IP6T_TCP_RESET :nf_send_reset6 (net, skb, par->hooknum);break ; +case IP6T_ICMP6_POLICY_FAIL : +nf_send_unreach6 (net, skb,ICMPV6_POLICY_FAIL , par->hooknum); +break ; +case IP6T_ICMP6_REJECT_ROUTE : +nf_send_unreach6 (net, skb,ICMPV6_REJECT_ROUTE , par->hooknum); +break ; }return NF_DROP ;
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 8/9 Revert "netfilter: xtables: compute exact size needed for jumpstack"
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
This reverts commit 98d1bd802cdbc8f56868fae51edec13e86b59515.
mark_source_chains will not re-visit chains, so
*filter
:INPUT ACCEPT [365:25776]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [217:45832]
:t1 - [0:0]
:t2 - [0:0]
:t3 - [0:0]
:t4 - [0:0]
-A t1 -i lo -j t2
-A t2 -i lo -j t3
-A t3 -i lo -j t4
# -A INPUT -j t4
# -A INPUT -j t3
# -A INPUT -j t2
-A INPUT -j t1
COMMIT
Will compute a chain depth of 2 if the comments are removed. Revert back to counting the number of chains for the time being.
--- net/ipv4/netfilter/arp_tables.c | 19 +++++++------------ net/ipv4/netfilter/ip_tables.c | 28 ++++++++++------------------ net/ipv6/netfilter/ip6_tables.c | 23 ++++++++--------------- 3 files changed, 25 insertions(+), 45 deletions(-)
net/ipv4/netfilter/arp_tables.c +7 -12
@@ -367,13 +367,10 @@ static inline bool unconditional(const struct arpt_arp *arp)/* Figures out from what hook each rule can be called: returns 0 if * there are loops. Puts hook bitmask in comefrom. -* -* Keeps track of largest call depth seen and stores it in newinfo->stacksize. */ -static int mark_source_chains (struct xt_table_info *newinfo, +static int mark_source_chains (const struct xt_table_info *newinfo,unsigned int valid_hooks,void *entry0) { -unsigned int calldepth, max_calldepth =0 ;unsigned int hook;/* No recursion; use packet counter to save back ptrs (reset
@@ -389,7 +386,6 @@ static int mark_source_chains(struct xt_table_info *newinfo,/* Set initial back pointer. */ e->counters.pcnt = pos; - calldepth =0 ;for (;;) {const struct xt_standard_target *t
@@ -444,8 +440,6 @@ static int mark_source_chains(struct xt_table_info *newinfo, (entry0 + pos + size); e->counters.pcnt = pos; pos += size; -if (calldepth >0 ) - --calldepth; }else {int newpos = t->verdict;
@@ -460,10 +454,6 @@ static int mark_source_chains(struct xt_table_info *newinfo,return 0 ; } -if (entry0 + newpos !=arpt_next_entry (e) && - ++calldepth > max_calldepth) - max_calldepth = calldepth; -/* This a jump; chase it. */ duprintf ("Jump rule %u -> %u\n" , pos, newpos);
@@ -480,7 +470,6 @@ static int mark_source_chains(struct xt_table_info *newinfo, next:duprintf ("Finished chain %u\n" , hook); } - newinfo->stacksize = max_calldepth;return 1 ; }
@@ -670,6 +659,9 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0,if (ret !=0 )break ; ++i; +if (strcmp (arpt_get_target (iter)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }duprintf ("translate_table: ARPT_ENTRY_ITERATE gives %d\n" , ret);if (ret !=0 )
@@ -1442,6 +1434,9 @@ static int translate_compat_table(const char *name,break ; } ++i; +if (strcmp (arpt_get_target (iter1)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }if (ret) {/*
net/ipv4/netfilter/ip_tables.c +10 -18
@@ -443,15 +443,11 @@ ipt_do_table(struct sk_buff *skb, }/* Figures out from what hook each rule can be called: returns 0 if -* there are loops. Puts hook bitmask in comefrom. -* -* Keeps track of largest call depth seen and stores it in newinfo->stacksize. -*/ +there are loops. Puts hook bitmask in comefrom. */ static int -mark_source_chains (struct xt_table_info *newinfo, +mark_source_chains (const struct xt_table_info *newinfo,unsigned int valid_hooks,void *entry0) { -unsigned int calldepth, max_calldepth =0 ;unsigned int hook;/* No recursion; use packet counter to save back ptrs (reset
@@ -465,7 +461,6 @@ mark_source_chains(struct xt_table_info *newinfo,/* Set initial back pointer. */ e->counters.pcnt = pos; - calldepth =0 ;for (;;) {const struct xt_standard_target *t
@@ -527,9 +522,6 @@ mark_source_chains(struct xt_table_info *newinfo, (entry0 + pos + size); e->counters.pcnt = pos; pos += size; -WARN_ON_ONCE (calldepth ==0 ); -if (calldepth >0 ) - --calldepth; }else {int newpos = t->verdict;
@@ -543,14 +535,9 @@ mark_source_chains(struct xt_table_info *newinfo, newpos);return 0 ; } -if (entry0 + newpos !=ipt_next_entry (e) && - !(e->ip.flags &IPT_F_GOTO ) && - ++calldepth > max_calldepth) - max_calldepth = calldepth; -/* This a jump; chase it. */ -duprintf ("Jump rule %u -> %u, calldepth %d\n" , - pos, newpos, calldepth); +duprintf ("Jump rule %u -> %u\n" , + pos, newpos); }else {/* ... this is a fallthru */ newpos = pos + e->next_offset;
@@ -564,7 +551,6 @@ mark_source_chains(struct xt_table_info *newinfo, next:duprintf ("Finished chain %u\n" , hook); } - newinfo->stacksize = max_calldepth;return 1 ; }
@@ -844,6 +830,9 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,if (ret !=0 )return ret; ++i; +if (strcmp (ipt_get_target (iter)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }if (i != repl->num_entries) {
@@ -1759,6 +1748,9 @@ translate_compat_table(struct net *net,if (ret !=0 )break ; ++i; +if (strcmp (ipt_get_target (iter1)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }if (ret) {/*
net/ipv6/netfilter/ip6_tables.c +8 -15
@@ -455,15 +455,11 @@ ip6t_do_table(struct sk_buff *skb, }/* Figures out from what hook each rule can be called: returns 0 if -* there are loops. Puts hook bitmask in comefrom. -* -* Keeps track of largest call depth seen and stores it in newinfo->stacksize. -*/ +there are loops. Puts hook bitmask in comefrom. */ static int -mark_source_chains (struct xt_table_info *newinfo, +mark_source_chains (const struct xt_table_info *newinfo,unsigned int valid_hooks,void *entry0) { -unsigned int calldepth, max_calldepth =0 ;unsigned int hook;/* No recursion; use packet counter to save back ptrs (reset
@@ -477,7 +473,6 @@ mark_source_chains(struct xt_table_info *newinfo,/* Set initial back pointer. */ e->counters.pcnt = pos; - calldepth =0 ;for (;;) {const struct xt_standard_target *t
@@ -539,8 +534,6 @@ mark_source_chains(struct xt_table_info *newinfo, (entry0 + pos + size); e->counters.pcnt = pos; pos += size; -if (calldepth >0 ) - --calldepth; }else {int newpos = t->verdict;
@@ -554,11 +547,6 @@ mark_source_chains(struct xt_table_info *newinfo, newpos);return 0 ; } -if (entry0 + newpos !=ip6t_next_entry (e) && - !(e->ipv6.flags &IP6T_F_GOTO ) && - ++calldepth > max_calldepth) - max_calldepth = calldepth; -/* This a jump; chase it. */ duprintf ("Jump rule %u -> %u\n" , pos, newpos);
@@ -575,7 +563,6 @@ mark_source_chains(struct xt_table_info *newinfo, next:duprintf ("Finished chain %u\n" , hook); } - newinfo->stacksize = max_calldepth;return 1 ; }
@@ -855,6 +842,9 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,if (ret !=0 )return ret; ++i; +if (strcmp (ip6t_get_target (iter)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }if (i != repl->num_entries) {
@@ -1767,6 +1757,9 @@ translate_compat_table(struct net *net,if (ret !=0 )break ; ++i; +if (strcmp (ip6t_get_target (iter1)->u.user.name, +XT_ERROR_TARGET ) ==0 ) + ++newinfo->stacksize; }if (ret) {/*
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 9/9 netfilter: reduce sparse warnings
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
bridge/netfilter/ebtables.c:290:26: warning: incorrect type in assignment (different modifiers) -> remove __pure annotation.
ipv6/netfilter/ip6t_SYNPROXY.c:240:27: warning: cast from restricted __be16 -> switch ntohs to htons and vice versa.
netfilter/core.c:391:30: warning: symbol 'nfq_ct_nat_hook' was not declared. Should it be static? -> delete it, got removed
net/netfilter/nf_synproxy_core.c:221:48: warning: cast to restricted __be32 -> Use __be32 instead of u32.
Tested with objdiff that these changes do not affect generated code.
--- net/bridge/netfilter/ebtables.c | 2 +- net/ipv6/netfilter/ip6t_SYNPROXY.c | 2 +- net/netfilter/core.c | 3 --- net/netfilter/nf_synproxy_core.c | 6 +++--- 4 files changed, 5 insertions(+), 8 deletions(-)
net/bridge/netfilter/ebtables.c +1 -1
@@ -176,7 +176,7 @@ ebt_basic_match(const struct ebt_entry *e, const struct sk_buff *skb,return 0 ; } -static inline __pure +static inline struct ebt_entry *ebt_next_entry (const struct ebt_entry *entry) {return (void *)entry + entry->next_offset;
net/ipv6/netfilter/ip6t_SYNPROXY.c +1 -1
@@ -237,7 +237,7 @@ synproxy_send_client_ack(const struct synproxy_net *snet, nth->ack_seq = th->ack_seq;tcp_flag_word (nth) =TCP_FLAG_ACK ; nth->doff = tcp_hdr_size /4 ; - nth->window =ntohs (htons (th->window) >> opts->wscale); + nth->window =htons (ntohs (th->window) >> opts->wscale); nth->check =0 ; nth->urg_ptr =0 ;
net/netfilter/core.c +0 -3
@@ -388,9 +388,6 @@ EXPORT_SYMBOL(nf_conntrack_destroy);struct nfq_ct_hook __rcu *nfq_ct_hook__read_mostly ;EXPORT_SYMBOL_GPL (nfq_ct_hook); -struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook__read_mostly ; -EXPORT_SYMBOL_GPL (nfq_ct_nat_hook); -#endif /* CONFIG_NF_CONNTRACK */ #ifdef CONFIG_NF_NAT_NEEDED
net/netfilter/nf_synproxy_core.c +3 -3
@@ -188,7 +188,7 @@ unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, const struct nf_conn_synproxy *synproxy) {unsigned int optoff, optend; -u32 *ptr, old; +__be32 *ptr, old;if (synproxy->tsoff ==0 )return 1 ;
@@ -216,12 +216,12 @@ unsigned int synproxy_tstamp_adjust(struct sk_buff *skb,if (op[0 ] ==TCPOPT_TIMESTAMP && op[1 ] ==TCPOLEN_TIMESTAMP ) {if (CTINFO2DIR (ctinfo) ==IP_CT_DIR_REPLY ) { - ptr = (u32 *)&op[2 ]; + ptr = (__be32 *)&op[2 ]; old = *ptr; *ptr =htonl (ntohl (*ptr) - synproxy->tsoff); }else { - ptr = (u32 *)&op[6 ]; + ptr = (__be32 *)&op[6 ]; old = *ptr; *ptr =htonl (ntohl (*ptr) + synproxy->tsoff);
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Sat, 29 Aug 2015 00:50:08 +0200
Quoted 3 lines
The following patchset contains Netfilter/IPVS updates for your net-next tree. In sum, patches to address fallout from the previous round plus updates from the IPVS folks via Simon Horman, they are:
Pulled, thanks Pablo.