Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9263
b: refs/heads/master
c: 1dfbab5
h: refs/heads/master
i:
  9261: bacfdd1
  9259: 901709b
  9255: cceb77b
  9247: c512290
v: v3
  • Loading branch information
Harald Welte authored and David S. Miller committed Sep 23, 2005
1 parent 503182e commit a7f5465
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a82b748930fce0dab22c64075c38c830ae116904
refs/heads/master: 1dfbab59498d6f227c91988bab6c71af049a5333
25 changes: 21 additions & 4 deletions trunk/include/linux/netfilter_ipv4/ip_conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,28 @@ extern void need_ip_conntrack(void);
extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
const struct ip_conntrack_tuple *orig);

extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo,
const struct sk_buff *skb,
unsigned long extra_jiffies,
int do_acct);

/* Refresh conntrack for this many jiffies and do accounting */
static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo,
const struct sk_buff *skb,
unsigned long extra_jiffies)
{
__ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
}

/* Refresh conntrack for this many jiffies */
extern void ip_ct_refresh_acct(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo,
const struct sk_buff *skb,
unsigned long extra_jiffies);
static inline void ip_ct_refresh(struct ip_conntrack *ct,
const struct sk_buff *skb,
unsigned long extra_jiffies)
{
__ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
}

/* These are for NAT. Icky. */
/* Update TCP window tracking data when NAT mangles the packet */
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/netfilter/ip_conntrack_amanda.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static int help(struct sk_buff **pskb,

/* increase the UDP timeout of the master connection as replies from
* Amanda clients to the server can be quite delayed */
ip_ct_refresh_acct(ct, ctinfo, NULL, master_timeout * HZ);
ip_ct_refresh(ct, *pskb, master_timeout * HZ);

/* No data? */
dataoff = (*pskb)->nh.iph->ihl*4 + sizeof(struct udphdr);
Expand Down
49 changes: 25 additions & 24 deletions trunk/net/ipv4/netfilter/ip_conntrack_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,45 +1112,46 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
synchronize_net();
}

static inline void ct_add_counters(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo,
const struct sk_buff *skb)
{
#ifdef CONFIG_IP_NF_CT_ACCT
if (skb) {
ct->counters[CTINFO2DIR(ctinfo)].packets++;
ct->counters[CTINFO2DIR(ctinfo)].bytes +=
ntohs(skb->nh.iph->tot_len);
}
#endif
}

/* Refresh conntrack for this many jiffies and do accounting (if skb != NULL) */
void ip_ct_refresh_acct(struct ip_conntrack *ct,
/* Refresh conntrack for this many jiffies and do accounting if do_acct is 1 */
void __ip_ct_refresh_acct(struct ip_conntrack *ct,
enum ip_conntrack_info ctinfo,
const struct sk_buff *skb,
unsigned long extra_jiffies)
unsigned long extra_jiffies,
int do_acct)
{
int do_event = 0;

IP_NF_ASSERT(ct->timeout.data == (unsigned long)ct);
IP_NF_ASSERT(skb);

write_lock_bh(&ip_conntrack_lock);

/* If not in hash table, timer will not be active yet */
if (!is_confirmed(ct)) {
ct->timeout.expires = extra_jiffies;
ct_add_counters(ct, ctinfo, skb);
do_event = 1;
} else {
write_lock_bh(&ip_conntrack_lock);
/* Need del_timer for race avoidance (may already be dying). */
if (del_timer(&ct->timeout)) {
ct->timeout.expires = jiffies + extra_jiffies;
add_timer(&ct->timeout);
/* FIXME: We loose some REFRESH events if this function
* is called without an skb. I'll fix this later -HW */
if (skb)
ip_conntrack_event_cache(IPCT_REFRESH, skb);
do_event = 1;
}
ct_add_counters(ct, ctinfo, skb);
write_unlock_bh(&ip_conntrack_lock);
}

#ifdef CONFIG_IP_NF_CT_ACCT
if (do_acct) {
ct->counters[CTINFO2DIR(ctinfo)].packets++;
ct->counters[CTINFO2DIR(ctinfo)].bytes +=
ntohs(skb->nh.iph->tot_len);
}
#endif

write_unlock_bh(&ip_conntrack_lock);

/* must be unlocked when calling event cache */
if (do_event)
ip_conntrack_event_cache(IPCT_REFRESH, skb);
}

#if defined(CONFIG_IP_NF_CONNTRACK_NETLINK) || \
Expand Down
1 change: 0 additions & 1 deletion trunk/net/ipv4/netfilter/ip_conntrack_helper_pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ static int destroy_sibling_or_exp(const struct ip_conntrack_tuple *t)
DEBUGP("setting timeout of conntrack %p to 0\n", sibling);
sibling->proto.gre.timeout = 0;
sibling->proto.gre.stream_timeout = 0;
/* refresh_acct will not modify counters if skb == NULL */
if (del_timer(&sibling->timeout))
sibling->timeout.function((unsigned long)sibling);
ip_conntrack_put(sibling);
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/netfilter/ip_conntrack_netbios_ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static int help(struct sk_buff **pskb,
ip_conntrack_expect_related(exp);
ip_conntrack_expect_put(exp);

ip_ct_refresh_acct(ct, ctinfo, NULL, timeout * HZ);
ip_ct_refresh(ct, *pskb, timeout * HZ);
out:
return NF_ACCEPT;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/netfilter/ip_conntrack_standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ EXPORT_SYMBOL(need_ip_conntrack);
EXPORT_SYMBOL(ip_conntrack_helper_register);
EXPORT_SYMBOL(ip_conntrack_helper_unregister);
EXPORT_SYMBOL(ip_ct_iterate_cleanup);
EXPORT_SYMBOL(ip_ct_refresh_acct);
EXPORT_SYMBOL(__ip_ct_refresh_acct);

EXPORT_SYMBOL(ip_conntrack_expect_alloc);
EXPORT_SYMBOL(ip_conntrack_expect_put);
Expand Down

0 comments on commit a7f5465

Please sign in to comment.