Skip to contentSkip to conversation

Fix adding SA through netlink(xfrm_user)

PATCH In review Masahide Nakamura 3 participants 3 messages Jul 28, 2004 – Jul 29, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix adding SA through netlink(xfrm_user)

Hello,

When adding IPsec SA with PF_KEY (pfkey_add()), xfrm_probe_algs() is called to make all algorithms valid. However, it is missing to call it with netlink (xfrm_user) case and it causes xfrm_aalg_get_byname() return NULL even if the name of algorithm seems to be correct.

The patch fixes it and is against 2.6.7. Please apply it.

Index: linux26/net/xfrm/xfrm_user.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux26/net/xfrm/xfrm_user.c,v retrieving revision 1.1.1.13

net/xfrm/xfrm_user.c +2 -0
diff -u -r1.1.1.13 xfrm_user.c
@@ -258,6 +258,8 @@
 	if (err)
 		return err;
 
+	xfrm_probe_algs();
+
 	x = xfrm_state_construct(p, (struct rtattr **) xfrma, &err);
 	if (!x)
 		return err;
Signature · 1 line
Masahide NAKAMURA
#1 lore raw
Quoted 7 lines · Masahide Nakamura

Hello,

When adding IPsec SA with PF_KEY (pfkey_add()), xfrm_probe_algs() is called to make all algorithms valid. However, it is missing to call it with netlink (xfrm_user) case and it causes xfrm_aalg_get_byname() return NULL even if the name of algorithm seems to be correct.

Looks ok, but odd that this has not been picked up before.

Quoted 23 lines

The patch fixes it and is against 2.6.7. Please apply it.

Index: linux26/net/xfrm/xfrm_user.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux26/net/xfrm/xfrm_user.c,v retrieving revision 1.1.1.13
diff -u -r1.1.1.13 xfrm_user.c

net/xfrm/xfrm_user.c +2 -0
@@ -258,6 +258,8 @@
 	if (err)
 		return err;
 
+	xfrm_probe_algs();
+
 	x = xfrm_state_construct(p, (struct rtattr **) xfrma, &err);
 	if (!x)
 		return err;
Signature · 2 lines
James Morris
<[email protected]>
#2 lore raw
Quoted 9 lines · On Wed, 28 Jul 2004 11:41:33 -0400 (EDT) James Morris <[email protected]>…
Quoted 5 lines · Masahide Nakamura

When adding IPsec SA with PF_KEY (pfkey_add()), xfrm_probe_algs() is called to make all algorithms valid. However, it is missing to call it with netlink (xfrm_user) case and it causes xfrm_aalg_get_byname() return NULL even if the name of algorithm seems to be correct.

Looks ok, but odd that this has not been picked up before.

As discovered, this never got picked up before mostly because the most popular user of xfrm_user (Openswan) is still using PF_KEY to probe the algorithms.

Patch applied, arigato Masahide-san.