summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2018-09-06 06:41:59 +0000
committermaxv <maxv@NetBSD.org>2018-09-06 06:41:59 +0000
commitc858eebf4d00a3df6932882fa2369835d1141213 (patch)
tree1a14bbcf72717f0cf9f2150af3744ea39f1e1614 /sys
parentaa932dd1f430ab4101fd3017d5499ea42922f4b9 (diff)
Remove the network ATM code.
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/common/if_43.c7
-rw-r--r--sys/compat/common/uipc_syscalls_43.c5
-rw-r--r--sys/compat/netbsd32/netbsd32_ioctl.h5
-rw-r--r--sys/conf/files6
-rw-r--r--sys/net/Makefile4
-rw-r--r--sys/net/files.net4
-rw-r--r--sys/net/if.c5
-rw-r--r--sys/net/if_atm.h164
-rw-r--r--sys/net/if_atmsubr.c328
-rw-r--r--sys/net/netisr.h8
-rw-r--r--sys/net/netisr_dispatch.h5
-rw-r--r--sys/netinet/Makefile4
-rw-r--r--sys/netinet/if_atm.c261
-rw-r--r--sys/netinet/if_atm.h39
-rw-r--r--sys/netnatm/Makefile7
-rw-r--r--sys/netnatm/files.netnatm7
-rw-r--r--sys/netnatm/natm.c547
-rw-r--r--sys/netnatm/natm.h147
-rw-r--r--sys/netnatm/natm_pcb.c176
-rw-r--r--sys/netnatm/natm_proto.c120
20 files changed, 17 insertions, 1832 deletions
diff --git a/sys/compat/common/if_43.c b/sys/compat/common/if_43.c
index e68697878c1..e7269e02c99 100644
--- a/sys/compat/common/if_43.c
+++ b/sys/compat/common/if_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.14 2017/07/29 04:08:47 riastradh Exp $ */
+/* $NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14 2017/07/29 04:08:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.15 2018/09/06 06:41:59 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -64,7 +64,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.14 2017/07/29 04:08:47 riastradh Exp $")
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/if_gre.h>
-#include <net/if_atm.h>
#include <net/if_tap.h>
#include <net80211/ieee80211_ioctl.h>
#include <netinet6/in6_var.h>
@@ -179,7 +178,6 @@ compat_cvtcmd(u_long cmd)
case SIOCGIFPSRCADDR_IN6:
case SIOCGIFSTAT_ICMP6:
case SIOCGIFSTAT_IN6:
- case SIOCGPVCSIF:
case SIOCGVH:
case SIOCIFCREATE:
case SIOCIFDESTROY:
@@ -199,7 +197,6 @@ compat_cvtcmd(u_long cmd)
case SIOCSIFNETMASK_IN6:
case SIOCSNDFLUSH_IN6:
case SIOCSPFXFLUSH_IN6:
- case SIOCSPVCSIF:
case SIOCSRTRFLUSH_IN6:
case SIOCSVH:
case TAPGIFNAME:
diff --git a/sys/compat/common/uipc_syscalls_43.c b/sys/compat/common/uipc_syscalls_43.c
index 9d92134ff80..9640ae0f67e 100644
--- a/sys/compat/common/uipc_syscalls_43.c
+++ b/sys/compat/common/uipc_syscalls_43.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_syscalls_43.c,v 1.49 2018/05/03 21:43:33 christos Exp $ */
+/* $NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.49 2018/05/03 21:43:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.50 2018/09/06 06:41:59 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -61,7 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.49 2018/05/03 21:43:33 christ
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/if_gre.h>
-#include <net/if_atm.h>
#include <net/if_tap.h>
#include <net80211/ieee80211_ioctl.h>
#include <netinet6/in6_var.h>
diff --git a/sys/compat/netbsd32/netbsd32_ioctl.h b/sys/compat/netbsd32/netbsd32_ioctl.h
index 40f5158f75a..26683c25b8d 100644
--- a/sys/compat/netbsd32/netbsd32_ioctl.h
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.60 2018/09/02 16:13:42 maxv Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.61 2018/09/06 06:41:59 maxv Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -213,9 +213,6 @@ dev/wscons/wsconsio.h:241:#define WSDISPLAYIO_SFONT _IOW('W', 77, struct wsdispl
net/if_ppp.h:110:#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
net/if_ppp.h:111:#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
-net/if_atm.h:88:#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
-net/if_atm.h:89:#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
-
net/if_ppp.h:105:#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
sys/module.h?
diff --git a/sys/conf/files b/sys/conf/files
index 546f948243e..bea2ffc266a 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1205 2018/09/06 05:36:51 maxv Exp $
+# $NetBSD: files,v 1.1206 2018/09/06 06:42:00 maxv Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@@ -237,7 +237,6 @@ include "netinet/files.netinet"
include "netinet6/files.netinet6"
include "netipsec/files.netipsec"
include "netmpls/files.netmpls"
-include "netnatm/files.netnatm"
include "netsmb/files.netsmb"
include "net/npf/files.npf"
@@ -418,10 +417,9 @@ include "dev/splash/files.splash"
include "dev/videomode/files.videomode"
# net device attributes - we have generic code for arc(net), ether(net),
-# fddi, token ring, and atm.
+# fddi, and token ring.
#
define arcnet
-define atm
define ether
define fddi
define hippi
diff --git a/sys/net/Makefile b/sys/net/Makefile
index 3b541901d75..3e00f557842 100644
--- a/sys/net/Makefile
+++ b/sys/net/Makefile
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.37 2018/08/14 14:49:13 maxv Exp $
+# $NetBSD: Makefile,v 1.38 2018/09/06 06:42:00 maxv Exp $
INCSDIR= /usr/include/net
INCS= bpf.h bpfjit.h bpfdesc.h dlt.h ethertypes.h if.h if_arc.h if_arp.h \
- if_atm.h if_bridgevar.h if_dl.h if_ether.h if_fddi.h if_gif.h \
+ if_bridgevar.h if_dl.h if_ether.h if_fddi.h if_gif.h \
if_gre.h if_hippi.h if_ieee1394.h if_ipsec.h if_llc.h if_media.h if_mpls.h \
if_pflog.h if_ppp.h if_pppoe.h if_l2tp.h if_sppp.h if_srt.h if_stf.h \
if_tap.h if_token.h if_tun.h if_types.h if_vlanvar.h net_stats.h \
diff --git a/sys/net/files.net b/sys/net/files.net
index 7beb5ebd40f..6d43ef2e926 100644
--- a/sys/net/files.net
+++ b/sys/net/files.net
@@ -1,4 +1,4 @@
-# $NetBSD: files.net,v 1.17 2018/08/14 14:49:13 maxv Exp $
+# $NetBSD: files.net,v 1.18 2018/09/06 06:42:00 maxv Exp $
# XXX CLEANUP
define net
@@ -9,7 +9,6 @@ file net/bsd-comp.c ppp & ppp_bsdcomp
file net/dl_print.c
file net/if.c net
file net/if_arcsubr.c arcnet needs-flag
-file net/if_atmsubr.c atm
file net/if_bridge.c bridge needs-flag
file net/bridgestp.c bridge
file net/if_ethersubr.c ether | fddi | netatalk | token |
@@ -55,7 +54,6 @@ file netinet/accf_data.c accf_data
file netinet/accf_http.c accf_http
file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum
file netinet/if_arp.c arp | netatalk needs-flag
-file netinet/if_atm.c atm
file netinet/in4_cksum.c inet
file netinet/in_cksum.c inet
file netinet/in_gif.c gif & inet
diff --git a/sys/net/if.c b/sys/net/if.c
index a584f6f1733..a3dd929a31d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.434 2018/08/27 04:53:24 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.435 2018/09/06 06:42:00 maxv Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,13 +90,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.434 2018/08/27 04:53:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.435 2018/09/06 06:42:00 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
#include "opt_ipsec.h"
#include "opt_atalk.h"
-#include "opt_natm.h"
#include "opt_wlan.h"
#include "opt_net_mpsafe.h"
#include "opt_mrouting.h"
diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h
deleted file mode 100644
index 78daeb3f00c..00000000000
--- a/sys/net/if_atm.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $NetBSD: if_atm.h,v 1.21 2016/04/28 00:16:56 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * net/if_atm.h
- */
-
-#ifndef _NET_IF_ATM_H_
-#define _NET_IF_ATM_H_
-
-#include <sys/ioccom.h>
-
-#if (defined(__FreeBSD__) || defined(__bsdi__)) && defined(KERNEL)
-#ifndef _KERNEL
-#define _KERNEL
-#endif
-#endif /* freebsd doesn't define _KERNEL */
-
-#ifndef NO_ATM_PVCEXT
-/*
- * ATM_PVCEXT enables PVC extension: VP/VC shaping
- * and PVC shadow interfaces.
- */
-#define ATM_PVCEXT /* enable pvc extension */
-#endif
-
-#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
-#define RTALLOC1(A,B) rtalloc1((A),(B))
-#elif defined(__FreeBSD__)
-#define RTALLOC1(A,B) rtalloc1((A),(B),0UL)
-#endif
-
-/*
- * pseudo header for packet transmission
- */
-
-struct atm_pseudohdr {
- uint8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */
-};
-
-#define ATM_PH_FLAGS(X) ((X)->atm_ph[0])
-#define ATM_PH_VPI(X) ((X)->atm_ph[1])
-#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))
-#define ATM_PH_SETVCI(X,V) { \
- (X)->atm_ph[2] = ((V) >> 8) & 0xff; \
- (X)->atm_ph[3] = ((V) & 0xff); \
-}
-
-#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */
-#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */
-
-#ifdef ATM_PVCEXT
-#define ATM_PH_INERNAL 0x20 /* reserve for kernel internal use */
-#endif
-#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */
-#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */
-
-#define ATMMTU 9180 /* ATM MTU size for IP */
- /* XXX: could be 9188 with LLC/SNAP according
- to comer */
-
-/* user's ioctl hook for raw atm mode */
-#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */
-
-/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
-struct atm_pseudoioctl {
- struct atm_pseudohdr aph;
- void *rxhand;
-};
-#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
-#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
-
-#ifdef ATM_PVCEXT
-
-/* structure to control PVC transmitter */
-struct pvctxreq {
- /* first entry must be compatible with struct ifreq */
- char pvc_ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
- struct atm_pseudohdr pvc_aph; /* (flags) + vpi:vci */
- struct atm_pseudohdr pvc_joint; /* for vp shaping: another vc
- to share the shaper */
- int pvc_pcr; /* peak cell rate (shaper value) */
-};
-
-/* use ifioctl for now */
-#define SIOCSPVCTX _IOWR('i', 95, struct pvctxreq)
-#define SIOCGPVCTX _IOWR('i', 96, struct pvctxreq)
-#define SIOCSPVCSIF _IOWR('i', 97, struct ifreq)
-#define SIOCGPVCSIF _IOWR('i', 98, struct ifreq)
-
-#endif /* ATM_PVCEXT */
-
-/*
- * XXX forget all the garbage in if_llc.h and do it the easy way
- */
-
-#define ATMLLC_HDR "\252\252\3\0\0\0"
-struct atmllc {
- uint8_t llchdr[6]; /* aa.aa.03.00.00.00 */
- uint8_t type[2]; /* "ethernet" type */
-} __packed;
-
-/* ATM_LLC macros: note type code in host byte order */
-#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
-#define ATM_LLC_SETTYPE(X,V) { \
- (X)->type[0] = ((V) >> 8) & 0xff; \
- (X)->type[1] = ((V) & 0xff); \
-}
-
-#ifdef _KERNEL
-void atm_ifattach(struct ifnet *);
-void atm_input(struct ifnet *, struct atm_pseudohdr *,
- struct mbuf *, void *);
-int atm_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
- const struct rtentry *);
-#endif
-#ifdef ATM_PVCEXT
-#ifdef _KERNEL
-#include <sys/queue.h>
-/*
- * ATM PVC subinterface: a trick to assign a subinterface
- * to a PVC.
- * with a pvc subinterface, each PVC looks like an individual
- * Point-to-Point interface.
- * as opposed to the NBMA model, a pvc subinterface is inherently
- * multicast capable (no LANE/MARS required).
- */
-struct pvcsif {
- /*
- * The ifnet struct _must_ be at the head of this structure.
- */
- struct ifnet sif_if; /* ifnet structure per pvc */
- struct atm_pseudohdr sif_aph; /* flags + vpi:vci */
- int sif_vci; /* vci no */
- LIST_ENTRY(pvcsif) sif_links;
-};
-struct ifnet *pvcsif_alloc(void);
-#endif
-#endif /* ATM_PVCEXT */
-#endif /* !_NET_IF_ATM_H_ */
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
deleted file mode 100644
index d1d9de82bec..00000000000
--- a/sys/net/if_atmsubr.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $NetBSD: if_atmsubr.c,v 1.61 2017/01/11 13:08:29 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * if_atmsubr.c
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atmsubr.c,v 1.61 2017/01/11 13:08:29 ozaki-r Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_inet.h"
-#include "opt_gateway.h"
-#include "opt_natm.h"
-#endif
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-
-#include <sys/cpu.h>
-
-#include <net/if.h>
-#include <net/netisr.h>
-#include <net/route.h>
-#include <net/if_dl.h>
-#include <net/if_types.h>
-#include <net/if_atm.h>
-#include <net/ethertypes.h> /* XXX: for ETHERTYPE_* */
-
-#include <net/bpf.h>
-
-#include <netinet/in.h>
-#include <netinet/if_atm.h>
-
-#if defined(INET) || defined(INET6)
-#include <netinet/in_var.h>
-#endif
-#ifdef NATM
-#include <netnatm/natm.h>
-#endif
-
-#define senderr(e) { error = (e); goto bad;}
-
-/*
- * atm_output: ATM output routine
- * inputs:
- * "ifp" = ATM interface to output to
- * "m0" = the packet to output
- * "dst" = the sockaddr to send to (either IP addr, or raw VPI/VCI)
- * "rt0" = the route to use
- * returns: error code [0 == ok]
- *
- * note: special semantic: if (dst == NULL) then we assume "m" already
- * has an atm_pseudohdr on it and just send it directly.
- * [for native mode ATM output] if dst is null, then
- * rt0 must also be NULL.
- */
-
-int
-atm_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
- const struct rtentry *rt)
-{
- uint16_t etype = 0; /* if using LLC/SNAP */
- int error = 0, sz;
- struct atm_pseudohdr atmdst, *ad;
- struct mbuf *m = m0;
- struct atmllc *atmllc;
- uint32_t atm_flags;
-
- if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
- senderr(ENETDOWN);
-
- /*
- * If the queueing discipline needs packet classification,
- * do it before prepending link headers.
- */
- IFQ_CLASSIFY(&ifp->if_snd, m,
- (dst != NULL ? dst->sa_family : AF_UNSPEC));
-
- /*
- * check for non-native ATM traffic (dst != NULL)
- */
- if (dst) {
- switch (dst->sa_family) {
-#ifdef INET
- case AF_INET:
-#endif
-#ifdef INET6
- case AF_INET6:
-#endif
-#if defined(INET) || defined(INET6)
- if (dst->sa_family == AF_INET)
- etype = ETHERTYPE_IP;
- else
- etype = ETHERTYPE_IPV6;
-# ifdef ATM_PVCEXT
- if (ifp->if_flags & IFF_POINTOPOINT) {
- /* pvc subinterface */
- struct pvcsif *pvcsif = (struct pvcsif *)ifp;
- atmdst = pvcsif->sif_aph;
- break;
- }
-# endif
- if (!atmresolve(rt, m, dst, &atmdst)) {
- m = NULL;
- /* XXX: atmresolve already free'd it */
- senderr(EHOSTUNREACH);
- /* XXX: put ATMARP stuff here */
- /* XXX: watch who frees m on failure */
- }
- break;
-#endif
-
- case AF_UNSPEC:
- /*
- * XXX: bpfwrite or output from a pvc shadow if.
- * assuming dst contains 12 bytes (atm pseudo
- * header (4) + LLC/SNAP (8))
- */
- memcpy(&atmdst, dst->sa_data, sizeof(atmdst));
- break;
-
- default:
- printf("%s: can't handle af%d\n", ifp->if_xname,
- dst->sa_family);
- senderr(EAFNOSUPPORT);
- }
-
- /*
- * must add atm_pseudohdr to data
- */
- sz = sizeof(atmdst);
- atm_flags = ATM_PH_FLAGS(&atmdst);
- if (atm_flags & ATM_PH_LLCSNAP)
- sz += 8; /* sizeof snap == 8 */
- M_PREPEND(m, sz, M_DONTWAIT);
- if (m == 0)
- senderr(ENOBUFS);
- ad = mtod(m, struct atm_pseudohdr *);
- *ad = atmdst;
- if (atm_flags & ATM_PH_LLCSNAP) {
- atmllc = (struct atmllc *)(ad + 1);
- memcpy(atmllc->llchdr, ATMLLC_HDR,
- sizeof(atmllc->llchdr));
- ATM_LLC_SETTYPE(atmllc, etype);
- }
- }
-
- return ifq_enqueue(ifp, m);
-
-bad:
- if (m)
- m_freem(m);
- return (error);
-}
-
-/*
- * Process a received ATM packet;
- * the packet is in the mbuf chain m.
- */
-void
-atm_input(struct ifnet *ifp, struct atm_pseudohdr *ah, struct mbuf *m,
- void *rxhand)
-{
- pktqueue_t *pktq = NULL;
- uint16_t etype = ETHERTYPE_IP; /* default */
-
- if ((ifp->if_flags & IFF_UP) == 0) {
- m_freem(m);
- return;
- }
- ifp->if_ibytes += m->m_pkthdr.len;
-
- if (rxhand) {
-#ifdef NATM
- struct natmpcb *npcb = rxhand;
- struct ifqueue *inq;
- int s, isr = 0;
-
- s = splnet(); /* in case 2 atm cards @ diff lvls */
- npcb->npcb_inq++; /* count # in queue */
- splx(s);
- isr = NETISR_NATM;
- inq = &natmintrq;
- m_set_rcvif(m, rxhand); /* XXX: overload */
-
- IFQ_LOCK(inq);
- if (IF_QFULL(inq)) {
- IF_DROP(inq);
- IFQ_UNLOCK(inq);
- m_freem(m);
- } else {
- IF_ENQUEUE(inq, m);
- IFQ_UNLOCK(inq);
- schednetisr(isr);
- }
-#else
- printf("%s: NATM detected but not configured in kernel\n",
- __func__);
- m_freem(m);
-#endif
- return;
- }
-
- /*
- * handle LLC/SNAP header, if present
- */
- if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) {
- struct atmllc *alc;
- if (m->m_len < sizeof(*alc) &&
- (m = m_pullup(m, sizeof(*alc))) == NULL)
- return; /* failed */
- alc = mtod(m, struct atmllc *);
- if (memcmp(alc, ATMLLC_HDR, 6)) {
- printf(
- "%s: recv'd invalid LLC/SNAP frame [vp=%d,vc=%d]\n",
- ifp->if_xname, ATM_PH_VPI(ah), ATM_PH_VCI(ah));
- m_freem(m);
- return;
- }
- etype = ATM_LLC_TYPE(alc);
- m_adj(m, sizeof(*alc));
- }
-
- switch (etype) {
-#ifdef INET
- case ETHERTYPE_IP:
-#if 0 /* XXX re-enable once atm_input runs in softint */
- if (ipflow_fastforward(m))
- return;
-#endif
- pktq = ip_pktq;
- break;
-#endif /* INET */
-#ifdef INET6
- case ETHERTYPE_IPV6:
-#if 0 /* XXX re-enable once atm_input runs in softint */
- if (ip6flow_fastforward(&m))
- return;
-#endif
- pktq = ip6_pktq;
- break;
-#endif
- default:
- m_freem(m);
- return;
- }
-
- if (__predict_false(!pktq_enqueue(pktq, m, 0))) {
- m_freem(m);
- }
-}
-
-/*
- * Perform common duties while attaching to interface list
- */
-void
-atm_ifattach(struct ifnet *ifp)
-{
-
- ifp->if_type = IFT_ATM;
- ifp->if_addrlen = 0;
- ifp->if_hdrlen = 0;
- ifp->if_dlt = DLT_ATM_RFC1483;
- ifp->if_mtu = ATMMTU;
- ifp->if_output = atm_output;
-#if 0 /* XXX XXX XXX */
- ifp->if_input = atm_input;
-#endif
-
- if_alloc_sadl(ifp);
- /* XXX Store LLADDR for ATMARP. */
-
- bpf_attach(ifp, DLT_ATM_RFC1483, sizeof(struct atmllc));
-}
-
-#ifdef ATM_PVCEXT
-
-static int pvc_max_number = 16; /* max number of PVCs */
-static int pvc_number = 0; /* pvc unit number */
-
-struct ifnet *
-pvcsif_alloc(void)
-{
- struct pvcsif *pvcsif;
-
- if (pvc_number >= pvc_max_number)
- return NULL;
- pvcsif = malloc(sizeof(struct pvcsif),
- M_DEVBUF, M_WAITOK|M_ZERO);
- if (pvcsif == NULL)
- return NULL;
-
- snprintf(pvcsif->sif_if.if_xname, sizeof(pvcsif->sif_if.if_xname),
- "pvc%d", pvc_number++);
- return (&pvcsif->sif_if);
-}
-#endif /* ATM_PVCEXT */
diff --git a/sys/net/netisr.h b/sys/net/netisr.h
index c355794d10c..b4456f8d5a9 100644
--- a/sys/net/netisr.h
+++ b/sys/net/netisr.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netisr.h,v 1.45 2017/05/27 21:02:56 bouyer Exp $ */
+/* $NetBSD: netisr.h,v 1.46 2018/09/06 06:42:00 maxv Exp $ */
/*
* Copyright (c) 1980, 1986, 1989, 1993
@@ -52,7 +52,6 @@
#include "opt_inet.h"
#include "opt_atalk.h"
#include "opt_mpls.h"
-#include "opt_natm.h"
#include "opt_can.h"
#include "arp.h"
#endif /* defined(_KERNEL_OPT) */
@@ -63,7 +62,7 @@
#include <sys/socket.h>
/*
- * XXX IFNAMSIZE for if_ppp.h, natm.h; struct ifnet decl for in6.h, in.h;
+ * XXX IFNAMSIZE for if_ppp.h; struct ifnet decl for in6.h, in.h;
* XXX struct mbuf decl for in6.h, in.h, route.h (via in_var.h).
*/
#include <net/if.h>
@@ -85,9 +84,6 @@
#ifdef MPLS
#include <netmpls/mpls_var.h>
#endif
-#ifdef NATM
-#include <netnatm/natm.h>
-#endif
#ifdef NETATALK
#include <netatalk/at_extern.h>
#endif
diff --git a/sys/net/netisr_dispatch.h b/sys/net/netisr_dispatch.h
index 470e6522f42..b0ccc8cf79e 100644
--- a/sys/net/netisr_dispatch.h
+++ b/sys/net/netisr_dispatch.h
@@ -1,4 +1,4 @@
-/* $NetBSD: netisr_dispatch.h,v 1.19 2017/05/27 21:02:56 bouyer Exp $ */
+/* $NetBSD: netisr_dispatch.h,v 1.20 2018/09/06 06:42:00 maxv Exp $ */
#ifndef _NET_NETISR_DISPATCH_H_
#define _NET_NETISR_DISPATCH_H_
@@ -38,9 +38,6 @@
#ifdef MPLS
DONETISR(NETISR_MPLS,mplsintr);
#endif
-#ifdef NATM
- DONETISR(NETISR_NATM,natmintr);
-#endif
#ifdef CAN
DONETISR(NETISR_CAN,canintr);
#endif
diff --git a/sys/netinet/Makefile b/sys/netinet/Makefile
index ea419888db1..984f554f644 100644
--- a/sys/netinet/Makefile
+++ b/sys/netinet/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.29 2018/07/11 11:13:16 kre Exp $
+# $NetBSD: Makefile,v 1.30 2018/09/06 06:42:00 maxv Exp $
INCSDIR= /usr/include/netinet
-INCS= dccp.h icmp6.h icmp_var.h if_atm.h if_ether.h if_inarp.h igmp.h \
+INCS= dccp.h icmp6.h icmp_var.h if_ether.h if_inarp.h igmp.h \
igmp_var.h in.h in_gif.h in_l2tp.h in_pcb.h in_pcb_hdr.h \
in_offload.h in_selsrc.h in_systm.h \
in_var.h ip.h ip_carp.h ip6.h ip_ecn.h ip_encap.h \
diff --git a/sys/netinet/if_atm.c b/sys/netinet/if_atm.c
deleted file mode 100644
index b1a5dced617..00000000000
--- a/sys/netinet/if_atm.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* $NetBSD: if_atm.c,v 1.39 2016/12/12 03:55:57 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * IP <=> ATM address resolution.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_atm.c,v 1.39 2016/12/12 03:55:57 ozaki-r Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_inet.h"
-#include "opt_natm.h"
-#endif
-
-#if defined(INET) || defined(INET6)
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/syslog.h>
-#include <sys/proc.h>
-
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <net/if_atm.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_atm.h>
-
-#ifdef NATM
-#include <netnatm/natm.h>
-#endif
-
-
-/*
- * atm_rtrequest: handle ATM rt request (in support of generic code)
- * inputs: "req" = request code
- * "rt" = route entry
- * "sa" = sockaddr
- */
-
-void
-atm_rtrequest(int req, struct rtentry *rt, const struct rt_addrinfo *info)
-{
- struct sockaddr *gate = rt->rt_gateway;
- struct atm_pseudoioctl api;
-#ifdef NATM
- const struct sockaddr_in *sin;
- struct natmpcb *npcb = NULL;
- const struct atm_pseudohdr *aph;
-#endif
- const struct ifnet *ifp = rt->rt_ifp;
- uint8_t namelen = strlen(ifp->if_xname);
- uint8_t addrlen = ifp->if_addrlen;
-
- if (rt->rt_flags & RTF_GATEWAY) /* link level requests only */
- return;
-
- switch (req) {
-
- case RTM_ADD:
-
- /*
- * route added by a command (e.g. ifconfig, route, arp...).
- *
- * first check to see if this is not a host route, in which
- * case we are being called via "ifconfig" to set the address.
- */
-
- if ((rt->rt_flags & RTF_HOST) == 0) {
- union {
- struct sockaddr sa;
- struct sockaddr_dl sdl;
- struct sockaddr_storage ss;
- } u;
-
- sockaddr_dl_init(&u.sdl, sizeof(u.ss),
- ifp->if_index, ifp->if_type,
- NULL, namelen, NULL, addrlen);
- rt_setgate(rt, &u.sa);
- gate = rt->rt_gateway;
- break;
- }
-
- if (gate->sa_family != AF_LINK ||
- gate->sa_len < sockaddr_dl_measure(namelen, addrlen)) {
- log(LOG_DEBUG, "atm_rtrequest: bad gateway value\n");
- break;
- }
-
-#ifdef DIAGNOSTIC
- if (rt->rt_ifp->if_ioctl == NULL) panic("atm null ioctl");
-#endif
-
-#ifdef NATM
- /*
- * let native ATM know we are using this VCI/VPI
- * (i.e. reserve it)
- */
- sin = satocsin(rt_getkey(rt));
- if (sin->sin_family != AF_INET)
- goto failed;
- aph = (const struct atm_pseudohdr *)CLLADDR(satosdl(gate));
- npcb = npcb_add(NULL, rt->rt_ifp, ATM_PH_VCI(aph),
- ATM_PH_VPI(aph));
- if (npcb == NULL)
- goto failed;
- npcb->npcb_flags |= NPCB_IP;
- npcb->ipaddr.s_addr = sin->sin_addr.s_addr;
- /* XXX: move npcb to llinfo when ATM ARP is ready */
- rt->rt_llinfo = (void *) npcb;
-#endif
- /*
- * let the lower level know this circuit is active
- */
- memcpy(&api.aph, CLLADDR(satocsdl(gate)), sizeof(api.aph));
- api.rxhand = NULL;
- if (rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMENA, &api) != 0) {
- printf("atm: couldn't add VC\n");
- goto failed;
- }
-
- satosdl(gate)->sdl_type = rt->rt_ifp->if_type;
- satosdl(gate)->sdl_index = rt->rt_ifp->if_index;
-
- break;
-
-failed:
-#ifdef NATM
- if (npcb) {
- npcb_free(npcb, NPCB_DESTROY);
- rt->rt_llinfo = NULL;
- }
-#endif
- rtrequest(RTM_DELETE, rt_getkey(rt), NULL,
- rt_mask(rt), 0, NULL);
- break;
-
- case RTM_DELETE:
-
- /*
- * tell the lower layer to disable this circuit
- */
-
- memcpy(&api.aph, CLLADDR(satocsdl(gate)), sizeof(api.aph));
- api.rxhand = NULL;
- (void)rt->rt_ifp->if_ioctl(rt->rt_ifp, SIOCATMDIS, &api);
-
- break;
- }
-}
-
-/*
- * atmresolve:
- * inputs:
- * [1] "rt" = the link level route to use (or null if need to look one up)
- * [2] "m" = mbuf containing the data to be sent
- * [3] "dst" = sockaddr_in (IP) address of dest.
- * output:
- * [4] "desten" = ATM pseudo header which we will fill in VPI/VCI info
- * return:
- * 0 == resolve FAILED; note that "m" gets m_freem'd in this case
- * 1 == resolve OK; desten contains result
- *
- * XXX: will need more work if we wish to support ATMARP in the kernel,
- * but this is enough for PVCs entered via the "route" command.
- */
-
-int
-atmresolve(const struct rtentry *rt0, struct mbuf *m, const struct sockaddr *dst,
- struct atm_pseudohdr *desten /* OUT */)
-{
- const struct sockaddr_dl *sdl;
- struct rtentry *rt = NULL;
-
- if (m->m_flags & (M_BCAST|M_MCAST)) {
- log(LOG_INFO, "atmresolve: BCAST/MCAST packet detected/dumped\n");
- goto bad;
- }
-
- if (rt0 == NULL) {
- rt = RTALLOC1(dst, 0);
- if (rt == NULL)
- goto bad; /* failed */
- if ((rt->rt_flags & RTF_GATEWAY) != 0 ||
- /* XXX: are we using LLINFO? */
- rt->rt_gateway->sa_family != AF_LINK) {
- rt_unref(rt);
- goto bad;
- }
- }
-
- /*
- * note that rt_gateway is a sockaddr_dl which contains the
- * atm_pseudohdr data structure for this route. we currently
- * don't need any rt_llinfo info (but will if we want to support
- * ATM ARP [c.f. if_ether.c]).
- */
-
- sdl = satocsdl((rt ? rt : rt0)->rt_gateway);
-
- /*
- * Check the address family and length is valid, the address
- * is resolved; otherwise, try to resolve.
- */
-
- if (sdl->sdl_family == AF_LINK && sdl->sdl_alen == sizeof(*desten)) {
- memcpy(desten, CLLADDR(sdl), sdl->sdl_alen);
- if (rt != NULL)
- rt_unref(rt);
- return (1); /* ok, go for it! */
- }
-
- if (rt != NULL)
- rt_unref(rt);
-
- /*
- * we got an entry, but it doesn't have valid link address
- * info in it (it is prob. the interface route, which has
- * sdl_alen == 0). dump packet. (fall through to "bad").
- */
-
-bad:
- m_freem(m);
- return (0);
-}
-#endif /* INET */
diff --git a/sys/netinet/if_atm.h b/sys/netinet/if_atm.h
deleted file mode 100644
index 1e7d4298bbe..00000000000
--- a/sys/netinet/if_atm.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $NetBSD: if_atm.h,v 1.13 2016/04/28 00:16:56 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NETINET_IF_ATM_H_
-#define _NETINET_IF_ATM_H_
-
-/*
- * if_atm.h
- */
-
-void atm_rtrequest(int, struct rtentry *, const struct rt_addrinfo *);
-int atmresolve(const struct rtentry *, struct mbuf *, const struct sockaddr *,
- struct atm_pseudohdr *);
-
-#endif /* !_NETINET_IF_ATM_H_ */
diff --git a/sys/netnatm/Makefile b/sys/netnatm/Makefile
deleted file mode 100644
index cd4c827e8f2..00000000000
--- a/sys/netnatm/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# $NetBSD: Makefile,v 1.2 2002/11/26 23:30:33 lukem Exp $
-
-INCSDIR= /usr/include/netnatm
-
-INCS= natm.h
-
-.include <bsd.kinc.mk>
diff --git a/sys/netnatm/files.netnatm b/sys/netnatm/files.netnatm
deleted file mode 100644
index d7cbd770f1e..00000000000
--- a/sys/netnatm/files.netnatm
+++ /dev/null
@@ -1,7 +0,0 @@
-# $NetBSD: files.netnatm,v 1.1 2002/10/10 22:58:49 thorpej Exp $
-
-defflag NATM # "native" ATM protocols
-
-file netnatm/natm.c natm
-file netnatm/natm_pcb.c natm
-file netnatm/natm_proto.c natm
diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c
deleted file mode 100644
index 6b1ae9267a9..00000000000
--- a/sys/netnatm/natm.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/* $NetBSD: natm.c,v 1.53 2016/10/03 11:06:06 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * natm.c: native mode ATM access (both aal0 and aal5).
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.53 2016/10/03 11:06:06 ozaki-r Exp $");
-
-#include <sys/param.h>
-#include <sys/kmem.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/domain.h>
-#include <sys/ioctl.h>
-#include <sys/protosw.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-
-#include <net/if.h>
-#include <net/if_atm.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-u_long natm5_sendspace = 16*1024;
-u_long natm5_recvspace = 16*1024;
-
-u_long natm0_sendspace = 16*1024;
-u_long natm0_recvspace = 16*1024;
-
-static int
-natm_attach(struct socket *so, int proto)
-{
- int error = 0;
- struct natmpcb *npcb;
-
- KASSERT(so->so_pcb == NULL);
- sosetlock(so);
-
- if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
- if (proto == PROTO_NATMAAL5)
- error = soreserve(so, natm5_sendspace, natm5_recvspace);
- else
- error = soreserve(so, natm0_sendspace, natm0_recvspace);
- if (error)
- return error;
- }
- npcb = npcb_alloc(true);
- npcb->npcb_socket = so;
- so->so_pcb = npcb;
- return error;
-}
-
-static void
-natm_detach(struct socket *so)
-{
- struct natmpcb *npcb = (struct natmpcb *)so->so_pcb;
-
- /*
- * we turn on 'drain' *before* we sofree.
- */
-
- npcb_free(npcb, NPCB_DESTROY); /* drain */
- so->so_pcb = NULL;
- /* sofree drops the lock */
- sofree(so);
- mutex_enter(softnet_lock);
-}
-
-static int
-natm_accept(struct socket *so, struct sockaddr *nam)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_bind(struct socket *so, struct sockaddr *nam, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_listen(struct socket *so, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_connect(struct socket *so, struct sockaddr *nam, struct lwp *l)
-{
- int error = 0, s2;
- struct natmpcb *npcb = (struct natmpcb *)so->so_pcb;
- struct sockaddr_natm *snatm = (struct sockaddr_natm *)nam;
- struct atm_pseudoioctl api;
- struct atm_pseudohdr *aph;
- struct ifnet *ifp;
- int proto = so->so_proto->pr_protocol;
-
- KASSERT(solocked(so));
-
- /*
- * validate snatm and npcb
- */
-
- if (snatm->snatm_len != sizeof(*snatm) ||
- (npcb->npcb_flags & NPCB_FREE) == 0)
- return EINVAL;
- if (snatm->snatm_family != AF_NATM)
- return EAFNOSUPPORT;
-
- snatm->snatm_if[IFNAMSIZ-1] = '\0'; /* XXX ensure null termination
- since ifunit() uses strcmp */
-
- /*
- * convert interface string to ifp, validate.
- */
-
- ifp = ifunit(snatm->snatm_if);
- if (ifp == NULL || (ifp->if_flags & IFF_RUNNING) == 0) {
- return ENXIO;
- }
- if (ifp->if_output != atm_output) {
- return EAFNOSUPPORT;
- }
-
- /*
- * register us with the NATM PCB layer
- */
-
- if (npcb_add(npcb, ifp, snatm->snatm_vci, snatm->snatm_vpi) != npcb)
- return EADDRINUSE;
-
- /*
- * enable rx
- */
-
- ATM_PH_FLAGS(&api.aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0;
- ATM_PH_VPI(&api.aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(&api.aph, npcb->npcb_vci);
- api.rxhand = npcb;
- s2 = splnet();
- if (ifp->if_ioctl(ifp, SIOCATMENA, &api) != 0) {
- splx(s2);
- npcb_free(npcb, NPCB_REMOVE);
- return EIO;
- }
- splx(s2);
-
- soisconnected(so);
- return error;
-}
-
-static int
-natm_connect2(struct socket *so, struct socket *so2)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_disconnect(struct socket *so)
-{
- struct natmpcb *npcb = (struct natmpcb *)so->so_pcb;
-
- KASSERT(solocked(so));
- KASSERT(npcb != NULL);
-
- if ((npcb->npcb_flags & NPCB_CONNECTED) == 0) {
- printf("natm: disconnected check\n");
- return EIO;
- }
- ifp = npcb->npcb_ifp;
-
- /*
- * disable rx
- */
- ATM_PH_FLAGS(&api.aph) = ATM_PH_AAL5;
- ATM_PH_VPI(&api.aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(&api.aph, npcb->npcb_vci);
- api.rxhand = npcb;
-
- s2 = splnet();
- ifp->if_ioctl(ifp, SIOCATMDIS, &api);
- splx(s);
-
- npcb_free(npcb, NPCB_REMOVE);
- soisdisconnected(so);
- return 0;
-}
-
-static int
-natm_shutdown(struct socket *so)
-{
- int s;
-
- KASSERT(solocked(so));
-
- s = splsoftnet();
- socantsendmore(so);
- splx(s);
-
- return 0;
-}
-
-static int
-natm_abort(struct socket *so)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp)
-{
- int error = 0, s;
- struct natmpcb *npcb;
- struct atm_rawioctl ario;
-
- s = SPLSOFTNET();
-
- npcb = (struct natmpcb *) so->so_pcb;
-
- /*
- * raw atm ioctl. comes in as a SIOCRAWATM. we convert it to
- * SIOCXRAWATM and pass it to the driver.
- */
- if (cmd == SIOCRAWATM) {
- if (npcb->npcb_ifp == NULL) {
- error = ENOTCONN;
- goto done;
- }
- ario.npcb = npcb;
- ario.rawvalue = *((int *)nam);
- error = npcb->npcb_ifp->if_ioctl(npcb->npcb_ifp, SIOCXRAWATM, &ario);
- if (!error) {
- if (ario.rawvalue)
- npcb->npcb_flags |= NPCB_RAW;
- else
- npcb->npcb_flags &= ~(NPCB_RAW);
- }
-
- goto done;
- }
-
- error = EOPNOTSUPP;
-
-done:
- splx(s);
- return(error);
-}
-
-static int
-natm_stat(struct socket *so, struct stat *ub)
-{
- KASSERT(solocked(so));
-
- return 0;
-}
-
-static int
-natm_peeraddr(struct socket *so, struct sockaddr *nam)
-{
- struct natmpcb *npcb = (struct natmpcb *) so->so_pcb;
- struct sockaddr_natm *snatm = (struct sockaddr_natm *)nam;
-
- KASSERT(solocked(so));
- KASSERT(pcb != NULL);
- KASSERT(nam != NULL);
-
- memset(snatm, 0, sizeof(*snatm));
- snatm->snatm_len = sizeof(*snatm);
- snatm->snatm_family = AF_NATM;
- memcpy(snatm->snatm_if, npcb->npcb_ifp->if_xname, sizeof(snatm->snatm_if));
- snatm->snatm_vci = npcb->npcb_vci;
- snatm->snatm_vpi = npcb->npcb_vpi;
- return 0;
-}
-
-static int
-natm_sockaddr(struct socket *so, struct sockaddr *nam)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_rcvd(struct socket *so, int flags, struct lwp *l)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_recvoob(struct socket *so, struct mbuf *m, int flags)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_send(struct socket *so, struct mbuf *m, struct sockaddr *nam,
- struct mbuf *control)
-{
- struct natmpcb *npcb = (struct natmpcb *) so->so_pcb;
- struct atm_pseudohdr *aph;
-
- KASSERT(solocked(so));
- KASSERT(pcb != NULL);
- KASSERT(m != NULL);
-
- if (control && control->m_len) {
- m_freem(control);
- m_freem(m);
- return EINVAL;
- }
-
- /*
- * send the data. we must put an atm_pseudohdr on first
- */
- s = SPLSOFTNET();
- M_PREPEND(m, sizeof(*aph), M_WAITOK);
- if (m == NULL) {
- error = ENOBUFS;
- break;
- }
- aph = mtod(m, struct atm_pseudohdr *);
- ATM_PH_VPI(aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(aph, npcb->npcb_vci);
- ATM_PH_FLAGS(aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0;
- error = atm_output(npcb->npcb_ifp, m, NULL, NULL);
- splx(s);
-
- return error;
-}
-
-static int
-natm_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control, struct lwp *l)
-{
- struct natmpcb *npcb = (struct natmpcb *) so->so_pcb;
- struct atm_pseudohdr *aph;
-
- KASSERT(solocked(so));
- KASSERT(pcb != NULL);
- KASSERT(m != NULL);
-
- if (control && control->m_len) {
- m_freem(control);
- m_freem(m);
- return EINVAL;
- }
-
- /*
- * send the data. we must put an atm_pseudohdr on first
- */
- s = SPLSOFTNET();
- M_PREPEND(m, sizeof(*aph), M_WAITOK);
- if (m == NULL) {
- error = ENOBUFS;
- break;
- }
- aph = mtod(m, struct atm_pseudohdr *);
- ATM_PH_VPI(aph) = npcb->npcb_vpi;
- ATM_PH_SETVCI(aph, npcb->npcb_vci);
- ATM_PH_FLAGS(aph) = (proto == PROTO_NATMAAL5) ? ATM_PH_AAL5 : 0;
- error = atm_output(npcb->npcb_ifp, m, NULL, NULL);
- splx(s);
-
- return error;
-}
-
-static int
-natm_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
-{
- KASSERT(solocked(so));
-
- return EOPNOTSUPP;
-}
-
-static int
-natm_purgeif(struct socket *so, struct ifnet *ifp)
-{
-
- return EOPNOTSUPP;
-}
-
-/*
- * natmintr: splsoftnet interrupt
- *
- * note: we expect a socket pointer in rcvif rather than an interface
- * pointer. we can get the interface pointer from the so's PCB if
- * we really need it.
- */
-
-void
-natmintr(void)
-
-{
- int s;
- struct mbuf *m;
- struct socket *so;
- struct natmpcb *npcb;
-
- mutex_enter(softnet_lock);
-next:
- IFQ_LOCK(&natmintrq);
- IF_DEQUEUE(&natmintrq, m);
- IFQ_UNLOCK(&natmintrq);
- if (m == NULL) {
- mutex_exit(softnet_lock);
- return;
- }
-
-#ifdef DIAGNOSTIC
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("natmintr no HDR");
-#endif
-
- npcb = (struct natmpcb *) m_get_rcvif_NOMPSAFE(m); /* XXX: overloaded */
- so = npcb->npcb_socket;
-
- s = splnet(); /* could have atm devs @ different levels */
- npcb->npcb_inq--;
- splx(s);
-
- if (npcb->npcb_flags & NPCB_DRAIN) {
- m_freem(m);
- if (npcb->npcb_inq == 0)
- kmem_intr_free(npcb, sizeof(*npcb));
- goto next;
- }
-
- if (npcb->npcb_flags & NPCB_FREE) {
- m_freem(m); /* drop */
- goto next;
- }
-
-#ifdef NEED_TO_RESTORE_IFP
- m_set_rcvif(m, npcb->npcb_ifp);
-#else
-#ifdef DIAGNOSTIC
- m_reset_rcvif(m); /* null it out to be safe */
-#endif
-#endif
-
- if (sbspace(&so->so_rcv) > m->m_pkthdr.len ||
- ((npcb->npcb_flags & NPCB_RAW) != 0 && so->so_rcv.sb_cc < NPCB_RAWCC) ) {
-#ifdef NATM_STAT
- natm_sookcnt++;
- natm_sookbytes += m->m_pkthdr.len;
-#endif
- sbappendrecord(&so->so_rcv, m);
- sorwakeup(so);
- } else {
-#ifdef NATM_STAT
- natm_sodropcnt++;
- natm_sodropbytes += m->m_pkthdr.len;
-#endif
- m_freem(m);
- }
-
- goto next;
-}
-
-PR_WRAP_USRREQS(natm)
-#define natm_attach natm_attach_wrapper
-#define natm_detach natm_detach_wrapper
-#define natm_accept natm_accept_wrapper
-#define natm_bind natm_bind_wrapper
-#define natm_listen natm_listen_wrapper
-#define natm_connect natm_connect_wrapper
-#define natm_connect2 natm_connect2_wrapper
-#define natm_disconnect natm_disconnect_wrapper
-#define natm_shutdown natm_shutdown_wrapper
-#define natm_abort natm_abort_wrapper
-#define natm_ioctl natm_ioctl_wrapper
-#define natm_stat natm_stat_wrapper
-#define natm_peeraddr natm_peeraddr_wrapper
-#define natm_sockaddr natm_sockaddr_wrapper
-#define natm_rcvd natm_rcvd_wrapper
-#define natm_recvoob natm_recvoob_wrapper
-#define natm_send natm_send_wrapper
-#define natm_sendoob natm_sendoob_wrapper
-#define natm_purgeif natm_purgeif_wrapper
-
-const struct pr_usrreqs natm_usrreqs = {
- .pr_attach = natm_attach,
- .pr_detach = natm_detach,
- .pr_accept = natm_accept,
- .pr_bind = natm_bind,
- .pr_listen = natm_listen,
- .pr_connect = natm_connect,
- .pr_connect2 = natm_connect2,
- .pr_disconnect = natm_disconnect,
- .pr_shutdown = natm_shutdown,
- .pr_abort = natm_abort,
- .pr_ioctl = natm_ioctl,
- .pr_stat = natm_stat,
- .pr_peeraddr = natm_peeraddr,
- .pr_sockaddr = natm_sockaddr,
- .pr_rcvd = natm_rcvd,
- .pr_recvoob = natm_recvoob,
- .pr_send = natm_send,
- .pr_sendoob = natm_sendoob,
- .pr_purgeif = natm_purgeif,
-};
diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h
deleted file mode 100644
index 1563b7191e2..00000000000
--- a/sys/netnatm/natm.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $NetBSD: natm.h,v 1.15 2015/09/06 06:01:01 dholland Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _NETNATM_NATM_H_
-#define _NETNATM_NATM_H_
-
-/*
- * natm.h: native mode atm
- */
-
-#include <sys/ioccom.h>
-
-
-/*
- * supported protocols
- */
-
-#define PROTO_NATMAAL0 1
-#define PROTO_NATMAAL5 2
-
-/*
- * sockaddr_natm
- */
-
-struct sockaddr_natm {
- u_int8_t snatm_len; /* length */
- u_int8_t snatm_family; /* AF_NATM */
- char snatm_if[IFNAMSIZ]; /* interface name */
- u_int16_t snatm_vci; /* vci */
- u_int8_t snatm_vpi; /* vpi */
-};
-
-
-#if defined(__FreeBSD__) && defined(KERNEL)
-
-#ifndef _KERNEL
-#define _KERNEL
-#endif
-
-#define SPLSOFTNET() splnet()
-
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-
-#define SPLSOFTNET() splsoftnet()
-
-#endif
-
-#ifdef _KERNEL
-
-/*
- * natm protocol control block
- */
-
-struct natmpcb {
- LIST_ENTRY(natmpcb) pcblist; /* list pointers */
- u_int npcb_inq; /* # of our pkts in proto q */
- struct socket *npcb_socket; /* backpointer to socket */
- struct ifnet *npcb_ifp; /* pointer to hardware */
- struct in_addr ipaddr; /* remote IP address, if NPCB_IP */
- u_int16_t npcb_vci; /* VCI */
- u_int8_t npcb_vpi; /* VPI */
- u_int8_t npcb_flags; /* flags */
-};
-
-/* flags */
-#define NPCB_FREE 0x01 /* free (not on any list) */
-#define NPCB_CONNECTED 0x02 /* connected */
-#define NPCB_IP 0x04 /* used by IP */
-#define NPCB_DRAIN 0x08 /* destory as soon as inq == 0 */
-#define NPCB_RAW 0x10 /* in 'raw' mode? */
-
-/* flag arg to npcb_free */
-#define NPCB_REMOVE 0 /* remove from global list */
-#define NPCB_DESTROY 1 /* destroy and be free */
-
-/*
- * NPCB_RAWCC is a hack which applies to connections in 'raw' mode. it
- * is used to override the sbspace() macro when you *really* don't want
- * to drop rcv data. the recv socket buffer size is raised to this value.
- *
- * XXX: socket buffering needs to be looked at.
- */
-
-#define NPCB_RAWCC (1024*1024) /* 1MB */
-
-LIST_HEAD(npcblist, natmpcb);
-
-/* global data structures */
-
-extern struct npcblist natm_pcbs; /* global list of pcbs */
-extern struct ifqueue natmintrq; /* natm packet input queue */
-#define NATM_STAT
-#ifdef NATM_STAT
-extern u_int natm_sodropcnt,
- natm_sodropbytes; /* account of droppage */
-extern u_int natm_sookcnt,
- natm_sookbytes; /* account of ok */
-#endif
-
-extern const struct pr_usrreqs natm_usrreqs;
-
-/* atm_rawioctl: kernel's version of SIOCRAWATM [for internal use only!] */
-struct atm_rawioctl {
- struct natmpcb *npcb;
- int rawvalue;
-};
-#define SIOCXRAWATM _IOWR('a', 125, struct atm_rawioctl)
-
-/* external functions */
-
-/* natm_pcb.c */
-struct natmpcb *npcb_alloc(bool);
-void npcb_free(struct natmpcb *, int);
-struct natmpcb *npcb_add(struct natmpcb *, struct ifnet *, u_int16_t, u_int8_t);
-
-/* natm.c */
-int natm0_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-int natm5_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-void natmintr(void);
-
-#endif
-
-#endif /* !_NETNATM_NATM_H_ */
diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c
deleted file mode 100644
index 1c635b36ed2..00000000000
--- a/sys/netnatm/natm_pcb.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $NetBSD: natm_pcb.c,v 1.17 2016/04/11 08:56:16 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * atm_pcb.c: manage atm protocol control blocks and keep IP and NATM
- * from trying to use each other's VCs.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: natm_pcb.c,v 1.17 2016/04/11 08:56:16 ozaki-r Exp $");
-
-#include "opt_ddb.h"
-
-#include <sys/param.h>
-#include <sys/kmem.h>
-#include <sys/systm.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/mbuf.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-/*
- * npcb_alloc: allocate a npcb [in the free state]
- */
-
-struct natmpcb *
-npcb_alloc(bool wait)
-{
- struct natmpcb *npcb;
-
- npcb = kmem_intr_zalloc(sizeof(*npcb), wait ? KM_SLEEP : KM_NOSLEEP);
- if (npcb) {
- npcb->npcb_flags = NPCB_FREE;
- }
- return(npcb);
-}
-
-
-/*
- * npcb_free: free a npcb
- */
-
-void
-npcb_free(struct natmpcb *npcb, int op)
-{
- int s = splnet();
-
- if ((npcb->npcb_flags & NPCB_FREE) == 0) {
- LIST_REMOVE(npcb, pcblist);
- npcb->npcb_flags = NPCB_FREE;
- }
- if (op == NPCB_DESTROY) {
- if (npcb->npcb_inq) {
- npcb->npcb_flags = NPCB_DRAIN; /* flag for destruction */
- } else {
- kmem_intr_free(npcb, sizeof(*npcb));
- }
- }
-
- splx(s);
-}
-
-
-/*
- * npcb_add: add or remove npcb from main list
- * returns npcb if ok
- */
-
-struct natmpcb *
-npcb_add(struct natmpcb *npcb, struct ifnet *ifp,
- u_int16_t vci, u_int8_t vpi)
-{
- struct natmpcb *cpcb = NULL; /* current pcb */
- int s = splnet();
-
-
- /*
- * lookup required
- */
-
- for (cpcb = natm_pcbs.lh_first ; cpcb != NULL ;
- cpcb = cpcb->pcblist.le_next) {
- if (ifp == cpcb->npcb_ifp && vci == cpcb->npcb_vci && vpi == cpcb->npcb_vpi)
- break;
- }
-
- /*
- * add & something already there?
- */
-
- if (cpcb) {
- cpcb = NULL;
- goto done; /* fail */
- }
-
- /*
- * need to allocate a pcb?
- */
-
- if (npcb == NULL) {
- cpcb = npcb_alloc(false); /* could be called from lower half */
- if (cpcb == NULL)
- goto done; /* fail */
- } else {
- cpcb = npcb;
- }
-
- cpcb->npcb_ifp = ifp;
- cpcb->ipaddr.s_addr = 0;
- cpcb->npcb_vci = vci;
- cpcb->npcb_vpi = vpi;
- cpcb->npcb_flags = NPCB_CONNECTED;
-
- LIST_INSERT_HEAD(&natm_pcbs, cpcb, pcblist);
-
-done:
- splx(s);
- return(cpcb);
-}
-
-
-
-#ifdef DDB
-
-int npcb_dump(void);
-
-int npcb_dump(void)
-
-{
- struct natmpcb *cpcb;
-
- printf("npcb dump:\n");
- for (cpcb = natm_pcbs.lh_first ; cpcb != NULL ;
- cpcb = cpcb->pcblist.le_next) {
- printf("if=%s, vci=%d, vpi=%d, IP=0x%x, sock=%p, flags=0x%x, inq=%d\n",
- cpcb->npcb_ifp->if_xname, cpcb->npcb_vci, cpcb->npcb_vpi,
- cpcb->ipaddr.s_addr, cpcb->npcb_socket,
- cpcb->npcb_flags, cpcb->npcb_inq);
- }
- printf("done\n");
- return(0);
-}
-
-#endif
diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c
deleted file mode 100644
index 7bcaceb37f5..00000000000
--- a/sys/netnatm/natm_proto.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $NetBSD: natm_proto.c,v 1.18 2017/09/21 07:15:35 ozaki-r Exp $ */
-
-/*
- * Copyright (c) 1996 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * protocol layer for access to native mode ATM
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: natm_proto.c,v 1.18 2017/09/21 07:15:35 ozaki-r Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/queue.h>
-#include <sys/socket.h>
-#include <sys/protosw.h>
-#include <sys/domain.h>
-#include <sys/mbuf.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-
-#include <netnatm/natm.h>
-
-DOMAIN_DEFINE(natmdomain);
-
-static void natm_init(void);
-
-struct npcblist natm_pcbs = LIST_HEAD_INITIALIZER(natm_pcbs);
-struct ifqueue natmintrq; /* natm packet input queue */
-int natmqmaxlen = IFQ_MAXLEN; /* max # of packets on queue */
-
-const struct protosw natmsw[] = {
-{ .pr_type = SOCK_STREAM,
- .pr_domain = &natmdomain,
- .pr_protocol = PROTO_NATMAAL5,
- .pr_flags = PR_CONNREQUIRED,
- .pr_input = 0,
- .pr_ctlinput = 0,
- .pr_ctloutput = 0,
- .pr_usrreqs = &natm_usrreq,
- .pr_init = 0,
- .pr_fasttimo = 0,
- .pr_slowtimo = 0,
- .pr_drain = 0
-},
-{ .pr_type = SOCK_DGRAM,
- .pr_domain = &natmdomain,
- .pr_protocol = PROTO_NATMAAL5,
- .pr_flags = PR_CONNREQUIRED | PR_ATOMIC,
- .pr_input = 0,
- .pr_ctlinput = 0,
- .pr_ctloutput = 0,
- .pr_usrreqs = &natm_usrreq,
- .pr_init = 0,
- .pr_fasttimo = 0,
- .pr_slowtimo = 0,
- .pr_drain = 0
-},
-{ .pr_type = SOCK_STREAM,
- .pr_domain = &natmdomain,
- .pr_protocol = PROTO_NATMAAL0,
- .pr_flags = PR_CONNREQUIRED,
- .pr_input = 0,
- .pr_ctlinput = 0,
- .pr_ctloutput = 0,
- .pr_usrreqs = &natm_usrreqs,
- .pr_init = 0,
- .pr_fasttimo = 0,
- .pr_slowtimo = 0,
- .pr_drain = 0
-},
-};
-
-struct domain natmdomain = {
- .dom_family = PF_NATM,
- .dom_name = "natm",
- .dom_init = natm_init,
- .dom_protosw = natmsw,
- .dom_protoswNPROTOSW = &natmsw[sizeof(natmsw)/sizeof(natmsw[0])],
- .dom_ifqueues = { &natmintrq, NULL },
-};
-#ifdef NATM_STAT
-u_int natm_sodropcnt = 0; /* # mbufs dropped due to full sb */
-u_int natm_sodropbytes = 0; /* # of bytes dropped */
-u_int natm_sookcnt = 0; /* # mbufs ok */
-u_int natm_sookbytes = 0; /* # of bytes ok */
-#endif
-
-void natm_init(void)
-{
- natmintrq.ifq_maxlen = natmqmaxlen;
- IFQ_LOCK_INIT(&natmintrq);
-}