Skip to content

Commit 4e7df11

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter/IPVS updates for net-next The following patchset contains Netfilter/IPVS updates for net-next: 1) Add .release_ops to properly unroll .select_ops, use it from nft_compat. After this change, we can remove list of extensions too to simplify this codebase. 2) Update amanda conntrack helper to support v3.4, from Florian Tham. 3) Get rid of the obsolete BUGPRINT macro in ebtables, from Florian Westphal. 4) Merge IPv4 and IPv6 masquerading infrastructure into one single module. From Florian Westphal. 5) Patchset to remove nf_nat_l3proto structure to get rid of indirections, from Florian Westphal. 6) Skip unnecessary conntrack timeout updates in case the value is still the same, also from Florian Westphal. 7) Remove unnecessary 'fall through' comments in empty switch cases, from Li RongQing. 8) Fix lookup to fixed size hashtable sets on big endian with 32-bit keys. 9) Incorrect logic to deactivate path of fixed size hashtable sets, element was being tested to self. 10) Remove nft_hash_key(), the bitmap set is always selected for 16-bit keys. 11) Use boolean whenever possible in IPVS codebase, from Andrea Claudi. 12) Enter close state in conntrack if RST matches exact sequence number, from Florian Westphal. 13) Initialize dst_cache in tunnel extension, from wenxu. 14) Pass protocol as u16 to xt_check_match and xt_check_target, from Li RongQing. 15) SCTP header is granted to be in a linear area from IPVS NAT handler, from Xin Long. 16) Don't steal packets coming from slave VRF device from the ip_sabotage_in() path, from David Ahern. 17) Fix unsafe update of basechain stats, from Li RongQing. 18) Make sure CONNTRACK_LOCKS is power of 2 to let compiler optimize modulo operation as bitwise AND, from Li RongQing. 19) Use device_attribute instead of internal definition in the IDLETIMER target, from Sami Tolvanen. 20) Merge redir, masq and IPv4/IPv6 NAT chain types, from Florian Westphal. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2369afb + db8ab38 commit 4e7df11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1747
-2419
lines changed

include/linux/netfilter/x_tables.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ bool xt_find_jump_offset(const unsigned int *offsets,
289289

290290
int xt_check_proc_name(const char *name, unsigned int size);
291291

292-
int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
292+
int xt_check_match(struct xt_mtchk_param *, unsigned int size, u16 proto,
293293
bool inv_proto);
294-
int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
294+
int xt_check_target(struct xt_tgchk_param *, unsigned int size, u16 proto,
295295
bool inv_proto);
296296

297297
int xt_match_to_user(const struct xt_entry_match *m,

include/net/netfilter/nf_conntrack.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,23 +190,23 @@ bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
190190

191191
void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
192192
const struct sk_buff *skb,
193-
unsigned long extra_jiffies, int do_acct);
193+
u32 extra_jiffies, bool do_acct);
194194

195195
/* Refresh conntrack for this many jiffies and do accounting */
196196
static inline void nf_ct_refresh_acct(struct nf_conn *ct,
197197
enum ip_conntrack_info ctinfo,
198198
const struct sk_buff *skb,
199-
unsigned long extra_jiffies)
199+
u32 extra_jiffies)
200200
{
201-
__nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
201+
__nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, true);
202202
}
203203

204204
/* Refresh conntrack for this many jiffies */
205205
static inline void nf_ct_refresh(struct nf_conn *ct,
206206
const struct sk_buff *skb,
207-
unsigned long extra_jiffies)
207+
u32 extra_jiffies)
208208
{
209-
__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
209+
__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, false);
210210
}
211211

212212
/* kill conntrack and do accounting */

include/net/netfilter/nf_nat.h

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ struct nf_conn;
3131
/* The structure embedded in the conntrack structure. */
3232
struct nf_conn_nat {
3333
union nf_conntrack_nat_help help;
34-
#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV4) || \
35-
IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV6)
34+
#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE)
3635
int masq_index;
3736
#endif
3837
};
@@ -61,8 +60,7 @@ static inline bool nf_nat_oif_changed(unsigned int hooknum,
6160
struct nf_conn_nat *nat,
6261
const struct net_device *out)
6362
{
64-
#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV4) || \
65-
IS_ENABLED(CONFIG_NF_NAT_MASQUERADE_IPV6)
63+
#if IS_ENABLED(CONFIG_NF_NAT_MASQUERADE)
6664
return nat && nat->masq_index && hooknum == NF_INET_POST_ROUTING &&
6765
CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL &&
6866
nat->masq_index != out->ifindex;
@@ -75,4 +73,43 @@ int nf_nat_register_fn(struct net *net, const struct nf_hook_ops *ops,
7573
const struct nf_hook_ops *nat_ops, unsigned int ops_count);
7674
void nf_nat_unregister_fn(struct net *net, const struct nf_hook_ops *ops,
7775
unsigned int ops_count);
76+
77+
unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
78+
unsigned int hooknum, struct sk_buff *skb);
79+
80+
unsigned int nf_nat_manip_pkt(struct sk_buff *skb, struct nf_conn *ct,
81+
enum nf_nat_manip_type mtype,
82+
enum ip_conntrack_dir dir);
83+
void nf_nat_csum_recalc(struct sk_buff *skb,
84+
u8 nfproto, u8 proto, void *data, __sum16 *check,
85+
int datalen, int oldlen);
86+
87+
int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
88+
enum ip_conntrack_info ctinfo,
89+
unsigned int hooknum);
90+
91+
int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
92+
enum ip_conntrack_info ctinfo,
93+
unsigned int hooknum, unsigned int hdrlen);
94+
95+
int nf_nat_ipv4_register_fn(struct net *net, const struct nf_hook_ops *ops);
96+
void nf_nat_ipv4_unregister_fn(struct net *net, const struct nf_hook_ops *ops);
97+
98+
int nf_nat_ipv6_register_fn(struct net *net, const struct nf_hook_ops *ops);
99+
void nf_nat_ipv6_unregister_fn(struct net *net, const struct nf_hook_ops *ops);
100+
101+
unsigned int
102+
nf_nat_inet_fn(void *priv, struct sk_buff *skb,
103+
const struct nf_hook_state *state);
104+
105+
int nf_xfrm_me_harder(struct net *n, struct sk_buff *s, unsigned int family);
106+
107+
static inline int nf_nat_initialized(struct nf_conn *ct,
108+
enum nf_nat_manip_type manip)
109+
{
110+
if (manip == NF_NAT_MANIP_SRC)
111+
return ct->status & IPS_SRC_NAT_DONE;
112+
else
113+
return ct->status & IPS_DST_NAT_DONE;
114+
}
78115
#endif

include/net/netfilter/nf_nat_core.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

include/net/netfilter/nf_nat_l3proto.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

include/net/netfilter/nf_nat_l4proto.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

include/net/netfilter/nf_tables.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,12 @@ static inline void nft_set_gc_batch_add(struct nft_set_gc_batch *gcb,
690690
gcb->elems[gcb->head.cnt++] = elem;
691691
}
692692

693+
struct nft_expr_ops;
693694
/**
694695
* struct nft_expr_type - nf_tables expression type
695696
*
696697
* @select_ops: function to select nft_expr_ops
698+
* @release_ops: release nft_expr_ops
697699
* @ops: default ops, used when no select_ops functions is present
698700
* @list: used internally
699701
* @name: Identifier
@@ -706,6 +708,7 @@ static inline void nft_set_gc_batch_add(struct nft_set_gc_batch *gcb,
706708
struct nft_expr_type {
707709
const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *,
708710
const struct nlattr * const tb[]);
711+
void (*release_ops)(const struct nft_expr_ops *ops);
709712
const struct nft_expr_ops *ops;
710713
struct list_head list;
711714
const char *name;

include/net/netfilter/nft_masq.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

include/net/netfilter/nft_redir.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

net/bridge/br_netfilter_hooks.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,8 @@ static unsigned int ip_sabotage_in(void *priv,
831831
struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
832832

833833
if (nf_bridge && !nf_bridge->in_prerouting &&
834-
!netif_is_l3_master(skb->dev)) {
834+
!netif_is_l3_master(skb->dev) &&
835+
!netif_is_l3_slave(skb->dev)) {
835836
state->okfn(state->net, state->sk, skb);
836837
return NF_STOLEN;
837838
}

0 commit comments

Comments
 (0)