mirror of https://gitee.com/openkylin/linux.git
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter updates for net-next 1) UAF in chain binding support from previous batch, from Dan Carpenter. 2) Queue up delayed work to expire connections with no destination, from Andrew Sy Kim. 3) Use fallthrough pseudo-keyword, from Gustavo A. R. Silva. 4) Replace HTTP links with HTTPS, from Alexander A. Klimov. 5) Remove superfluous null header checks in ip6tables, from Gaurav Singh. 6) Add extended netlink error reporting for expression. 7) Report EEXIST on overlapping chain, set elements and flowtable devices. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
f2e0b29a9a
|
@ -14,6 +14,7 @@
|
|||
#include <linux/spinlock.h> /* for struct rwlock_t */
|
||||
#include <linux/atomic.h> /* for struct atomic_t */
|
||||
#include <linux/refcount.h> /* for struct refcount_t */
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/timer.h>
|
||||
|
@ -886,6 +887,8 @@ struct netns_ipvs {
|
|||
atomic_t conn_out_counter;
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
/* delayed work for expiring no dest connections */
|
||||
struct delayed_work expire_nodest_conn_work;
|
||||
/* 1/rate drop and drop-entry variables */
|
||||
struct delayed_work defense_work; /* Work handler */
|
||||
int drop_rate;
|
||||
|
@ -1051,6 +1054,11 @@ static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs)
|
|||
return ipvs->sysctl_conn_reuse_mode;
|
||||
}
|
||||
|
||||
static inline int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs)
|
||||
{
|
||||
return ipvs->sysctl_expire_nodest_conn;
|
||||
}
|
||||
|
||||
static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs)
|
||||
{
|
||||
return ipvs->sysctl_schedule_icmp;
|
||||
|
@ -1138,6 +1146,11 @@ static inline int sysctl_conn_reuse_mode(struct netns_ipvs *ipvs)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int sysctl_schedule_icmp(struct netns_ipvs *ipvs)
|
||||
{
|
||||
return 0;
|
||||
|
@ -1507,6 +1520,22 @@ static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
|
|||
static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
/* Enqueue delayed work for expiring no dest connections
|
||||
* Only run when sysctl_expire_nodest=1
|
||||
*/
|
||||
static inline void ip_vs_enqueue_expire_nodest_conns(struct netns_ipvs *ipvs)
|
||||
{
|
||||
if (sysctl_expire_nodest_conn(ipvs))
|
||||
queue_delayed_work(system_long_wq,
|
||||
&ipvs->expire_nodest_conn_work, 1);
|
||||
}
|
||||
|
||||
void ip_vs_expire_nodest_conn_flush(struct netns_ipvs *ipvs);
|
||||
#else
|
||||
static inline void ip_vs_enqueue_expire_nodest_conns(struct netns_ipvs *ipvs) {}
|
||||
#endif
|
||||
|
||||
#define IP_VS_DFWD_METHOD(dest) (atomic_read(&(dest)->conn_flags) & \
|
||||
IP_VS_CONN_F_FWD_MASK)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
|
||||
/* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
|
||||
* by Henrik Nordstrom <hno@marasystems.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1852,7 +1852,7 @@ static int compat_mtw_from_user(const struct compat_ebt_entry_mwt *mwt,
|
|||
size_kern = match_size;
|
||||
module_put(match->me);
|
||||
break;
|
||||
case EBT_COMPAT_WATCHER: /* fallthrough */
|
||||
case EBT_COMPAT_WATCHER:
|
||||
case EBT_COMPAT_TARGET:
|
||||
wt = xt_request_find_target(NFPROTO_BRIDGE, name,
|
||||
mwt->u.revision);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* DECnet Routing Message Grabulator
|
||||
*
|
||||
* (C) 2000 ChyGwyn Limited - http://www.chygwyn.com/
|
||||
* (C) 2000 ChyGwyn Limited - https://www.chygwyn.com/
|
||||
*
|
||||
* Author: Steven Whitehouse <steve@chygwyn.com>
|
||||
*/
|
||||
|
|
|
@ -74,8 +74,7 @@ static bool ah_mt6(const struct sk_buff *skb, struct xt_action_param *par)
|
|||
ahinfo->hdrres, ah->reserved,
|
||||
!(ahinfo->hdrres && ah->reserved));
|
||||
|
||||
return (ah != NULL) &&
|
||||
spi_match(ahinfo->spis[0], ahinfo->spis[1],
|
||||
return spi_match(ahinfo->spis[0], ahinfo->spis[1],
|
||||
ntohl(ah->spi),
|
||||
!!(ahinfo->invflags & IP6T_AH_INV_SPI)) &&
|
||||
(!ahinfo->hdrlen ||
|
||||
|
|
|
@ -85,8 +85,7 @@ frag_mt6(const struct sk_buff *skb, struct xt_action_param *par)
|
|||
!((fraginfo->flags & IP6T_FRAG_NMF) &&
|
||||
(ntohs(fh->frag_off) & IP6_MF)));
|
||||
|
||||
return (fh != NULL) &&
|
||||
id_match(fraginfo->ids[0], fraginfo->ids[1],
|
||||
return id_match(fraginfo->ids[0], fraginfo->ids[1],
|
||||
ntohl(fh->identification),
|
||||
!!(fraginfo->invflags & IP6T_FRAG_INV_IDS)) &&
|
||||
!((fraginfo->flags & IP6T_FRAG_RES) &&
|
||||
|
|
|
@ -86,8 +86,7 @@ hbh_mt6(const struct sk_buff *skb, struct xt_action_param *par)
|
|||
((optinfo->hdrlen == hdrlen) ^
|
||||
!!(optinfo->invflags & IP6T_OPTS_INV_LEN))));
|
||||
|
||||
ret = (oh != NULL) &&
|
||||
(!(optinfo->flags & IP6T_OPTS_LEN) ||
|
||||
ret = (!(optinfo->flags & IP6T_OPTS_LEN) ||
|
||||
((optinfo->hdrlen == hdrlen) ^
|
||||
!!(optinfo->invflags & IP6T_OPTS_INV_LEN)));
|
||||
|
||||
|
|
|
@ -89,8 +89,7 @@ static bool rt_mt6(const struct sk_buff *skb, struct xt_action_param *par)
|
|||
!((rtinfo->flags & IP6T_RT_RES) &&
|
||||
(((const struct rt0_hdr *)rh)->reserved)));
|
||||
|
||||
ret = (rh != NULL) &&
|
||||
(segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
|
||||
ret = (segsleft_match(rtinfo->segsleft[0], rtinfo->segsleft[1],
|
||||
rh->segments_left,
|
||||
!!(rtinfo->invflags & IP6T_RT_INV_SGS))) &&
|
||||
(!(rtinfo->flags & IP6T_RT_LEN) ||
|
||||
|
|
|
@ -447,7 +447,7 @@ config NF_TABLES
|
|||
replace the existing {ip,ip6,arp,eb}_tables infrastructure. It
|
||||
provides a pseudo-state machine with an extensible instruction-set
|
||||
(also known as expressions) that the userspace 'nft' utility
|
||||
(http://www.netfilter.org/projects/nftables) uses to build the
|
||||
(https://www.netfilter.org/projects/nftables) uses to build the
|
||||
rule-set. It also comes with the generic set infrastructure that
|
||||
allows you to construct mappings between matchings and actions
|
||||
for performance lookups.
|
||||
|
|
|
@ -1644,7 +1644,7 @@ ip_set_dump_do(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
goto next_set;
|
||||
if (set->variant->uref)
|
||||
set->variant->uref(set, cb, true);
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
default:
|
||||
ret = set->variant->list(set, skb, cb);
|
||||
if (!cb->args[IPSET_CB_ARG0])
|
||||
|
|
|
@ -1389,6 +1389,45 @@ static void ip_vs_conn_flush(struct netns_ipvs *ipvs)
|
|||
goto flush_again;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
void ip_vs_expire_nodest_conn_flush(struct netns_ipvs *ipvs)
|
||||
{
|
||||
int idx;
|
||||
struct ip_vs_conn *cp, *cp_c;
|
||||
struct ip_vs_dest *dest;
|
||||
|
||||
rcu_read_lock();
|
||||
for (idx = 0; idx < ip_vs_conn_tab_size; idx++) {
|
||||
hlist_for_each_entry_rcu(cp, &ip_vs_conn_tab[idx], c_list) {
|
||||
if (cp->ipvs != ipvs)
|
||||
continue;
|
||||
|
||||
dest = cp->dest;
|
||||
if (!dest || (dest->flags & IP_VS_DEST_F_AVAILABLE))
|
||||
continue;
|
||||
|
||||
if (atomic_read(&cp->n_control))
|
||||
continue;
|
||||
|
||||
cp_c = cp->control;
|
||||
IP_VS_DBG(4, "del connection\n");
|
||||
ip_vs_conn_del(cp);
|
||||
if (cp_c && !atomic_read(&cp_c->n_control)) {
|
||||
IP_VS_DBG(4, "del controlling connection\n");
|
||||
ip_vs_conn_del(cp_c);
|
||||
}
|
||||
}
|
||||
cond_resched_rcu();
|
||||
|
||||
/* netns clean up started, abort delayed work */
|
||||
if (!ipvs->enable)
|
||||
break;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* per netns init and exit
|
||||
*/
|
||||
|
|
|
@ -694,16 +694,10 @@ static int sysctl_nat_icmp_send(struct netns_ipvs *ipvs)
|
|||
return ipvs->sysctl_nat_icmp_send;
|
||||
}
|
||||
|
||||
static int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs)
|
||||
{
|
||||
return ipvs->sysctl_expire_nodest_conn;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static int sysctl_snat_reroute(struct netns_ipvs *ipvs) { return 0; }
|
||||
static int sysctl_nat_icmp_send(struct netns_ipvs *ipvs) { return 0; }
|
||||
static int sysctl_expire_nodest_conn(struct netns_ipvs *ipvs) { return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -2097,6 +2091,26 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int
|
|||
}
|
||||
}
|
||||
|
||||
/* Check the server status */
|
||||
if (cp && cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) {
|
||||
/* the destination server is not available */
|
||||
if (sysctl_expire_nodest_conn(ipvs)) {
|
||||
bool old_ct = ip_vs_conn_uses_old_conntrack(cp, skb);
|
||||
|
||||
if (!old_ct)
|
||||
cp->flags &= ~IP_VS_CONN_F_NFCT;
|
||||
|
||||
ip_vs_conn_expire_now(cp);
|
||||
__ip_vs_conn_put(cp);
|
||||
if (old_ct)
|
||||
return NF_DROP;
|
||||
cp = NULL;
|
||||
} else {
|
||||
__ip_vs_conn_put(cp);
|
||||
return NF_DROP;
|
||||
}
|
||||
}
|
||||
|
||||
if (unlikely(!cp)) {
|
||||
int v;
|
||||
|
||||
|
@ -2106,27 +2120,6 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int
|
|||
|
||||
IP_VS_DBG_PKT(11, af, pp, skb, iph.off, "Incoming packet");
|
||||
|
||||
/* Check the server status */
|
||||
if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) {
|
||||
/* the destination server is not available */
|
||||
|
||||
__u32 flags = cp->flags;
|
||||
|
||||
/* when timer already started, silently drop the packet.*/
|
||||
if (timer_pending(&cp->timer))
|
||||
__ip_vs_conn_put(cp);
|
||||
else
|
||||
ip_vs_conn_put(cp);
|
||||
|
||||
if (sysctl_expire_nodest_conn(ipvs) &&
|
||||
!(flags & IP_VS_CONN_F_ONE_PACKET)) {
|
||||
/* try to expire the connection immediately */
|
||||
ip_vs_conn_expire_now(cp);
|
||||
}
|
||||
|
||||
return NF_DROP;
|
||||
}
|
||||
|
||||
ip_vs_in_stats(cp, skb);
|
||||
ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd);
|
||||
if (cp->packet_xmit)
|
||||
|
|
|
@ -210,6 +210,17 @@ static void update_defense_level(struct netns_ipvs *ipvs)
|
|||
local_bh_enable();
|
||||
}
|
||||
|
||||
/* Handler for delayed work for expiring no
|
||||
* destination connections
|
||||
*/
|
||||
static void expire_nodest_conn_handler(struct work_struct *work)
|
||||
{
|
||||
struct netns_ipvs *ipvs;
|
||||
|
||||
ipvs = container_of(work, struct netns_ipvs,
|
||||
expire_nodest_conn_work.work);
|
||||
ip_vs_expire_nodest_conn_flush(ipvs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for checking the defense
|
||||
|
@ -1164,6 +1175,12 @@ static void __ip_vs_del_dest(struct netns_ipvs *ipvs, struct ip_vs_dest *dest,
|
|||
list_add(&dest->t_list, &ipvs->dest_trash);
|
||||
dest->idle_start = 0;
|
||||
spin_unlock_bh(&ipvs->dest_trash_lock);
|
||||
|
||||
/* Queue up delayed work to expire all no destination connections.
|
||||
* No-op when CONFIG_SYSCTL is disabled.
|
||||
*/
|
||||
if (!cleanup)
|
||||
ip_vs_enqueue_expire_nodest_conns(ipvs);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4086,6 +4103,10 @@ static int __net_init ip_vs_control_net_init_sysctl(struct netns_ipvs *ipvs)
|
|||
queue_delayed_work(system_long_wq, &ipvs->defense_work,
|
||||
DEFENSE_TIMER_PERIOD);
|
||||
|
||||
/* Init delayed work for expiring no dest conn */
|
||||
INIT_DELAYED_WORK(&ipvs->expire_nodest_conn_work,
|
||||
expire_nodest_conn_handler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4093,6 +4114,7 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs)
|
|||
{
|
||||
struct net *net = ipvs->net;
|
||||
|
||||
cancel_delayed_work_sync(&ipvs->expire_nodest_conn_work);
|
||||
cancel_delayed_work_sync(&ipvs->defense_work);
|
||||
cancel_work_sync(&ipvs->defense_work.work);
|
||||
unregister_net_sysctl_table(ipvs->sysctl_hdr);
|
||||
|
|
|
@ -257,15 +257,15 @@ static unsigned int get_uint(struct bitstr *bs, int b)
|
|||
case 4:
|
||||
v |= *bs->cur++;
|
||||
v <<= 8;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case 3:
|
||||
v |= *bs->cur++;
|
||||
v <<= 8;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case 2:
|
||||
v |= *bs->cur++;
|
||||
v <<= 8;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case 1:
|
||||
v |= *bs->cur++;
|
||||
break;
|
||||
|
|
|
@ -610,7 +610,7 @@ void nf_ct_netns_put(struct net *net, uint8_t nfproto)
|
|||
switch (nfproto) {
|
||||
case NFPROTO_BRIDGE:
|
||||
nf_ct_netns_do_put(net, NFPROTO_BRIDGE);
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFPROTO_INET:
|
||||
nf_ct_netns_do_put(net, NFPROTO_IPV4);
|
||||
nf_ct_netns_do_put(net, NFPROTO_IPV6);
|
||||
|
|
|
@ -900,7 +900,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
|
|||
return -NF_REPEAT;
|
||||
return NF_DROP;
|
||||
}
|
||||
/* Fall through */
|
||||
fallthrough;
|
||||
case TCP_CONNTRACK_IGNORE:
|
||||
/* Ignored packets:
|
||||
*
|
||||
|
|
|
@ -60,7 +60,7 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
|
|||
ntohs(tuple->src.u.tcp.port),
|
||||
ntohs(tuple->dst.u.tcp.port));
|
||||
break;
|
||||
case IPPROTO_UDPLITE: /* fallthrough */
|
||||
case IPPROTO_UDPLITE:
|
||||
case IPPROTO_UDP:
|
||||
seq_printf(s, "sport=%hu dport=%hu ",
|
||||
ntohs(tuple->src.u.udp.port),
|
||||
|
|
|
@ -408,7 +408,7 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
|
|||
static const unsigned int max_attempts = 128;
|
||||
|
||||
switch (tuple->dst.protonum) {
|
||||
case IPPROTO_ICMP: /* fallthrough */
|
||||
case IPPROTO_ICMP:
|
||||
case IPPROTO_ICMPV6:
|
||||
/* id is same for either direction... */
|
||||
keyptr = &tuple->src.u.icmp.id;
|
||||
|
@ -442,11 +442,11 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple,
|
|||
}
|
||||
goto find_free_id;
|
||||
#endif
|
||||
case IPPROTO_UDP: /* fallthrough */
|
||||
case IPPROTO_UDPLITE: /* fallthrough */
|
||||
case IPPROTO_TCP: /* fallthrough */
|
||||
case IPPROTO_SCTP: /* fallthrough */
|
||||
case IPPROTO_DCCP: /* fallthrough */
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_UDPLITE:
|
||||
case IPPROTO_TCP:
|
||||
case IPPROTO_SCTP:
|
||||
case IPPROTO_DCCP:
|
||||
if (maniptype == NF_NAT_MANIP_SRC)
|
||||
keyptr = &tuple->src.u.all;
|
||||
else
|
||||
|
|
|
@ -704,8 +704,7 @@ ipv4_synproxy_hook(void *priv, struct sk_buff *skb,
|
|||
nf_ct_seqadj_init(ct, ctinfo, 0);
|
||||
synproxy->tsoff = 0;
|
||||
this_cpu_inc(snet->stats->conn_reopened);
|
||||
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case TCP_CONNTRACK_SYN_SENT:
|
||||
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
||||
return NF_DROP;
|
||||
|
@ -1128,8 +1127,7 @@ ipv6_synproxy_hook(void *priv, struct sk_buff *skb,
|
|||
nf_ct_seqadj_init(ct, ctinfo, 0);
|
||||
synproxy->tsoff = 0;
|
||||
this_cpu_inc(snet->stats->conn_reopened);
|
||||
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case TCP_CONNTRACK_SYN_SENT:
|
||||
if (!synproxy_parse_options(skb, thoff, th, &opts))
|
||||
return NF_DROP;
|
||||
|
|
|
@ -2084,7 +2084,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
|
|||
|
||||
if (nla[NFTA_CHAIN_HOOK]) {
|
||||
if (!nft_is_base_chain(chain))
|
||||
return -EBUSY;
|
||||
return -EEXIST;
|
||||
|
||||
err = nft_chain_parse_hook(ctx->net, nla, &hook, ctx->family,
|
||||
false);
|
||||
|
@ -2094,21 +2094,21 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy,
|
|||
basechain = nft_base_chain(chain);
|
||||
if (basechain->type != hook.type) {
|
||||
nft_chain_release_hook(&hook);
|
||||
return -EBUSY;
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
if (ctx->family == NFPROTO_NETDEV) {
|
||||
if (!nft_hook_list_equal(&basechain->hook_list,
|
||||
&hook.list)) {
|
||||
nft_chain_release_hook(&hook);
|
||||
return -EBUSY;
|
||||
return -EEXIST;
|
||||
}
|
||||
} else {
|
||||
ops = &basechain->ops;
|
||||
if (ops->hooknum != hook.num ||
|
||||
ops->priority != hook.priority) {
|
||||
nft_chain_release_hook(&hook);
|
||||
return -EBUSY;
|
||||
return -EEXIST;
|
||||
}
|
||||
}
|
||||
nft_chain_release_hook(&hook);
|
||||
|
@ -2496,6 +2496,7 @@ int nft_expr_dump(struct sk_buff *skb, unsigned int attr,
|
|||
|
||||
struct nft_expr_info {
|
||||
const struct nft_expr_ops *ops;
|
||||
const struct nlattr *attr;
|
||||
struct nlattr *tb[NFT_EXPR_MAXATTR + 1];
|
||||
};
|
||||
|
||||
|
@ -2543,7 +2544,9 @@ static int nf_tables_expr_parse(const struct nft_ctx *ctx,
|
|||
} else
|
||||
ops = type->ops;
|
||||
|
||||
info->attr = nla;
|
||||
info->ops = ops;
|
||||
|
||||
return 0;
|
||||
|
||||
err1:
|
||||
|
@ -3201,8 +3204,10 @@ static int nf_tables_newrule(struct net *net, struct sock *nlsk,
|
|||
expr = nft_expr_first(rule);
|
||||
for (i = 0; i < n; i++) {
|
||||
err = nf_tables_newexpr(&ctx, &info[i], expr);
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
NL_SET_BAD_ATTR(extack, info[i].attr);
|
||||
goto err2;
|
||||
}
|
||||
|
||||
if (info[i].ops->validate)
|
||||
nft_validate_state_update(net, NFT_VALIDATE_NEED);
|
||||
|
@ -4362,7 +4367,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,
|
|||
case NFT_TRANS_ABORT:
|
||||
case NFT_TRANS_RELEASE:
|
||||
set->use--;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
default:
|
||||
nf_tables_unbind_set(ctx, set, binding,
|
||||
phase == NFT_TRANS_COMMIT);
|
||||
|
@ -5244,10 +5249,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
|
|||
if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA) ^
|
||||
nft_set_ext_exists(ext2, NFT_SET_EXT_DATA) ||
|
||||
nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF) ^
|
||||
nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF)) {
|
||||
err = -EBUSY;
|
||||
nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF))
|
||||
goto err_element_clash;
|
||||
}
|
||||
if ((nft_set_ext_exists(ext, NFT_SET_EXT_DATA) &&
|
||||
nft_set_ext_exists(ext2, NFT_SET_EXT_DATA) &&
|
||||
memcmp(nft_set_ext_data(ext),
|
||||
|
@ -5255,7 +5258,7 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
|
|||
(nft_set_ext_exists(ext, NFT_SET_EXT_OBJREF) &&
|
||||
nft_set_ext_exists(ext2, NFT_SET_EXT_OBJREF) &&
|
||||
*nft_set_ext_obj(ext) != *nft_set_ext_obj(ext2)))
|
||||
err = -EBUSY;
|
||||
goto err_element_clash;
|
||||
else if (!(nlmsg_flags & NLM_F_EXCL))
|
||||
err = 0;
|
||||
} else if (err == -ENOTEMPTY) {
|
||||
|
@ -6243,7 +6246,7 @@ void nf_tables_deactivate_flowtable(const struct nft_ctx *ctx,
|
|||
case NFT_TRANS_ABORT:
|
||||
case NFT_TRANS_RELEASE:
|
||||
flowtable->use--;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -6405,7 +6408,7 @@ static int nft_register_flowtable_net_hooks(struct net *net,
|
|||
list_for_each_entry(hook2, &ft->hook_list, list) {
|
||||
if (hook->ops.dev == hook2->ops.dev &&
|
||||
hook->ops.pf == hook2->ops.pf) {
|
||||
err = -EBUSY;
|
||||
err = -EEXIST;
|
||||
goto err_unregister_net_hooks;
|
||||
}
|
||||
}
|
||||
|
@ -7249,7 +7252,7 @@ static int nf_tables_validate(struct net *net)
|
|||
break;
|
||||
case NFT_VALIDATE_NEED:
|
||||
nft_validate_state_update(net, NFT_VALIDATE_DO);
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFT_VALIDATE_DO:
|
||||
list_for_each_entry(table, &net->nft.tables, list) {
|
||||
if (nft_table_validate(net, table) < 0)
|
||||
|
@ -8323,7 +8326,7 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
|
|||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFT_CONTINUE:
|
||||
case NFT_BREAK:
|
||||
case NFT_RETURN:
|
||||
|
|
|
@ -213,7 +213,7 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv)
|
|||
jumpstack[stackptr].chain = chain;
|
||||
jumpstack[stackptr].rules = rules + 1;
|
||||
stackptr++;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFT_GOTO:
|
||||
nft_trace_packet(&info, chain, rule,
|
||||
NFT_TRACETYPE_RULE);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* (C) 2011 Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
* (C) 2011 Intra2net AG <http://www.intra2net.com>
|
||||
* (C) 2011 Intra2net AG <https://www.intra2net.com>
|
||||
*/
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
|
|
|
@ -451,7 +451,7 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl,
|
|||
case IPPROTO_TCP:
|
||||
timeouts = nf_tcp_pernet(net)->timeouts;
|
||||
break;
|
||||
case IPPROTO_UDP: /* fallthrough */
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_UDPLITE:
|
||||
timeouts = nf_udp_pernet(net)->timeouts;
|
||||
break;
|
||||
|
|
|
@ -43,7 +43,7 @@ void nft_cmp_eval(const struct nft_expr *expr,
|
|||
case NFT_CMP_LT:
|
||||
if (d == 0)
|
||||
goto mismatch;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFT_CMP_LTE:
|
||||
if (d > 0)
|
||||
goto mismatch;
|
||||
|
@ -51,7 +51,7 @@ void nft_cmp_eval(const struct nft_expr *expr,
|
|||
case NFT_CMP_GT:
|
||||
if (d == 0)
|
||||
goto mismatch;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case NFT_CMP_GTE:
|
||||
if (d < 0)
|
||||
goto mismatch;
|
||||
|
|
|
@ -129,7 +129,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
case NFT_CT_BYTES: /* fallthrough */
|
||||
case NFT_CT_BYTES:
|
||||
case NFT_CT_PKTS: {
|
||||
const struct nf_conn_acct *acct = nf_conn_acct_find(ct);
|
||||
u64 count = 0;
|
||||
|
@ -1013,8 +1013,8 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,
|
|||
help6 = nf_conntrack_helper_try_module_get(name, family,
|
||||
priv->l4proto);
|
||||
break;
|
||||
case NFPROTO_NETDEV: /* fallthrough */
|
||||
case NFPROTO_BRIDGE: /* same */
|
||||
case NFPROTO_NETDEV:
|
||||
case NFPROTO_BRIDGE:
|
||||
case NFPROTO_INET:
|
||||
help4 = nf_conntrack_helper_try_module_get(name, NFPROTO_IPV4,
|
||||
priv->l4proto);
|
||||
|
|
|
@ -32,7 +32,7 @@ int nft_fib_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
|
|||
unsigned int hooks;
|
||||
|
||||
switch (priv->result) {
|
||||
case NFT_FIB_RESULT_OIF: /* fallthrough */
|
||||
case NFT_FIB_RESULT_OIF:
|
||||
case NFT_FIB_RESULT_OIFNAME:
|
||||
hooks = (1 << NF_INET_PRE_ROUTING);
|
||||
break;
|
||||
|
|
|
@ -103,9 +103,9 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx,
|
|||
{
|
||||
const struct nft_immediate_expr *priv = nft_expr_priv(expr);
|
||||
const struct nft_data *data = &priv->data;
|
||||
struct nft_rule *rule, *n;
|
||||
struct nft_ctx chain_ctx;
|
||||
struct nft_chain *chain;
|
||||
struct nft_rule *rule;
|
||||
|
||||
if (priv->dreg != NFT_REG_VERDICT)
|
||||
return;
|
||||
|
@ -121,7 +121,7 @@ static void nft_immediate_destroy(const struct nft_ctx *ctx,
|
|||
chain_ctx = *ctx;
|
||||
chain_ctx.chain = chain;
|
||||
|
||||
list_for_each_entry(rule, &chain->rules, list)
|
||||
list_for_each_entry_safe(rule, n, &chain->rules, list)
|
||||
nf_tables_rule_release(&chain_ctx, rule);
|
||||
|
||||
nf_tables_chain_destroy(&chain_ctx);
|
||||
|
|
|
@ -467,7 +467,7 @@ static int nft_payload_l4csum_offset(const struct nft_pktinfo *pkt,
|
|||
case IPPROTO_UDP:
|
||||
if (!nft_payload_udp_checksum(skb, pkt->xt.thoff))
|
||||
return -1;
|
||||
/* Fall through. */
|
||||
fallthrough;
|
||||
case IPPROTO_UDPLITE:
|
||||
*l4csum_offset = offsetof(struct udphdr, check);
|
||||
break;
|
||||
|
|
|
@ -312,7 +312,7 @@
|
|||
* Jay Ligatti, Josh Kuhn, and Chris Gage.
|
||||
* Proceedings of the IEEE International Conference on Computer
|
||||
* Communication Networks (ICCCN), August 2010.
|
||||
* http://www.cse.usf.edu/~ligatti/papers/grouper-conf.pdf
|
||||
* https://www.cse.usf.edu/~ligatti/papers/grouper-conf.pdf
|
||||
*
|
||||
* [Rottenstreich 2010]
|
||||
* Worst-Case TCAM Rule Expansion
|
||||
|
@ -325,7 +325,7 @@
|
|||
* Kirill Kogan, Sergey Nikolenko, Ori Rottenstreich, William Culhane,
|
||||
* and Patrick Eugster.
|
||||
* Proceedings of the 2014 ACM conference on SIGCOMM, August 2014.
|
||||
* http://www.sigcomm.org/sites/default/files/ccr/papers/2014/August/2619239-2626294.pdf
|
||||
* https://www.sigcomm.org/sites/default/files/ccr/papers/2014/August/2619239-2626294.pdf
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
|
|
@ -25,7 +25,7 @@ __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
|
|||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case CHECKSUM_NONE:
|
||||
if (protocol != IPPROTO_TCP && protocol != IPPROTO_UDP)
|
||||
skb->csum = 0;
|
||||
|
@ -51,7 +51,7 @@ static __sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook,
|
|||
case CHECKSUM_COMPLETE:
|
||||
if (len == skb->len - dataoff)
|
||||
return nf_ip_checksum(skb, hook, dataoff, protocol);
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case CHECKSUM_NONE:
|
||||
skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol,
|
||||
skb->len - dataoff, 0);
|
||||
|
@ -79,7 +79,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
|||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case CHECKSUM_NONE:
|
||||
skb->csum = ~csum_unfold(
|
||||
csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
|
||||
|
@ -106,7 +106,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
|
|||
case CHECKSUM_COMPLETE:
|
||||
if (len == skb->len - dataoff)
|
||||
return nf_ip6_checksum(skb, hook, dataoff, protocol);
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
case CHECKSUM_NONE:
|
||||
hsum = skb_checksum(skb, 0, dataoff, 0);
|
||||
skb->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr,
|
||||
|
|
|
@ -1571,7 +1571,7 @@ static void *xt_mttg_seq_next(struct seq_file *seq, void *v, loff_t *ppos,
|
|||
trav->curr = trav->curr->next;
|
||||
if (trav->curr != trav->head)
|
||||
break;
|
||||
/* fall through */
|
||||
fallthrough;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* with the SECMARK target and state match.
|
||||
*
|
||||
* Based somewhat on CONNMARK:
|
||||
* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
|
||||
* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
|
||||
* by Henrik Nordstrom <hno@marasystems.com>
|
||||
*
|
||||
* (C) 2006,2008 Red Hat, Inc., James Morris <jmorris@redhat.com>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
* xt_connmark - Netfilter module to operate on connection marks
|
||||
*
|
||||
* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
|
||||
* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
|
||||
* by Henrik Nordstrom <hno@marasystems.com>
|
||||
* Copyright © CC Computer Consultants GmbH, 2007 - 2008
|
||||
* Jan Engelhardt <jengelh@medozas.de>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* (C) 2011 Pablo Neira Ayuso <pablo@netfilter.org>
|
||||
* (C) 2011 Intra2net AG <http://www.intra2net.com>
|
||||
* (C) 2011 Intra2net AG <https://www.intra2net.com>
|
||||
*/
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* based on ipt_time by Fabrice MARIE <fabrice@netfilter.org>
|
||||
* This is a module which is used for time matching
|
||||
* It is using some modified code from dietlibc (localtime() function)
|
||||
* that you can find at http://www.fefe.de/dietlibc/
|
||||
* that you can find at https://www.fefe.de/dietlibc/
|
||||
* This file is distributed under the terms of the GNU General Public
|
||||
* License (GPL). Copies of the GPL can be obtained from gnu.org/gpl.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue