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
[EMAIL PROTECTED] http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
pgp4er5dqx3cV.pgp
Description: PGP signature
