cvs commit: src/sys/net raw_usrreq.c src/sys/netkey keysock.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Sun Apr 9 08:46:17 UTC 2006


On Sat, Apr 01, 2006 at 03:55:44PM +0000, Robert Watson wrote:
+> rwatson     2006-04-01 15:55:44 UTC
+> 
+>   FreeBSD src repository
+> 
+>   Modified files:
+>     sys/net              raw_usrreq.c 
+>     sys/netkey           keysock.c 
+>   Log:
+>   In raw and raw-derived socket types, maintain and enforce invariant that
+>   the so_pcb pointer on the socket is always non-NULL.  This eliminates
+>   countless unnecessary error checks, replacing them with assertions.
[...]
+>  static int
+>  raw_uattach(struct socket *so, int proto, struct thread *td)
+>  {
+> -	struct rawcb *rp = sotorawcb(so);
+>  	int error;
+>  
+> -	if (rp == 0)
+> -		return EINVAL;
+> +	KASSERT(sotorawcb(so) == NULL, ("raw_uattach: rp != NULL"));
+>  	if (td && (error = suser(td)) != 0)
+>  		return error;
+>  	return raw_attach(so, proto);

My system panics on this KASSERT(9) when I setup IPsec.
When you look closer, EINVAL was returned when sotorawcb(so) was equal
to NULL and you change it to panic when it is not NULL.
So what you really wanted here, IMHO was:

	KASSERT(sotorawcb(so) != NULL, ("raw_uattach: rp == NULL"));

With this KASSERT(9) it works for me.
BTW. There is no more 'rp' variable in the function.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20060409/3b8a4bc9/attachment.pgp


More information about the cvs-src mailing list