1/*-
2 * Copyright (c) 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 13 unchanged lines hidden (view full) ---
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95
30 * $FreeBSD: head/sys/net/rtsock.c 241686 2012-10-18 13:57:24Z andre $
31 */
32#include "opt_compat.h"
33#include "opt_sctp.h"
34#include "opt_mpath.h"
35#include "opt_inet.h"
36#include "opt_inet6.h"
37
38#include <sys/param.h>
--- 258 unchanged lines hidden (view full) ---
297}
298
299/* pru_accept is EOPNOTSUPP */
300
301static int
302rts_attach(struct socket *so, int proto, struct thread *td)
303{
304 struct rawcb *rp;
305 int error;
306
307 KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
308
309 /* XXX */
310 rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
311 if (rp == NULL)
312 return ENOBUFS;
313
314 so->so_pcb = (caddr_t)rp;
315 so->so_fibnum = td->td_proc->p_fibnum;
316 error = raw_attach(so, proto);
317 rp = sotorawcb(so);
318 if (error) {
319 so->so_pcb = NULL;
320 free(rp, M_PCB);
321 return error;
322 }
323 RTSOCK_LOCK();
324 switch(rp->rcb_proto.sp_protocol) {
325 case AF_INET:
326 route_cb.ip_count++;
--- 4 unchanged lines hidden (view full) ---
331 case AF_IPX:
332 route_cb.ipx_count++;
333 break;
334 }
335 route_cb.any_count++;
336 RTSOCK_UNLOCK();
337 soisconnected(so);
338 so->so_options |= SO_USELOOPBACK;
339 return 0;
340}
341
342static int
343rts_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
344{
345
346 return (raw_usrreqs.pru_bind(so, nam, td)); /* xxx just EINVAL */
--- 1581 unchanged lines hidden ---
2 * Copyright (c) 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 13 unchanged lines hidden (view full) ---
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95
30 * $FreeBSD: head/sys/net/rtsock.c 241686 2012-10-18 13:57:24Z andre $
31 */
32#include "opt_compat.h"
33#include "opt_sctp.h"
34#include "opt_mpath.h"
35#include "opt_inet.h"
36#include "opt_inet6.h"
37
38#include <sys/param.h>
--- 258 unchanged lines hidden (view full) ---
297}
298
299/* pru_accept is EOPNOTSUPP */
300
301static int
302rts_attach(struct socket *so, int proto, struct thread *td)
303{
304 struct rawcb *rp;
305 int error;
306
307 KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
308
309 /* XXX */
310 rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
311 if (rp == NULL)
312 return ENOBUFS;
313
314 so->so_pcb = (caddr_t)rp;
315 so->so_fibnum = td->td_proc->p_fibnum;
316 error = raw_attach(so, proto);
317 rp = sotorawcb(so);
318 if (error) {
319 so->so_pcb = NULL;
320 free(rp, M_PCB);
321 return error;
322 }
323 RTSOCK_LOCK();
324 switch(rp->rcb_proto.sp_protocol) {
325 case AF_INET:
326 route_cb.ip_count++;
--- 4 unchanged lines hidden (view full) ---
331 case AF_IPX:
332 route_cb.ipx_count++;
333 break;
334 }
335 route_cb.any_count++;
336 RTSOCK_UNLOCK();
337 soisconnected(so);
338 so->so_options |= SO_USELOOPBACK;
339 return 0;
340}
341
342static int
343rts_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
344{
345
346 return (raw_usrreqs.pru_bind(so, nam, td)); /* xxx just EINVAL */
--- 1581 unchanged lines hidden ---