- pfkeystat.sockerr++;
- _FREE((caddr_t)kp, M_PCB);
- so->so_pcb = (caddr_t) 0;
- splx(s);
- return(error);
- }
-
- kp->kp_promisc = kp->kp_registered = 0;
-
- if (af == PF_KEY) /* XXX: AF_KEY */
- key_cb.key_count++;
- key_cb.any_count++;
-#ifndef __bsdi__
- kp->kp_raw.rcb_laddr = &key_src;
- kp->kp_raw.rcb_faddr = &key_dst;
-#else
- /*
- * XXX rcb_faddr must be dynamically allocated, otherwise
- * raw_disconnect() will be angry.
- */
- {
- struct mbuf *m, *n;
- MGET(m, M_WAITOK, MT_DATA);
- if (!m) {
- error = ENOBUFS;
- pfkeystat.in_nomem++;
- _FREE((caddr_t)kp, M_PCB);
- so->so_pcb = (caddr_t) 0;
- splx(s);
- return(error);
- }
- MGET(n, M_WAITOK, MT_DATA);
- if (!n) {
- error = ENOBUFS;
- m_freem(m);
- pfkeystat.in_nomem++;
- _FREE((caddr_t)kp, M_PCB);
- so->so_pcb = (caddr_t) 0;
- splx(s);
- return(error);
- }
- m->m_len = sizeof(key_src);
- kp->kp_raw.rcb_laddr = mtod(m, struct sockaddr *);
- bcopy(&key_src, kp->kp_raw.rcb_laddr, sizeof(key_src));
- n->m_len = sizeof(key_dst);
- kp->kp_raw.rcb_faddr = mtod(n, struct sockaddr *);
- bcopy(&key_dst, kp->kp_raw.rcb_faddr, sizeof(key_dst));
- }
-#endif
- soisconnected(so);
- so->so_options |= SO_USELOOPBACK;
- }
- splx(s);
- return(error);
-}
-#endif /* other than FreeBSD >= 3 */
-
-/*
- * key_output()
- */
-int
-key_output(m, so)
- register struct mbuf *m;
- struct socket *so;