[XFRM] STATE: Fix to respond error to get operation if no matching entry exists.
authorMasahide NAKAMURA <nakam@linux-ipv6.org>
Sat, 25 Nov 2006 04:34:51 +0000 (20:34 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sat, 25 Nov 2006 23:16:52 +0000 (15:16 -0800)
When application uses XFRM_MSG_GETSA to get state entry through
netlink socket and kernel has no matching one, the application expects
reply message with error status by kernel.

Kernel doesn't send the message back in the case of Mobile IPv6 route
optimization protocols (i.e. routing header or destination options
header). This is caused by incorrect return code "0" from
net/xfrm/xfrm_user.c(xfrm_user_state_lookup) and it makes kernel skip
to acknowledge at net/netlink/af_netlink.c(netlink_rcv_skb).

This patch fix to reply ESRCH to application.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: TAKAMIYA Noriaki <takamiya@po.ntts.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>

index c4cde57d9216cc82b529baf8009600583f4a078d..2ee14f8a1908ee6c7d54fa4e74f31a5ef89a23ca 100644 (file)
@@ -495,6 +495,7 @@ static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p,
                        goto out;
+               err = -ESRCH;
                x = xfrm_state_lookup_byaddr(&p->daddr, saddr, p->proto,