Skip to content

Commit 04ba724

Browse files
committed
netfilter: nfnetlink: extended ACK reporting
Pass down struct netlink_ext_ack as parameter to all of our nfnetlink subsystem callbacks, so we can work on follow up patches to provide finer grain error reporting using the new infrastructure that 2d4bc93 ("netlink: extended ACK reporting") provides. No functional change, just pass down this new object to callbacks. Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent d8297d4 commit 04ba724

File tree

12 files changed

+152
-76
lines changed

12 files changed

+152
-76
lines changed

include/linux/netfilter/nfnetlink.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef _NFNETLINK_H
22
#define _NFNETLINK_H
33

4-
54
#include <linux/netlink.h>
65
#include <linux/capability.h>
76
#include <net/netlink.h>
@@ -10,13 +9,16 @@
109
struct nfnl_callback {
1110
int (*call)(struct net *net, struct sock *nl, struct sk_buff *skb,
1211
const struct nlmsghdr *nlh,
13-
const struct nlattr * const cda[]);
12+
const struct nlattr * const cda[],
13+
struct netlink_ext_ack *extack);
1414
int (*call_rcu)(struct net *net, struct sock *nl, struct sk_buff *skb,
1515
const struct nlmsghdr *nlh,
16-
const struct nlattr * const cda[]);
16+
const struct nlattr * const cda[],
17+
struct netlink_ext_ack *extack);
1718
int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb,
1819
const struct nlmsghdr *nlh,
19-
const struct nlattr * const cda[]);
20+
const struct nlattr * const cda[],
21+
struct netlink_ext_ack *extack);
2022
const struct nla_policy *policy; /* netlink attribute policy */
2123
const u_int16_t attr_count; /* number of nlattr's */
2224
};

net/netfilter/ipset/ip_set_core.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,16 @@ find_free_id(struct ip_set_net *inst, const char *name, ip_set_id_t *index,
841841

842842
static int ip_set_none(struct net *net, struct sock *ctnl, struct sk_buff *skb,
843843
const struct nlmsghdr *nlh,
844-
const struct nlattr * const attr[])
844+
const struct nlattr * const attr[],
845+
struct netlink_ext_ack *extack)
845846
{
846847
return -EOPNOTSUPP;
847848
}
848849

849850
static int ip_set_create(struct net *net, struct sock *ctnl,
850851
struct sk_buff *skb, const struct nlmsghdr *nlh,
851-
const struct nlattr * const attr[])
852+
const struct nlattr * const attr[],
853+
struct netlink_ext_ack *extack)
852854
{
853855
struct ip_set_net *inst = ip_set_pernet(net);
854856
struct ip_set *set, *clash = NULL;
@@ -989,7 +991,8 @@ ip_set_destroy_set(struct ip_set *set)
989991

990992
static int ip_set_destroy(struct net *net, struct sock *ctnl,
991993
struct sk_buff *skb, const struct nlmsghdr *nlh,
992-
const struct nlattr * const attr[])
994+
const struct nlattr * const attr[],
995+
struct netlink_ext_ack *extack)
993996
{
994997
struct ip_set_net *inst = ip_set_pernet(net);
995998
struct ip_set *s;
@@ -1067,7 +1070,8 @@ ip_set_flush_set(struct ip_set *set)
10671070

10681071
static int ip_set_flush(struct net *net, struct sock *ctnl, struct sk_buff *skb,
10691072
const struct nlmsghdr *nlh,
1070-
const struct nlattr * const attr[])
1073+
const struct nlattr * const attr[],
1074+
struct netlink_ext_ack *extack)
10711075
{
10721076
struct ip_set_net *inst = ip_set_pernet(net);
10731077
struct ip_set *s;
@@ -1106,7 +1110,8 @@ ip_set_setname2_policy[IPSET_ATTR_CMD_MAX + 1] = {
11061110

11071111
static int ip_set_rename(struct net *net, struct sock *ctnl,
11081112
struct sk_buff *skb, const struct nlmsghdr *nlh,
1109-
const struct nlattr * const attr[])
1113+
const struct nlattr * const attr[],
1114+
struct netlink_ext_ack *extack)
11101115
{
11111116
struct ip_set_net *inst = ip_set_pernet(net);
11121117
struct ip_set *set, *s;
@@ -1155,7 +1160,8 @@ static int ip_set_rename(struct net *net, struct sock *ctnl,
11551160

11561161
static int ip_set_swap(struct net *net, struct sock *ctnl, struct sk_buff *skb,
11571162
const struct nlmsghdr *nlh,
1158-
const struct nlattr * const attr[])
1163+
const struct nlattr * const attr[],
1164+
struct netlink_ext_ack *extack)
11591165
{
11601166
struct ip_set_net *inst = ip_set_pernet(net);
11611167
struct ip_set *from, *to;
@@ -1428,7 +1434,8 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
14281434

14291435
static int ip_set_dump(struct net *net, struct sock *ctnl, struct sk_buff *skb,
14301436
const struct nlmsghdr *nlh,
1431-
const struct nlattr * const attr[])
1437+
const struct nlattr * const attr[],
1438+
struct netlink_ext_ack *extack)
14321439
{
14331440
if (unlikely(protocol_failed(attr)))
14341441
return -IPSET_ERR_PROTOCOL;
@@ -1513,7 +1520,8 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
15131520

15141521
static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb,
15151522
const struct nlmsghdr *nlh,
1516-
const struct nlattr * const attr[])
1523+
const struct nlattr * const attr[],
1524+
struct netlink_ext_ack *extack)
15171525
{
15181526
struct ip_set_net *inst = ip_set_pernet(net);
15191527
struct ip_set *set;
@@ -1567,7 +1575,8 @@ static int ip_set_uadd(struct net *net, struct sock *ctnl, struct sk_buff *skb,
15671575

15681576
static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb,
15691577
const struct nlmsghdr *nlh,
1570-
const struct nlattr * const attr[])
1578+
const struct nlattr * const attr[],
1579+
struct netlink_ext_ack *extack)
15711580
{
15721581
struct ip_set_net *inst = ip_set_pernet(net);
15731582
struct ip_set *set;
@@ -1621,7 +1630,8 @@ static int ip_set_udel(struct net *net, struct sock *ctnl, struct sk_buff *skb,
16211630

16221631
static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb,
16231632
const struct nlmsghdr *nlh,
1624-
const struct nlattr * const attr[])
1633+
const struct nlattr * const attr[],
1634+
struct netlink_ext_ack *extack)
16251635
{
16261636
struct ip_set_net *inst = ip_set_pernet(net);
16271637
struct ip_set *set;
@@ -1656,7 +1666,8 @@ static int ip_set_utest(struct net *net, struct sock *ctnl, struct sk_buff *skb,
16561666

16571667
static int ip_set_header(struct net *net, struct sock *ctnl,
16581668
struct sk_buff *skb, const struct nlmsghdr *nlh,
1659-
const struct nlattr * const attr[])
1669+
const struct nlattr * const attr[],
1670+
struct netlink_ext_ack *extack)
16601671
{
16611672
struct ip_set_net *inst = ip_set_pernet(net);
16621673
const struct ip_set *set;
@@ -1712,7 +1723,8 @@ static const struct nla_policy ip_set_type_policy[IPSET_ATTR_CMD_MAX + 1] = {
17121723

17131724
static int ip_set_type(struct net *net, struct sock *ctnl, struct sk_buff *skb,
17141725
const struct nlmsghdr *nlh,
1715-
const struct nlattr * const attr[])
1726+
const struct nlattr * const attr[],
1727+
struct netlink_ext_ack *extack)
17161728
{
17171729
struct sk_buff *skb2;
17181730
struct nlmsghdr *nlh2;
@@ -1770,7 +1782,8 @@ ip_set_protocol_policy[IPSET_ATTR_CMD_MAX + 1] = {
17701782

17711783
static int ip_set_protocol(struct net *net, struct sock *ctnl,
17721784
struct sk_buff *skb, const struct nlmsghdr *nlh,
1773-
const struct nlattr * const attr[])
1785+
const struct nlattr * const attr[],
1786+
struct netlink_ext_ack *extack)
17741787
{
17751788
struct sk_buff *skb2;
17761789
struct nlmsghdr *nlh2;

net/netfilter/nf_conntrack_netlink.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,8 @@ static int ctnetlink_flush_conntrack(struct net *net,
11271127
static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl,
11281128
struct sk_buff *skb,
11291129
const struct nlmsghdr *nlh,
1130-
const struct nlattr * const cda[])
1130+
const struct nlattr * const cda[],
1131+
struct netlink_ext_ack *extack)
11311132
{
11321133
struct nf_conntrack_tuple_hash *h;
11331134
struct nf_conntrack_tuple tuple;
@@ -1179,7 +1180,8 @@ static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl,
11791180
static int ctnetlink_get_conntrack(struct net *net, struct sock *ctnl,
11801181
struct sk_buff *skb,
11811182
const struct nlmsghdr *nlh,
1182-
const struct nlattr * const cda[])
1183+
const struct nlattr * const cda[],
1184+
struct netlink_ext_ack *extack)
11831185
{
11841186
struct nf_conntrack_tuple_hash *h;
11851187
struct nf_conntrack_tuple tuple;
@@ -1340,7 +1342,8 @@ ctnetlink_dump_dying(struct sk_buff *skb, struct netlink_callback *cb)
13401342
static int ctnetlink_get_ct_dying(struct net *net, struct sock *ctnl,
13411343
struct sk_buff *skb,
13421344
const struct nlmsghdr *nlh,
1343-
const struct nlattr * const cda[])
1345+
const struct nlattr * const cda[],
1346+
struct netlink_ext_ack *extack)
13441347
{
13451348
if (nlh->nlmsg_flags & NLM_F_DUMP) {
13461349
struct netlink_dump_control c = {
@@ -1362,7 +1365,8 @@ ctnetlink_dump_unconfirmed(struct sk_buff *skb, struct netlink_callback *cb)
13621365
static int ctnetlink_get_ct_unconfirmed(struct net *net, struct sock *ctnl,
13631366
struct sk_buff *skb,
13641367
const struct nlmsghdr *nlh,
1365-
const struct nlattr * const cda[])
1368+
const struct nlattr * const cda[],
1369+
struct netlink_ext_ack *extack)
13661370
{
13671371
if (nlh->nlmsg_flags & NLM_F_DUMP) {
13681372
struct netlink_dump_control c = {
@@ -1901,7 +1905,8 @@ ctnetlink_create_conntrack(struct net *net,
19011905
static int ctnetlink_new_conntrack(struct net *net, struct sock *ctnl,
19021906
struct sk_buff *skb,
19031907
const struct nlmsghdr *nlh,
1904-
const struct nlattr * const cda[])
1908+
const struct nlattr * const cda[],
1909+
struct netlink_ext_ack *extack)
19051910
{
19061911
struct nf_conntrack_tuple otuple, rtuple;
19071912
struct nf_conntrack_tuple_hash *h = NULL;
@@ -2066,7 +2071,8 @@ ctnetlink_ct_stat_cpu_dump(struct sk_buff *skb, struct netlink_callback *cb)
20662071
static int ctnetlink_stat_ct_cpu(struct net *net, struct sock *ctnl,
20672072
struct sk_buff *skb,
20682073
const struct nlmsghdr *nlh,
2069-
const struct nlattr * const cda[])
2074+
const struct nlattr * const cda[],
2075+
struct netlink_ext_ack *extack)
20702076
{
20712077
if (nlh->nlmsg_flags & NLM_F_DUMP) {
20722078
struct netlink_dump_control c = {
@@ -2111,7 +2117,8 @@ ctnetlink_stat_ct_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type,
21112117

21122118
static int ctnetlink_stat_ct(struct net *net, struct sock *ctnl,
21132119
struct sk_buff *skb, const struct nlmsghdr *nlh,
2114-
const struct nlattr * const cda[])
2120+
const struct nlattr * const cda[],
2121+
struct netlink_ext_ack *extack)
21152122
{
21162123
struct sk_buff *skb2;
21172124
int err;
@@ -2773,7 +2780,8 @@ ctnetlink_exp_ct_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
27732780
static int ctnetlink_dump_exp_ct(struct net *net, struct sock *ctnl,
27742781
struct sk_buff *skb,
27752782
const struct nlmsghdr *nlh,
2776-
const struct nlattr * const cda[])
2783+
const struct nlattr * const cda[],
2784+
struct netlink_ext_ack *extack)
27772785
{
27782786
int err;
27792787
struct nfgenmsg *nfmsg = nlmsg_data(nlh);
@@ -2817,7 +2825,8 @@ static int ctnetlink_dump_exp_ct(struct net *net, struct sock *ctnl,
28172825

28182826
static int ctnetlink_get_expect(struct net *net, struct sock *ctnl,
28192827
struct sk_buff *skb, const struct nlmsghdr *nlh,
2820-
const struct nlattr * const cda[])
2828+
const struct nlattr * const cda[],
2829+
struct netlink_ext_ack *extack)
28212830
{
28222831
struct nf_conntrack_tuple tuple;
28232832
struct nf_conntrack_expect *exp;
@@ -2829,7 +2838,8 @@ static int ctnetlink_get_expect(struct net *net, struct sock *ctnl,
28292838

28302839
if (nlh->nlmsg_flags & NLM_F_DUMP) {
28312840
if (cda[CTA_EXPECT_MASTER])
2832-
return ctnetlink_dump_exp_ct(net, ctnl, skb, nlh, cda);
2841+
return ctnetlink_dump_exp_ct(net, ctnl, skb, nlh, cda,
2842+
extack);
28332843
else {
28342844
struct netlink_dump_control c = {
28352845
.dump = ctnetlink_exp_dump_table,
@@ -2897,7 +2907,8 @@ static int ctnetlink_get_expect(struct net *net, struct sock *ctnl,
28972907

28982908
static int ctnetlink_del_expect(struct net *net, struct sock *ctnl,
28992909
struct sk_buff *skb, const struct nlmsghdr *nlh,
2900-
const struct nlattr * const cda[])
2910+
const struct nlattr * const cda[],
2911+
struct netlink_ext_ack *extack)
29012912
{
29022913
struct nf_conntrack_expect *exp;
29032914
struct nf_conntrack_tuple tuple;
@@ -3185,7 +3196,8 @@ ctnetlink_create_expect(struct net *net,
31853196

31863197
static int ctnetlink_new_expect(struct net *net, struct sock *ctnl,
31873198
struct sk_buff *skb, const struct nlmsghdr *nlh,
3188-
const struct nlattr * const cda[])
3199+
const struct nlattr * const cda[],
3200+
struct netlink_ext_ack *extack)
31893201
{
31903202
struct nf_conntrack_tuple tuple;
31913203
struct nf_conntrack_expect *exp;
@@ -3291,7 +3303,8 @@ ctnetlink_exp_stat_cpu_dump(struct sk_buff *skb, struct netlink_callback *cb)
32913303
static int ctnetlink_stat_exp_cpu(struct net *net, struct sock *ctnl,
32923304
struct sk_buff *skb,
32933305
const struct nlmsghdr *nlh,
3294-
const struct nlattr * const cda[])
3306+
const struct nlattr * const cda[],
3307+
struct netlink_ext_ack *extack)
32953308
{
32963309
if (nlh->nlmsg_flags & NLM_F_DUMP) {
32973310
struct netlink_dump_control c = {

0 commit comments

Comments
 (0)