/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1982, 1986, 19934* The Regents of the University of California. All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14* 3. Neither the name of the University nor the names of its contributors15* may be used to endorse or promote products derived from this software16* without specific prior written permission.17*18* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND19* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE20* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE21* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE22* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL23* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS24* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)25* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT26* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY27* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF28* SUCH DAMAGE.29*/3031#include <sys/cdefs.h>32#include "opt_mrouting.h"33#include "opt_ipsec.h"34#include "opt_inet.h"35#include "opt_inet6.h"36#include "opt_sctp.h"3738#include <sys/param.h>39#include <sys/systm.h>40#include <sys/kernel.h>41#include <sys/malloc.h>42#include <sys/socket.h>43#include <sys/domain.h>44#include <sys/proc.h>45#include <sys/protosw.h>46#include <sys/queue.h>47#include <sys/sysctl.h>4849#include <net/if.h>50#include <net/if_var.h>51#include <netinet/in.h>52#include <netinet/in_var.h>5354/*55* While this file provides the domain and protocol switch tables for IPv4, it56* also provides the sysctl node declarations for net.inet.* often shared with57* IPv6 for common features or by upper layer protocols. In case of no IPv458* support compile out everything but these sysctl nodes.59*/60#ifdef INET61/* netinet/raw_ip.c */62extern struct protosw rip_protosw;63/* netinet/udp_usrreq.c */64extern struct protosw udp_protosw, udplite_protosw;65/* netinet/tcp_usrreq.c */66extern struct protosw tcp_protosw;67/* netinet/sctp_usrreq.c */68extern struct protosw sctp_seqpacket_protosw, sctp_stream_protosw;6970FEATURE(inet, "Internet Protocol version 4");7172struct domain inetdomain = {73.dom_family = AF_INET,74.dom_name = "internet",75.dom_rtattach = in_inithead,76#ifdef VIMAGE77.dom_rtdetach = in_detachhead,78#endif79.dom_ifattach = in_domifattach,80.dom_ifdetach = in_domifdetach,81.dom_nprotosw = 14,82.dom_protosw = {83&tcp_protosw,84&udp_protosw,85#ifdef SCTP86&sctp_seqpacket_protosw,87&sctp_stream_protosw,88#else89NULL, NULL,90#endif91&udplite_protosw,92&rip_protosw,93/* Spacer 8 times for loadable protocols. XXXGL: why 8? */94NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,95},96};9798DOMAIN_SET(inet);99#endif /* INET */100101SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,102"Internet Family");103104SYSCTL_NODE(_net_inet, IPPROTO_IP, ip, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,105"IP");106SYSCTL_NODE(_net_inet, IPPROTO_ICMP, icmp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,107"ICMP");108SYSCTL_NODE(_net_inet, IPPROTO_UDP, udp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,109"UDP");110SYSCTL_NODE(_net_inet, IPPROTO_TCP, tcp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,111"TCP");112#if defined(SCTP) || defined(SCTP_SUPPORT)113SYSCTL_NODE(_net_inet, IPPROTO_SCTP, sctp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,114"SCTP");115#endif116SYSCTL_NODE(_net_inet, IPPROTO_IGMP, igmp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,117"IGMP");118#if defined(IPSEC) || defined(IPSEC_SUPPORT)119/* XXX no protocol # to use, pick something "reserved" */120SYSCTL_NODE(_net_inet, 253, ipsec, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,121"IPSEC");122SYSCTL_NODE(_net_inet, IPPROTO_AH, ah, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,123"AH");124SYSCTL_NODE(_net_inet, IPPROTO_ESP, esp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,125"ESP");126SYSCTL_NODE(_net_inet, IPPROTO_IPCOMP, ipcomp, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,127"IPCOMP");128SYSCTL_NODE(_net_inet, IPPROTO_IPIP, ipip, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,129"IPIP");130#endif /* IPSEC */131SYSCTL_NODE(_net_inet, IPPROTO_RAW, raw, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,132"RAW");133SYSCTL_NODE(_net_inet, OID_AUTO, accf, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,134"Accept filters");135136137