Skip to content

Commit a4efbaf

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== Netfilter updates for net-next The following patchset contains Netfilter updates for your net-next tree: 1) Use lockdep_is_held() in ipset_dereference_protected(), from Lance Roy. 2) Remove unused variable in cttimeout, from YueHaibing. 3) Add ttl option for nft_osf, from Fernando Fernandez Mancera. 4) Use xfrm family to deal with IPv6-in-IPv4 packets from nft_xfrm, from Florian Westphal. 5) Simplify xt_osf_match_packet(). 6) Missing ct helper alias definition in snmp_trap helper, from Taehee Yoo. 7) Remove unnecessary parameter in nf_flow_table_cleanup(), from Taehee Yoo. 8) Remove unused variable definitions in nft_{dup,fwd}, from Weongyo Jeong. 9) Remove empty net/netfilter/nfnetlink_log.h file, from Taehee Yoo. 10) Revert xt_quota updates remain option due to problems in the listing path for 32-bit arches, from Maze. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 4c16128 + af510eb commit a4efbaf

File tree

17 files changed

+92
-79
lines changed

17 files changed

+92
-79
lines changed

include/linux/netfilter/nfnetlink_osf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ bool nf_osf_match(const struct sk_buff *skb, u_int8_t family,
2727
const struct list_head *nf_osf_fingers);
2828

2929
const char *nf_osf_find(const struct sk_buff *skb,
30-
const struct list_head *nf_osf_fingers);
30+
const struct list_head *nf_osf_fingers,
31+
const int ttl_check);
3132

3233
#endif /* _NFOSF_H */

include/net/netfilter/nf_flow_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int nf_flow_table_iterate(struct nf_flowtable *flow_table,
9999
void (*iter)(struct flow_offload *flow, void *data),
100100
void *data);
101101

102-
void nf_flow_table_cleanup(struct net *net, struct net_device *dev);
102+
void nf_flow_table_cleanup(struct net_device *dev);
103103

104104
int nf_flow_table_init(struct nf_flowtable *flow_table);
105105
void nf_flow_table_free(struct nf_flowtable *flow_table);

include/net/netfilter/nfnetlink_log.h

Lines changed: 0 additions & 1 deletion
This file was deleted.

include/uapi/linux/netfilter/nf_tables.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,9 +1511,16 @@ enum nft_flowtable_hook_attributes {
15111511
};
15121512
#define NFTA_FLOWTABLE_HOOK_MAX (__NFTA_FLOWTABLE_HOOK_MAX - 1)
15131513

1514+
/**
1515+
* enum nft_osf_attributes - nftables osf expression netlink attributes
1516+
*
1517+
* @NFTA_OSF_DREG: destination register (NLA_U32: nft_registers)
1518+
* @NFTA_OSF_TTL: Value of the TTL osf option (NLA_U8)
1519+
*/
15141520
enum nft_osf_attributes {
15151521
NFTA_OSF_UNSPEC,
15161522
NFTA_OSF_DREG,
1523+
NFTA_OSF_TTL,
15171524
__NFTA_OSF_MAX,
15181525
};
15191526
#define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1)

include/uapi/linux/netfilter/xt_quota.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ struct xt_quota_info {
1515
__u32 flags;
1616
__u32 pad;
1717
__aligned_u64 quota;
18-
#ifdef __KERNEL__
19-
atomic64_t counter;
20-
#else
21-
__aligned_u64 remain;
22-
#endif
18+
19+
/* Used internally by the kernel */
20+
struct xt_quota_priv *master;
2321
};
2422

2523
#endif /* _XT_QUOTA_H */

net/ipv4/netfilter/nf_nat_snmp_basic_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ MODULE_LICENSE("GPL");
6060
MODULE_AUTHOR("James Morris <[email protected]>");
6161
MODULE_DESCRIPTION("Basic SNMP Application Layer Gateway");
6262
MODULE_ALIAS("ip_nat_snmp_basic");
63+
MODULE_ALIAS_NFCT_HELPER("snmp_trap");
6364

6465
#define SNMP_PORT 161
6566
#define SNMP_TRAP_PORT 162

net/netfilter/ipset/ip_set_hash_gen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define __ipset_dereference_protected(p, c) rcu_dereference_protected(p, c)
1717
#define ipset_dereference_protected(p, set) \
18-
__ipset_dereference_protected(p, spin_is_locked(&(set)->lock))
18+
__ipset_dereference_protected(p, lockdep_is_held(&(set)->lock))
1919

2020
#define rcu_dereference_bh_nfnl(p) rcu_dereference_bh_check(p, 1)
2121

net/netfilter/nf_flow_table_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static void nf_flow_table_iterate_cleanup(struct nf_flowtable *flowtable,
483483
flush_delayed_work(&flowtable->gc_work);
484484
}
485485

486-
void nf_flow_table_cleanup(struct net *net, struct net_device *dev)
486+
void nf_flow_table_cleanup(struct net_device *dev)
487487
{
488488
struct nf_flowtable *flowtable;
489489

net/netfilter/nfnetlink_cttimeout.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ static int cttimeout_default_set(struct net *net, struct sock *ctnl,
350350
struct netlink_ext_ack *extack)
351351
{
352352
const struct nf_conntrack_l4proto *l4proto;
353-
__u16 l3num;
354353
__u8 l4num;
355354
int ret;
356355

@@ -359,7 +358,6 @@ static int cttimeout_default_set(struct net *net, struct sock *ctnl,
359358
!cda[CTA_TIMEOUT_DATA])
360359
return -EINVAL;
361360

362-
l3num = ntohs(nla_get_be16(cda[CTA_TIMEOUT_L3PROTO]));
363361
l4num = nla_get_u8(cda[CTA_TIMEOUT_L4PROTO]);
364362
l4proto = nf_ct_l4proto_find_get(l4num);
365363

net/netfilter/nfnetlink_osf.c

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,27 @@ EXPORT_SYMBOL_GPL(nf_osf_fingers);
3030
static inline int nf_osf_ttl(const struct sk_buff *skb,
3131
int ttl_check, unsigned char f_ttl)
3232
{
33+
struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
3334
const struct iphdr *ip = ip_hdr(skb);
34-
35-
if (ttl_check != -1) {
36-
if (ttl_check == NF_OSF_TTL_TRUE)
37-
return ip->ttl == f_ttl;
38-
if (ttl_check == NF_OSF_TTL_NOCHECK)
39-
return 1;
40-
else if (ip->ttl <= f_ttl)
41-
return 1;
42-
else {
43-
struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
44-
int ret = 0;
45-
46-
for_ifa(in_dev) {
47-
if (inet_ifa_match(ip->saddr, ifa)) {
48-
ret = (ip->ttl == f_ttl);
49-
break;
50-
}
51-
}
52-
endfor_ifa(in_dev);
53-
54-
return ret;
35+
int ret = 0;
36+
37+
if (ttl_check == NF_OSF_TTL_TRUE)
38+
return ip->ttl == f_ttl;
39+
if (ttl_check == NF_OSF_TTL_NOCHECK)
40+
return 1;
41+
else if (ip->ttl <= f_ttl)
42+
return 1;
43+
44+
for_ifa(in_dev) {
45+
if (inet_ifa_match(ip->saddr, ifa)) {
46+
ret = (ip->ttl == f_ttl);
47+
break;
5548
}
5649
}
5750

58-
return ip->ttl == f_ttl;
51+
endfor_ifa(in_dev);
52+
53+
return ret;
5954
}
6055

6156
struct nf_osf_hdr_ctx {
@@ -213,7 +208,7 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family,
213208
if (!tcp)
214209
return false;
215210

216-
ttl_check = (info->flags & NF_OSF_TTL) ? info->ttl : -1;
211+
ttl_check = (info->flags & NF_OSF_TTL) ? info->ttl : 0;
217212

218213
list_for_each_entry_rcu(kf, &nf_osf_fingers[ctx.df], finger_entry) {
219214

@@ -257,7 +252,8 @@ nf_osf_match(const struct sk_buff *skb, u_int8_t family,
257252
EXPORT_SYMBOL_GPL(nf_osf_match);
258253

259254
const char *nf_osf_find(const struct sk_buff *skb,
260-
const struct list_head *nf_osf_fingers)
255+
const struct list_head *nf_osf_fingers,
256+
const int ttl_check)
261257
{
262258
const struct iphdr *ip = ip_hdr(skb);
263259
const struct nf_osf_user_finger *f;
@@ -275,7 +271,7 @@ const char *nf_osf_find(const struct sk_buff *skb,
275271

276272
list_for_each_entry_rcu(kf, &nf_osf_fingers[ctx.df], finger_entry) {
277273
f = &kf->finger;
278-
if (!nf_osf_match_one(skb, f, -1, &ctx))
274+
if (!nf_osf_match_one(skb, f, ttl_check, &ctx))
279275
continue;
280276

281277
genre = f->genre;

0 commit comments

Comments
 (0)