Skip to content

Commit 3176859

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: remove skb argument from nf_ct_refresh
Its not used (and could be NULL), so remove it. This allows to use nf_ct_refresh in places where we don't have an skb without having to double-check that skb == NULL would be safe. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 7a4b614 commit 3176859

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

include/net/netfilter/nf_conntrack.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,24 +204,22 @@ bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
204204
struct nf_conntrack_tuple *tuple);
205205

206206
void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
207-
const struct sk_buff *skb,
208-
u32 extra_jiffies, bool do_acct);
207+
u32 extra_jiffies, unsigned int bytes);
209208

210209
/* Refresh conntrack for this many jiffies and do accounting */
211210
static inline void nf_ct_refresh_acct(struct nf_conn *ct,
212211
enum ip_conntrack_info ctinfo,
213212
const struct sk_buff *skb,
214213
u32 extra_jiffies)
215214
{
216-
__nf_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, true);
215+
__nf_ct_refresh_acct(ct, ctinfo, extra_jiffies, skb->len);
217216
}
218217

219218
/* Refresh conntrack for this many jiffies */
220219
static inline void nf_ct_refresh(struct nf_conn *ct,
221-
const struct sk_buff *skb,
222220
u32 extra_jiffies)
223221
{
224-
__nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, false);
222+
__nf_ct_refresh_acct(ct, 0, extra_jiffies, 0);
225223
}
226224

227225
/* kill conntrack and do accounting */

net/netfilter/nf_conntrack_amanda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int amanda_help(struct sk_buff *skb,
106106

107107
/* increase the UDP timeout of the master connection as replies from
108108
* Amanda clients to the server can be quite delayed */
109-
nf_ct_refresh(ct, skb, master_timeout * HZ);
109+
nf_ct_refresh(ct, master_timeout * HZ);
110110

111111
/* No data? */
112112
dataoff = protoff + sizeof(struct udphdr);

net/netfilter/nf_conntrack_broadcast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int nf_conntrack_broadcast_help(struct sk_buff *skb,
7575
nf_ct_expect_related(exp, 0);
7676
nf_ct_expect_put(exp);
7777

78-
nf_ct_refresh(ct, skb, timeout * HZ);
78+
nf_ct_refresh(ct, timeout * HZ);
7979
out:
8080
return NF_ACCEPT;
8181
}

net/netfilter/nf_conntrack_core.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,9 +2089,8 @@ EXPORT_SYMBOL_GPL(nf_conntrack_in);
20892089
/* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */
20902090
void __nf_ct_refresh_acct(struct nf_conn *ct,
20912091
enum ip_conntrack_info ctinfo,
2092-
const struct sk_buff *skb,
20932092
u32 extra_jiffies,
2094-
bool do_acct)
2093+
unsigned int bytes)
20952094
{
20962095
/* Only update if this is not a fixed timeout */
20972096
if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status))
@@ -2104,8 +2103,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
21042103
if (READ_ONCE(ct->timeout) != extra_jiffies)
21052104
WRITE_ONCE(ct->timeout, extra_jiffies);
21062105
acct:
2107-
if (do_acct)
2108-
nf_ct_acct_update(ct, CTINFO2DIR(ctinfo), skb->len);
2106+
if (bytes)
2107+
nf_ct_acct_update(ct, CTINFO2DIR(ctinfo), bytes);
21092108
}
21102109
EXPORT_SYMBOL_GPL(__nf_ct_refresh_acct);
21112110

net/netfilter/nf_conntrack_h323_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
13851385
if (info->timeout > 0) {
13861386
pr_debug("nf_ct_ras: set RAS connection timeout to "
13871387
"%u seconds\n", info->timeout);
1388-
nf_ct_refresh(ct, skb, info->timeout * HZ);
1388+
nf_ct_refresh(ct, info->timeout * HZ);
13891389

13901390
/* Set expect timeout */
13911391
spin_lock_bh(&nf_conntrack_expect_lock);
@@ -1433,7 +1433,7 @@ static int process_urq(struct sk_buff *skb, struct nf_conn *ct,
14331433
info->sig_port[!dir] = 0;
14341434

14351435
/* Give it 30 seconds for UCF or URJ */
1436-
nf_ct_refresh(ct, skb, 30 * HZ);
1436+
nf_ct_refresh(ct, 30 * HZ);
14371437

14381438
return 0;
14391439
}

net/netfilter/nf_conntrack_sip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ static int sip_help_tcp(struct sk_buff *skb, unsigned int protoff,
15531553
if (dataoff >= skb->len)
15541554
return NF_ACCEPT;
15551555

1556-
nf_ct_refresh(ct, skb, sip_timeout * HZ);
1556+
nf_ct_refresh(ct, sip_timeout * HZ);
15571557

15581558
if (unlikely(skb_linearize(skb)))
15591559
return NF_DROP;
@@ -1624,7 +1624,7 @@ static int sip_help_udp(struct sk_buff *skb, unsigned int protoff,
16241624
if (dataoff >= skb->len)
16251625
return NF_ACCEPT;
16261626

1627-
nf_ct_refresh(ct, skb, sip_timeout * HZ);
1627+
nf_ct_refresh(ct, sip_timeout * HZ);
16281628

16291629
if (unlikely(skb_linearize(skb)))
16301630
return NF_DROP;

net/netfilter/nft_ct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ static void nft_ct_timeout_obj_eval(struct nft_object *obj,
929929
*/
930930
values = nf_ct_timeout_data(timeout);
931931
if (values)
932-
nf_ct_refresh(ct, pkt->skb, values[0]);
932+
nf_ct_refresh(ct, values[0]);
933933
}
934934

935935
static int nft_ct_timeout_obj_init(const struct nft_ctx *ctx,

0 commit comments

Comments
 (0)