Skip to contentSkip to conversation

: pfkey should ignore events when no listeners

PATCH Applied jamal 2 participants 2 messages Jun 7, 2008 – Jun 10, 2008

Subsystems (3)
lore
Share & tools
lore

jamal

author
#0 lore raw

PATCH 1/1 : pfkey should ignore events when no listeners

I have only tested with SAs but i expect similar results with SPs.

cheers,
jamal

[IPSEC]: pfkey should ignore events when no listeners

When pfkey has no km listeners, it still does a lot of work before finding out there aint nobody out there.
If a tree falls in a forest and no one is around to hear it, does it make a sound? In this case it makes a lot of noise:
With this short-circuit adding 10s of thousands of SAs using netlink improves performance by ~10%.

---
commit ad610c01e537679b1529c6f6c026a95a4e694dd2
tree 9c9ccda8b8a55aa29ba632d8ca6e1de5964c4c65
parent aab2545fdd6641b76af0ae96456c4ca9d1e50dad
author Jamal Hadi Salim <[email protected]> Sat, 07 Jun 2008 09:19:09 -0400 committer Jamal Hadi Salim <[email protected]> Sat, 07 Jun 2008 09:19:09 -0400

 net/key/af_key.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
net/key/af_key.c +3 -0
index 9bba7ac..7470e36 100644
@@ -3030,6 +3030,9 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
 
 static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
 {
+	if (atomic_read(&pfkey_socks_nr) == 0)
+		return 0;
+
 	switch (c->event) {
 	case XFRM_MSG_EXPIRE:
 		return key_notify_sa_expire(x, c);
maintainer Applied
#1 lore raw

From: jamal <[email protected]>
Date: Sat, 07 Jun 2008 09:23:10 -0400

Quoted 10 lines

[IPSEC]: pfkey should ignore events when no listeners

When pfkey has no km listeners, it still does a lot of work before finding out there aint nobody out there.
If a tree falls in a forest and no one is around to hear it, does it make a sound? In this case it makes a lot of noise:
With this short-circuit adding 10s of thousands of SAs using netlink improves performance by ~10%.

Applied, thanks Jamal.