linprocfs - Introduce /proc/mounts
[dragonfly.git] / sys / netinet6 / ip6_demux.c
blobf29f8e5188fcb59343a9cdbcce3aaf65fc642709
1 /*
2 * Copyright (c) 2003, 2004 Jeffrey M. Hsu. All rights reserved.
3 * Copyright (c) 2003, 2004 The DragonFly Project. All rights reserved.
5 * This code is derived from software contributed to The DragonFly Project
6 * by Jeffrey M. Hsu.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of The DragonFly Project nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific, prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #include "opt_inet6.h"
36 #include <sys/param.h>
37 #include <sys/systm.h>
38 #include <sys/kernel.h>
39 #include <sys/socket.h>
40 #include <sys/socketvar.h>
42 #include <netinet/tcp_var.h>
43 #include <netinet6/tcp6_var.h>
45 lwkt_port_t
46 tcp6_soport(struct socket *so, struct sockaddr *nam, struct mbuf **m0)
48 struct inpcb *inp;
51 * Use IPv6 default tcp soport (tcp protocol thread on cpu 0) if:
52 * - No socket yet
53 * - No inp, connection reset by peer
54 * - IPv6 only
55 * - Not IPv4 mapped
57 if (so == NULL || (inp = so->so_pcb) == NULL ||
58 (inp->inp_flags & IN6P_IPV6_V6ONLY) ||
59 (inp->inp_vflag & INP_IPV4) == 0) {
60 return tcp6_addrport();
63 /* IPv4 mapped, fall back to IPv4 tcp_soport */
64 return tcp_soport(so, nam, m0);
68 * XXX hack
70 lwkt_port_t
71 tcp6_addrport(void)
73 return(tcp_addrport0());