Subject: Re: Checking SPI in xfrm_state_find

From: Patrick McHardy <[email-masked]>
Date: Sun, 03 Apr 2005 19:00:36 +0200

Herbert Xu wrote:
> It just occured to me that it would be much simpler if you did the
> existence check in the first loop.
> 
> So something like
> 
> 		if (x->props.family != family ||
> 		    !xfrm_state_addr_check(x, daddr, saddr, family) ||
> 		    tmpl->id.proto == x->id.proto)
> 			continue;
> 		if (tmpl->id.spi) {
> 			if (tmpl->id.spi != x->id.spi)
> 				continue;
> 			error = -EEXIST;
> 		}
> 		if (x->props.reqid == tmpl->reqid &&
> 		    tmpl->mode == x->props.mode) {
> 		}

You're right, sorry for getting back to you so late. But since its
already in now and not very important, I'm going to leave it until
I have a better reason to touch that code, if you're ok with that.

Regards
Patrick