2 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3 * Authors: Doug Rabson <dfr@rabson.org>
4 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include "opt_inet6.h"
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include <sys/param.h>
34 #include <sys/malloc.h>
35 #include <sys/systm.h>
37 #include <rpc/types.h>
40 * For in-kernel use, we use a simple compiled-in configuration.
43 static struct netconfig netconfigs[] = {
47 .nc_semantics = NC_TPI_CLTS,
48 .nc_flag = NC_VISIBLE,
49 .nc_protofmly = "inet6",
54 .nc_semantics = NC_TPI_COTS_ORD,
55 .nc_flag = NC_VISIBLE,
56 .nc_protofmly = "inet6",
62 .nc_semantics = NC_TPI_CLTS,
63 .nc_flag = NC_VISIBLE,
64 .nc_protofmly = "inet",
69 .nc_semantics = NC_TPI_COTS_ORD,
70 .nc_flag = NC_VISIBLE,
71 .nc_protofmly = "inet",
76 .nc_semantics = NC_TPI_COTS_ORD,
78 .nc_protofmly = "loopback",
89 struct netconfig **nconfp;
91 nconfp = malloc(sizeof(struct netconfig *), M_RPC, M_WAITOK);
94 return ((void *) nconfp);
98 getnetconfig(void *handle)
100 struct netconfig **nconfp = (struct netconfig **) handle;
101 struct netconfig *nconf;
104 if (nconf->nc_netid == NULL)
113 getnetconfigent(const char *netid)
115 struct netconfig *nconf;
117 for (nconf = netconfigs; nconf->nc_netid; nconf++) {
118 if (!strcmp(netid, nconf->nc_netid))
126 freenetconfigent(struct netconfig *nconf)
132 endnetconfig(void * handle)
134 struct netconfig **nconfp = (struct netconfig **) handle;