Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122218
b: refs/heads/master
c: a6483b7
h: refs/heads/master
v: v3
  • Loading branch information
Alexey Dobriyan authored and David S. Miller committed Nov 26, 2008
1 parent 0955001 commit 838a0a0
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 45 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: bd235e3cfff617ff91677da553714051866ba55f
refs/heads/master: a6483b790f8efcd8db190c1c0ff93f9d9efe919a
2 changes: 2 additions & 0 deletions trunk/include/net/netns/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ struct netns_xfrm {
struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
unsigned int policy_count[XFRM_POLICY_MAX * 2];
struct work_struct policy_hash_work;

struct sock *nlsk;
};

#endif
7 changes: 4 additions & 3 deletions trunk/include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics);
#define XFRM_INC_STATS_USER(field)
#endif

extern struct sock *xfrm_nl;
extern u32 sysctl_xfrm_aevent_etime;
extern u32 sysctl_xfrm_aevent_rseqth;
extern int sysctl_xfrm_larval_drop;
Expand Down Expand Up @@ -1516,18 +1515,20 @@ static inline int xfrm_policy_id2dir(u32 index)
return index & 7;
}

static inline int xfrm_aevent_is_on(void)
#ifdef CONFIG_XFRM
static inline int xfrm_aevent_is_on(struct net *net)
{
struct sock *nlsk;
int ret = 0;

rcu_read_lock();
nlsk = rcu_dereference(xfrm_nl);
nlsk = rcu_dereference(net->xfrm.nlsk);
if (nlsk)
ret = netlink_has_listeners(nlsk, XFRMNLGRP_AEVENTS);
rcu_read_unlock();
return ret;
}
#endif

static inline int xfrm_alg_len(struct xfrm_algo *alg)
{
Expand Down
3 changes: 2 additions & 1 deletion trunk/net/xfrm/xfrm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
{
struct dst_entry *dst = skb->dst;
struct xfrm_state *x = dst->xfrm;
struct net *net = xs_net(x);

if (err <= 0)
goto resume;
Expand Down Expand Up @@ -74,7 +75,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
err = -EOVERFLOW;
goto error;
}
if (xfrm_aevent_is_on())
if (xfrm_aevent_is_on(net))
xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
}

Expand Down
7 changes: 2 additions & 5 deletions trunk/net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@

#include "xfrm_hash.h"

struct sock *xfrm_nl;
EXPORT_SYMBOL(xfrm_nl);

u32 sysctl_xfrm_aevent_etime __read_mostly = XFRM_AE_ETIME;
EXPORT_SYMBOL(sysctl_xfrm_aevent_etime);

Expand Down Expand Up @@ -1659,7 +1656,7 @@ static void xfrm_replay_timer_handler(unsigned long data)
spin_lock(&x->lock);

if (x->km.state == XFRM_STATE_VALID) {
if (xfrm_aevent_is_on())
if (xfrm_aevent_is_on(xs_net(x)))
xfrm_replay_notify(x, XFRM_REPLAY_TIMEOUT);
else
x->xflags |= XFRM_TIME_DEFER;
Expand Down Expand Up @@ -1715,7 +1712,7 @@ void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq)
x->replay.bitmap |= (1U << diff);
}

if (xfrm_aevent_is_on())
if (xfrm_aevent_is_on(xs_net(x)))
xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
}

Expand Down
Loading

0 comments on commit 838a0a0

Please sign in to comment.