diff options
| author | maxv <maxv@NetBSD.org> | 2018-09-06 06:41:59 +0000 |
|---|---|---|
| committer | maxv <maxv@NetBSD.org> | 2018-09-06 06:41:59 +0000 |
| commit | c858eebf4d00a3df6932882fa2369835d1141213 (patch) | |
| tree | 1a14bbcf72717f0cf9f2150af3744ea39f1e1614 | |
| parent | aa932dd1f430ab4101fd3017d5499ea42922f4b9 (diff) | |
Remove the network ATM code.
33 files changed, 40 insertions, 2445 deletions
diff --git a/distrib/sets/lists/base/mi b/distrib/sets/lists/base/mi index 3e049d11639..2db89887984 100644 --- a/distrib/sets/lists/base/mi +++ b/distrib/sets/lists/base/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1183 2018/08/12 17:11:55 christos Exp $ +# $NetBSD: mi,v 1.1184 2018/09/06 06:41:59 maxv Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -1217,7 +1217,7 @@ ./usr/include/netiso base-obsolete obsolete ./usr/include/netkey base-c-usr ./usr/include/netmpls base-c-usr -./usr/include/netnatm base-c-usr +./usr/include/netnatm base-obsolete obsolete ./usr/include/netns base-obsolete obsolete ./usr/include/netpgp base-c-usr ./usr/include/netsmb base-c-usr @@ -1878,8 +1878,8 @@ ./usr/sbin/procsystime base-debug-bin dtrace ./usr/sbin/psrset base-sysutil-bin ./usr/sbin/pstat base-sysutil-bin -./usr/sbin/pvcsif base-netutil-bin -./usr/sbin/pvctxctl base-netutil-bin +./usr/sbin/pvcsif base-obsolete obsolete +./usr/sbin/pvctxctl base-obsolete obsolete ./usr/sbin/pwd_mkdb base-sysutil-bin ./usr/sbin/quot base-sysutil-bin ./usr/sbin/quotacheck base-sysutil-bin diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi index 57607a6b288..8695fb9a80e 100644 --- a/distrib/sets/lists/comp/mi +++ b/distrib/sets/lists/comp/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2225 2018/09/03 21:26:19 kre Exp $ +# $NetBSD: mi,v 1.2226 2018/09/06 06:41:59 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -2295,7 +2295,7 @@ ./usr/include/net/if.h comp-c-include ./usr/include/net/if_arc.h comp-c-include ./usr/include/net/if_arp.h comp-c-include -./usr/include/net/if_atm.h comp-c-include +./usr/include/net/if_atm.h comp-obsolete obsolete ./usr/include/net/if_bridgevar.h comp-c-include ./usr/include/net/if_dl.h comp-c-include ./usr/include/net/if_ether.h comp-c-include @@ -2384,7 +2384,7 @@ ./usr/include/netinet/icmp6.h comp-c-include ./usr/include/netinet/icmp_var.h comp-c-include ./usr/include/netinet/if_arc.h comp-obsolete obsolete -./usr/include/netinet/if_atm.h comp-c-include +./usr/include/netinet/if_atm.h comp-obsolete obsolete ./usr/include/netinet/if_ether.h comp-c-include ./usr/include/netinet/if_inarp.h comp-c-include ./usr/include/netinet/igmp.h comp-c-include @@ -2513,7 +2513,7 @@ ./usr/include/netkey/keysock.h comp-c-include ./usr/include/netkey/keyv2.h comp-obsolete obsolete ./usr/include/netmpls/mpls.h comp-c-include -./usr/include/netnatm/natm.h comp-c-include +./usr/include/netnatm/natm.h comp-obsolete obsolete ./usr/include/netns/idp.h comp-obsolete obsolete ./usr/include/netns/idp_var.h comp-obsolete obsolete ./usr/include/netns/ns.h comp-obsolete obsolete diff --git a/distrib/sets/lists/debug/mi b/distrib/sets/lists/debug/mi index 40acf699bc8..b06e747319f 100644 --- a/distrib/sets/lists/debug/mi +++ b/distrib/sets/lists/debug/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.263 2018/08/21 11:09:18 christos Exp $ +# $NetBSD: mi,v 1.264 2018/09/06 06:41:59 maxv Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -1209,8 +1209,8 @@ ./usr/libdata/debug/usr/sbin/pppstats.debug comp-ppp-debug debug ./usr/libdata/debug/usr/sbin/psrset.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/pstat.debug comp-sysutil-debug debug -./usr/libdata/debug/usr/sbin/pvcsif.debug comp-netutil-debug debug -./usr/libdata/debug/usr/sbin/pvctxctl.debug comp-netutil-debug debug +./usr/libdata/debug/usr/sbin/pvcsif.debug comp-obsolete obsolete +./usr/libdata/debug/usr/sbin/pvctxctl.debug comp-obsolete obsolete ./usr/libdata/debug/usr/sbin/pwd_mkdb.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/quot.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/quotacheck.debug comp-sysutil-debug debug diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi index ef62210040f..aeaa67eb12c 100644 --- a/distrib/sets/lists/man/mi +++ b/distrib/sets/lists/man/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1613 2018/09/06 05:36:49 maxv Exp $ +# $NetBSD: mi,v 1.1614 2018/09/06 06:41:59 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -2928,8 +2928,8 @@ ./usr/share/man/cat8/pvchange.0 man-lvm-catman lvm,.cat ./usr/share/man/cat8/pvck.0 man-lvm-catman lvm,.cat ./usr/share/man/cat8/pvcreate.0 man-lvm-catman lvm,.cat -./usr/share/man/cat8/pvcsif.0 man-netutil-catman .cat -./usr/share/man/cat8/pvctxctl.0 man-netutil-catman .cat +./usr/share/man/cat8/pvcsif.0 man-obsolete obsolete +./usr/share/man/cat8/pvctxctl.0 man-obsolete obsolete ./usr/share/man/cat8/pvdisplay.0 man-lvm-catman lvm,.cat ./usr/share/man/cat8/pvmove.0 man-lvm-catman lvm,.cat ./usr/share/man/cat8/pvremove.0 man-lvm-catman lvm,.cat @@ -5829,8 +5829,8 @@ ./usr/share/man/html8/pvchange.html man-lvm-htmlman lvm,html ./usr/share/man/html8/pvck.html man-lvm-htmlman lvm,html ./usr/share/man/html8/pvcreate.html man-lvm-htmlman lvm,html -./usr/share/man/html8/pvcsif.html man-netutil-htmlman html -./usr/share/man/html8/pvctxctl.html man-netutil-htmlman html +./usr/share/man/html8/pvcsif.html man-obsolete obsolete +./usr/share/man/html8/pvctxctl.html man-obsolete obsolete ./usr/share/man/html8/pvdisplay.html man-lvm-htmlman lvm,html ./usr/share/man/html8/pvmove.html man-lvm-htmlman lvm,html ./usr/share/man/html8/pvremove.html man-lvm-htmlman lvm,html @@ -9002,8 +9002,8 @@ ./usr/share/man/man8/pvchange.8 man-lvm-man lvm,.man ./usr/share/man/man8/pvck.8 man-lvm-man lvm,.man ./usr/share/man/man8/pvcreate.8 man-lvm-man lvm,.man -./usr/share/man/man8/pvcsif.8 man-netutil-man .man -./usr/share/man/man8/pvctxctl.8 man-netutil-man .man +./usr/share/man/man8/pvcsif.8 man-obsolete obsolete +./usr/share/man/man8/pvctxctl.8 man-obsolete obsolete ./usr/share/man/man8/pvdisplay.8 man-lvm-man lvm,.man ./usr/share/man/man8/pvmove.8 man-lvm-man lvm,.man ./usr/share/man/man8/pvremove.8 man-lvm-man lvm,.man diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7 index e66fe16f971..87492bad2ec 100644 --- a/share/man/man7/hier.7 +++ b/share/man/man7/hier.7 @@ -1,4 +1,4 @@ -.\" $NetBSD: hier.7,v 1.130 2018/07/15 05:16:41 maxv Exp $ +.\" $NetBSD: hier.7,v 1.131 2018/09/06 06:41:59 maxv Exp $ .\" .\" Copyright (c) 1990, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)hier.7 8.5 (Berkeley) 6/1/94 .\" -.Dd July 14, 2018 +.Dd September 6, 2018 .Dt HIER 7 .Os .Sh NAME @@ -464,8 +464,6 @@ Include files for Internet protocol version 6; see .It Pa netkey/ Include files for secret key management, used for security protocols; see .Xr ipsec 4 . -.It Pa netnatm/ -C include files for native mode ATM. .It Pa nfs/ C include files for NFS (Network File System). .It Pa protocols/ @@ -1017,8 +1015,6 @@ IP networking support. IPv6 networking support. .It Pa netkey/ Key database for IPsec networking support. -.It Pa netnatm/ -ATM networking support. .It Pa nfs/ NFS (network file system) support, both client and server. .It Pa stand/ diff --git a/share/man/man7/src.7 b/share/man/man7/src.7 index 579b5e740dc..7a65e05d988 100644 --- a/share/man/man7/src.7 +++ b/share/man/man7/src.7 @@ -1,4 +1,4 @@ -.\" $NetBSD: src.7,v 1.12 2018/07/15 05:16:41 maxv Exp $ +.\" $NetBSD: src.7,v 1.13 2018/09/06 06:41:59 maxv Exp $ .\" .\" Copyright (c) 2012, 2013 Mingzhe Wang and Elvira Khabirova. .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 14, 2018 +.Dd September 6, 2018 .Dt SRC 7 .Os .Sh NAME @@ -310,8 +310,6 @@ Key management for IPsec. .It Pa netmpls/ MPLS protocol stack .Xr mpls 4 . -.It Pa netnatm/ -Native Mode ATM protocol stack. .It Pa netsmb/ SMB network protocol stack. .It Pa nfs/ 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); -} diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 29228f7cc51..9fd55b4d385 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.277 2018/08/25 11:06:00 martin Exp $ +# $NetBSD: Makefile,v 1.278 2018/09/06 06:42:00 maxv Exp $ # from: @(#)Makefile 5.20 (Berkeley) 6/12/93 .include <bsd.own.mk> @@ -52,9 +52,6 @@ SUBDIR+=faithd ifmcstat ip6addrctl ndp rip6query rtsold SUBDIR+=mld6query route6d rtadvd traceroute6 .endif -# ATM PVC -SUBDIR+=pvcsif pvctxctl - SUBDIR+= racoon racoonctl # NPF diff --git a/usr.sbin/pvcsif/Makefile b/usr.sbin/pvcsif/Makefile deleted file mode 100644 index 4bf6ae8b368..00000000000 --- a/usr.sbin/pvcsif/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/01/10 02:58:59 lukem Exp $ - -.include <bsd.own.mk> - -PROG= pvcsif -MAN= pvcsif.8 - -.if (${USE_INET6} != "no") -CPPFLAGS+=-DINET6 -.endif - -.include <bsd.prog.mk> diff --git a/usr.sbin/pvcsif/pvcsif.8 b/usr.sbin/pvcsif/pvcsif.8 deleted file mode 100644 index 0bc2abc359e..00000000000 --- a/usr.sbin/pvcsif/pvcsif.8 +++ /dev/null @@ -1,53 +0,0 @@ -.\" -.\" $NetBSD: pvcsif.8,v 1.4 2002/02/02 01:37:13 wiz Exp $ -.\" -.Dd December 29, 1997 -.Dt PVCSIF 8 -.Os -.Sh NAME -.Nm pvcsif -.Nd configure ATM PVC sub interfaces -.Sh SYNOPSIS -.Nm pvcsif -.Ar interface -.Op Fl s -.Nm pvcsif -.Fl a -.Sh DESCRIPTION -.Nm -creates a sub interface for an ATM PVC. -A sub interface -.Xr pvc 4 -is dynamically created. -The created interface is bound to -.Ar interface -but at this point no VC is assigned. To assign a VC, -.Xr pvctxctl 8 -should be used later. -.Pp -A PVC sub interface is intended to use an ATM PVC as an alternative -serial connection, and to be allocated per PVC basis. -A PVC sub interface looks as a point-to-point interface -and is multicast capable, as opposed to the NBMA -(NonBroadcast Multiple Access) model that requires a MARS server. -A point-to-point interface is useful to run MBone or protocols -requiring multicast, such as RSVP and IPv6, over a PVC WAN -connection. -.Pp -Note that a sub interface is not a full-fledged interface but just -an indirect reference to the real interface. -.Pp -The options are as follows: -.Bl -tag -width Fl -.It Fl s -For use with a shell, it prints the created interface name. -.It Fl a -Lists the existing sub interfaces. -.El -.Sh SEE ALSO -.Xr en 4 , -.Xr pvc 4 , -.Xr ifconfig 8 , -.Xr pvctxctl 8 -.Sh BUGS -Currently, there is no way to remove a sub interface. diff --git a/usr.sbin/pvcsif/pvcsif.c b/usr.sbin/pvcsif/pvcsif.c deleted file mode 100644 index d5c4a425913..00000000000 --- a/usr.sbin/pvcsif/pvcsif.c +++ /dev/null @@ -1,149 +0,0 @@ -/* $NetBSD: pvcsif.c,v 1.5 2011/08/30 21:27:00 joerg Exp $ */ - -/* - * Copyright (C) 1998 - * Sony Computer Science Laboratory Inc. 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 SONY CSL AND CONTRIBUTORS ``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 SONY CSL OR CONTRIBUTORS 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. - * - * ALTQ Id: pvcsif.c,v 0.3 1999/05/19 11:31:11 kjc Exp - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <err.h> - -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <net/if.h> - -#include <net/if_atm.h> - -__dead static void usage(void); -static void list_all(void); - -void usage(void) -{ - fprintf(stderr, "usage: pvcsif -a\n"); - fprintf(stderr, " pvcsif interface [-s]\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - struct ifreq ifr; - int shell_mode = 0; - int s, ch; - - if (argc < 2) - usage(); - - if (strncmp(argv[1], "-a", 2) == 0) { - list_all(); - return (0); - } - - ifr.ifr_name[IFNAMSIZ-1] = '\0'; - strncpy(ifr.ifr_name, argv[1], IFNAMSIZ-1); - - optind = 2; - while ((ch = getopt(argc, argv, "s")) != -1) { - switch (ch) { - case 's': - shell_mode = 1; - break; - } - } - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - err(1, "can't open socket"); - - if (ioctl(s, SIOCSPVCSIF, &ifr) < 0) - err(1, "SIOCSPVCSIF"); - - close(s); - - if (shell_mode) - printf("%s", ifr.ifr_name); - else - printf("created a pvc subinterface %s (bound to %s)\n", - ifr.ifr_name, argv[1]); - - return (0); -} - -static void -list_all(void) -{ - struct if_nameindex *ifn_list, *ifnp; - struct pvctxreq pvcreq; - int pcr, s; - - if ((ifn_list = if_nameindex()) == NULL) - err(1, "if_nameindex failed"); - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - err(1, "can't open socket"); - - for (ifnp = ifn_list; ifnp->if_name != NULL; ifnp++) { - if (strncmp(ifnp->if_name, "pvc", 3) == 0) { - - bzero(&pvcreq, sizeof(pvcreq)); - strncpy(pvcreq.pvc_ifname, ifnp->if_name, IFNAMSIZ-1); - if (ioctl(s, SIOCGPVCTX, &pvcreq) < 0) - err(1, "SIOCSPVCTX"); - - /* - * print info - */ - pcr = pvcreq.pvc_pcr; - printf(" %s (bound to %s): vci:[%d:%d] (", - ifnp->if_name, pvcreq.pvc_ifname, - ATM_PH_VPI(&pvcreq.pvc_aph), - ATM_PH_VCI(&pvcreq.pvc_aph)); - if (ATM_PH_FLAGS(&pvcreq.pvc_aph) & ATM_PH_AAL5) - printf("AAL5"); - if (ATM_PH_FLAGS(&pvcreq.pvc_aph) & ATM_PH_LLCSNAP) - printf("/LLCSNAP"); - printf(") "); - if (pcr < 0) - printf("(invalid)\n"); - else if (pcr == 0) - printf("pcr:%d(full speed)\n", pcr); - else if (pcr < 1000) - printf("pcr:%d(%dbps)\n", - pcr, pcr * 48 * 8); - else if (pcr < 1000000) - printf("pcr:%d(%dKbps)\n", - pcr, pcr * 48 * 8 / 1000); - else - printf("pcr:%d(%dMbps)\n", - pcr, pcr * 48 * 8 / 1000000); - } - } - - close(s); - if_freenameindex(ifn_list); -} diff --git a/usr.sbin/pvctxctl/Makefile b/usr.sbin/pvctxctl/Makefile deleted file mode 100644 index 29c943920c8..00000000000 --- a/usr.sbin/pvctxctl/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2005/01/10 02:58:59 lukem Exp $ - -.include <bsd.own.mk> - -PROG= pvctxctl -MAN= pvctxctl.8 - -.if (${USE_INET6} != "no") -CPPFLAGS+=-DINET6 -.endif - -.include <bsd.prog.mk> diff --git a/usr.sbin/pvctxctl/pvctxctl.8 b/usr.sbin/pvctxctl/pvctxctl.8 deleted file mode 100644 index 64db8ac4661..00000000000 --- a/usr.sbin/pvctxctl/pvctxctl.8 +++ /dev/null @@ -1,154 +0,0 @@ -.\" Copyright (C) 1998 -.\" Sony Computer Science Laboratory Inc. 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 SONY CSL AND CONTRIBUTORS ``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 SONY CSL OR CONTRIBUTORS 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. -.\" -.\" $NetBSD: pvctxctl.8,v 1.7 2005/09/15 01:49:07 wiz Exp $ -.\" -.Dd December 29, 1997 -.Dt PVCTXCTL 8 -.Os -.Sh NAME -.Nm pvctxctl -.Nd display or control ATM PVC transmitter parameters -.Sh SYNOPSIS -.Nm -.Ar interface -.Op Oo vpi : Oc Ns Ar vci -.Nm -.Ar interface -.Oo vpi : Oc Ns Ar vci -.Op Fl n -.Op Fl b Ar max-bandwidth -.Op Fl j Oo vpi : Oc Ns Ar vci -.Op Fl p Ar pcr -.Sh DESCRIPTION -.Nm -displays or controls the shaper parameters of an ATM VC. -When a shaper value is specified, -.Nm -sets a shaper to an ATM VC. -.Nm -works for a PVC sub interface -.Xr pvc 4 -as well as a real ATM interface -.Xr en 4 . -.Pp -For a real ATM interface, the specified VC should be assigned -beforehand by -.Xr route 8 . -.Pp -For a sub interface, -.Nm -assigns the specified VC to the sub interface. If another VC is -already assigned to the sub interface, the old VC is invalidated. -.Pp -Availability of shapers, the number of hardware shaper channels, -and accuracy of shaping are all device dependent. -For example, ENI Midway chip has 8 shaper channels but the driver -reserves one for non-shaping VCs. -.Pp -The options are as follows: -.Bl -tag -width Fl -.It Ar interface -The -.Ar interface -parameter is a string of the form -.Dq name unit , -for example, -.Dq en0 . -.It Oo vpi: Oc Ns Ar vci -The VC number to which the shaper is assigned. -When the VPI number is omitted, VPI number 0 is -assumed. -For example, to assign a shaper to VPI=0 and -VCI=201, the following forms can be used: -"201", "0xc9", "0:201", "0:0xc9". -.It Fl b Ar max-bandwidth -The PCR parameter can be specified also in -.Dq bits per second . -The rate is the rate of AAL5 frame and -the PCR is calculated by the following form: -.Pp -.Dl PCR = max-bandwidth / 8 / 48 -.Pp -.Dq K -and -.Dq M -can be used as a short hand of -.Dq 000 -and -.Dq 000000 -respectively. For example, -.Dq 45M -means -.Dq 45Mbps -or PCR value -.Dq 117187 . -.It Fl j Oo vpi : Oc Ns Ar vci -The join parameter is intended for VP shaping. -The VC shaper channel is shared with the existing VC, -which means the sum of the cell rates never exceeds -the maximum PCR among the shared VCs. -On the other hand, when the shaper channel is not shared, -the sum of the cell rates could be the sum of the PCRs. -.Pp -For example, if two VCs (say 201 and 202) share a -45Mbps VP, use: -.Pp -.Dl # pvctxctl en0 201 -b 45M -.Dl # pvctxctl en0 202 -b 45M -j 201 -.It Fl n -This parameter is only for a sub interface. -Use NULL encapsulation instead of LLC/SNAP. -.It Fl p Ar pcr -The PCR (Peak Cell Rate) parameter specifies the peak cell rate in -"cells per second". -If PCR value "0" is specified, -no shaper is assigned, which means cells are sent at -full-speed of the link. -If PCR value -.Dq -1 -is specified, the corresponding VC -is invalidated. -.El -.Sh SEE ALSO -.Xr en 4 , -.Xr ifconfig 8 , -.Xr pvcsif 8 , -.Xr route 8 -.Sh BUGS -A real ATM interface and a sub interface require different -sequences to set a shaper. -For example, to assign a 45Mbps shaper to VC 201 (0xc9) of en0: -.Bd -literal -offset indent -# ifconfig en0 10.0.0.1 -# route add -iface 10.0.0.2 -link en0:3.0.0.c9 -# pvctxctl en0 0xc9 -b 45M -.Ed -.Pp -For a shadow interface, -.Bd -literal -offset indent -# pvcsif en0 # creates pvc0 -# ifconfig pvc0 10.0.0.1 10.0.0.2 -# pvctxctl pvc0 201 -b 45M -.Ed diff --git a/usr.sbin/pvctxctl/pvctxctl.c b/usr.sbin/pvctxctl/pvctxctl.c deleted file mode 100644 index 78e7cafb88f..00000000000 --- a/usr.sbin/pvctxctl/pvctxctl.c +++ /dev/null @@ -1,201 +0,0 @@ -/* $NetBSD: pvctxctl.c,v 1.7 2011/08/30 21:28:27 joerg Exp $ */ - -/* - * Copyright (C) 1998 - * Sony Computer Science Laboratory Inc. 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 SONY CSL AND CONTRIBUTORS ``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 SONY CSL OR CONTRIBUTORS 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. - * - * ALTQ Id: pvctxctl.c,v 0.4 1999/05/19 11:31:11 kjc Exp - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <err.h> - -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <net/if.h> - -#include <net/if_atm.h> - -static int str2vc(char *str, int *vpi, int *vci); -__dead static void usage(void); - -static void -usage(void) -{ - fprintf(stderr, "usage: pvctxctl interface [vpi:]vci\n"); - fprintf(stderr, " [-p pcr] [-b pcr_in_bps] [-j [vpi:]vci\n"); - fprintf(stderr, " [-n] \n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - struct pvctxreq pvcreq; - int s, ch; - long bandwidth; - char *if_name, *cp; - int vpi = 0; - int vci = 0; - int joint_vpi = 0; - int joint_vci = 0; - int pcr = 0; - int llcsnap = ATM_PH_LLCSNAP; - int getinfo = 1; - int subinterface = 0; - int verbose = 1; - - if (argc < 2) - usage(); - - if_name = argv[1]; - if (argc > 2 && isdigit((unsigned char)argv[2][0])) - str2vc(argv[2], &vpi, &vci); - - optind = 3; - while ((ch = getopt(argc, argv, "p:b:j:snv")) != -1) { - switch (ch) { - case 'p': - pcr = strtol(optarg, NULL, 0); - getinfo = 0; - break; - case 'b': - cp = NULL; - bandwidth = strtol(optarg, &cp, 0); - if (cp != NULL) { - if (*cp == 'K' || *cp == 'k') - bandwidth *= 1000; - if (*cp == 'M' || *cp == 'm') - bandwidth *= 1000000; - } - pcr = bandwidth / 8 / 48; - getinfo = 0; - break; - case 'j': - str2vc(optarg, &joint_vpi, &joint_vci); - break; - case 'n': - llcsnap = 0; - break; - case 'v': - verbose = 1; - break; - default: - usage(); - } - } - - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - err(1, "can't open socket"); - - pvcreq.pvc_ifname[IFNAMSIZ-1] = '\0'; - strncpy(pvcreq.pvc_ifname, if_name, IFNAMSIZ-1); - - if (strncmp(if_name, "pvc", 3) == 0) - /* pvc subinterface */ - subinterface = 1; - - ATM_PH_FLAGS(&pvcreq.pvc_aph) = ATM_PH_AAL5 | llcsnap; - ATM_PH_VPI(&pvcreq.pvc_aph) = vpi; - ATM_PH_SETVCI(&pvcreq.pvc_aph, vci); - - ATM_PH_FLAGS(&pvcreq.pvc_joint) = 0; - ATM_PH_VPI(&pvcreq.pvc_joint) = joint_vpi; - ATM_PH_SETVCI(&pvcreq.pvc_joint, joint_vci); - - pvcreq.pvc_pcr = pcr; - - if (getinfo) { - if (ioctl(s, SIOCGPVCTX, &pvcreq) < 0) - err(1, "SIOCSPVCTX"); - } - else { - if (verbose) { - printf("setting pvc tx: interface:%s vc:%d:%d ph=0x%x\n", - if_name, vpi, vci, ATM_PH_FLAGS(&pvcreq.pvc_aph)); - printf(" joint:%d:%d, setting pcr:%d\n", - joint_vpi, joint_vci, pcr); - } - - if (ioctl(s, SIOCSPVCTX, &pvcreq) < 0) - err(1, "SIOCSPVCTX"); - } - - pcr = pvcreq.pvc_pcr; - - /* - * print info - */ - printf(" %s", if_name); - if (subinterface) - printf(" (bound to %s)", pvcreq.pvc_ifname); - printf(": vci:[%d:%d] (", - ATM_PH_VPI(&pvcreq.pvc_aph), ATM_PH_VCI(&pvcreq.pvc_aph)); - if (ATM_PH_FLAGS(&pvcreq.pvc_aph) & ATM_PH_AAL5) - printf("AAL5"); - if (ATM_PH_FLAGS(&pvcreq.pvc_aph) & ATM_PH_LLCSNAP) - printf("/LLCSNAP"); - printf(") "); - if (pcr < 0) - printf("(invalid)\n"); - else if (pcr == 0) - printf("pcr:%d(full speed)\n", pcr); - else if (pcr < 1000) - printf("pcr:%d(%dbps)\n", pcr, pcr * 48 * 8); - else if (pcr < 1000000) - printf("pcr:%d(%dKbps)\n", pcr, pcr * 48 * 8 / 1000); - else - printf("pcr:%d(%dMbps)\n", pcr, pcr * 48 * 8 / 1000000); - - close(s); - - if (getinfo && pcr < 0) { - fprintf(stderr, "can't get pvc info for vci:%d\n", vci); - fprintf(stderr, "to setup a vci, use -p or -b option\n"); - } - - return (0); -} - -static int -str2vc(char *str, int *vpip, int *vcip) -{ - char *c; - - if ((c = strchr(str, ':')) != NULL) { - *c = '\0'; - *vpip = strtol(str, NULL, 0); - str = c + 1; - } - else - *vpip = 0; - - *vcip = strtol(str, NULL, 0); - return (0); -} - |
