summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-06-20 17:19:28 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2004-06-20 17:19:28 +0000
commit25b28787a7beca9a8243b5c8e927282640977dff (patch)
tree4ae4c90f57c673f1d1ea2a9eb7b422df1d049483 /sys
parentdaefe33e51f796ec859b8a5545e90394afe00af9 (diff)
goodbye TUBA. deraadt ok
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files5
-rw-r--r--sys/netiso/iso.c10
-rw-r--r--sys/netiso/iso_proto.c13
-rw-r--r--sys/netiso/tp_iso.c11
-rw-r--r--sys/netiso/tuba_subr.c373
-rw-r--r--sys/netiso/tuba_table.c151
-rw-r--r--sys/netiso/tuba_table.h86
-rw-r--r--sys/netiso/tuba_usrreq.c318
8 files changed, 4 insertions, 963 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 7c783912239..e0bf11f7b2e 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.304 2004/06/06 16:49:08 cedric Exp $
+# $OpenBSD: files,v 1.305 2004/06/20 17:19:26 itojun Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -803,9 +803,6 @@ file netiso/tp_subr2.c iso | tpip
file netiso/tp_timer.c iso | tpip
file netiso/tp_trace.c iso | tpip
file netiso/tp_usrreq.c iso | tpip
-file netiso/tuba_subr.c iso | tuba
-file netiso/tuba_table.c iso | tuba
-file netiso/tuba_usrreq.c iso | tuba
file netnatm/natm_pcb.c natm
file netnatm/natm_proto.c natm
file netnatm/natm.c natm
diff --git a/sys/netiso/iso.c b/sys/netiso/iso.c
index 784df888bf1..43bb2dac633 100644
--- a/sys/netiso/iso.c
+++ b/sys/netiso/iso.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso.c,v 1.6 2003/12/10 07:22:44 itojun Exp $ */
+/* $OpenBSD: iso.c,v 1.7 2004/06/20 17:19:27 itojun Exp $ */
/* $NetBSD: iso.c,v 1.14 1996/04/13 01:34:48 cgd Exp $ */
/*-
@@ -81,9 +81,6 @@ SOFTWARE.
#include <netiso/iso_pcb.h>
#include <netiso/clnp.h>
#include <netiso/argo_debug.h>
-#ifdef TUBA
-#include <netiso/tuba_table.h>
-#endif
#ifdef ISO
@@ -477,11 +474,6 @@ iso_control(so, cmd, data, ifp)
if (ia == 0) {
if (cmd == SIOCDIFADDR_ISO)
return (EADDRNOTAVAIL);
-#ifdef TUBA
- /* XXXXXX can't be done in the proto init routines */
- if (tuba_tree == 0)
- tuba_table_init();
-#endif
MALLOC(ia, struct iso_ifaddr *, sizeof(*ia),
M_IFADDR, M_WAITOK);
bzero((caddr_t) ia, sizeof(*ia));
diff --git a/sys/netiso/iso_proto.c b/sys/netiso/iso_proto.c
index 5973b55fd53..2ba9a82d5ec 100644
--- a/sys/netiso/iso_proto.c
+++ b/sys/netiso/iso_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso_proto.c,v 1.4 2003/06/02 23:28:17 millert Exp $ */
+/* $OpenBSD: iso_proto.c,v 1.5 2004/06/20 17:19:27 itojun Exp $ */
/* $NetBSD: iso_proto.c,v 1.6 1996/02/13 22:10:21 christos Exp $ */
/*-
@@ -80,9 +80,6 @@ SOFTWARE.
#include <netiso/tp_param.h>
#include <netiso/tp_var.h>
#include <netiso/esis.h>
-#ifdef TUBA
-#include <netiso/tuba_table.h>
-#endif
#include <netiso/idrp_var.h>
#include <netiso/iso_pcb.h>
#include <netiso/cltp_var.h>
@@ -151,14 +148,6 @@ struct protosw isosw[] = {
tp_init, tp_fasttimo, tp_slowtimo, tp_drain,
},
-#ifdef TUBA
- {SOCK_STREAM, &isodomain, ISOPROTO_TCP, PR_CONNREQUIRED | PR_WANTRCVD | PR_ABRTACPTDIS,
- tuba_tcpinput, 0, 0, tuba_ctloutput,
- tuba_usrreq,
- tuba_init, tuba_fasttimo, tuba_fasttimo, 0
- },
-#endif
-
#ifdef TPCONS
/* ISOPROTO_TP */
{SOCK_SEQPACKET, &isodomain, ISOPROTO_TP0, PR_CONNREQUIRED | PR_WANTRCVD | PR_ABRTACPTDIS,
diff --git a/sys/netiso/tp_iso.c b/sys/netiso/tp_iso.c
index 8134e725e30..c7d168dedd3 100644
--- a/sys/netiso/tp_iso.c
+++ b/sys/netiso/tp_iso.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tp_iso.c,v 1.9 2004/01/03 14:08:54 espie Exp $ */
+/* $OpenBSD: tp_iso.c,v 1.10 2004/06/20 17:19:27 itojun Exp $ */
/* $NetBSD: tp_iso.c,v 1.8 1996/03/16 23:13:54 christos Exp $ */
/*-
@@ -104,10 +104,6 @@ SOFTWARE.
#include <netiso/cltp_var.h>
#include <netiso/idrp_var.h>
-#ifdef TUBA
-#include <netiso/tuba_table.h>
-#endif
-
#include <sys/stdarg.h>
/*
@@ -532,11 +528,6 @@ tpclnp_input(struct mbuf *m, ...)
m->m_pkthdr.len -= clnp_len;
/* XXXX: should probably be in clnp_input */
switch (dst->siso_data[dst->siso_nlen - 1]) {
-#ifdef TUBA
- case ISOPROTO_TCP:
- tuba_tcpinput(m, src, dst);
- return;
-#endif
case 0:
if (m->m_len == 0 && (m = m_pullup(m, 1)) == 0)
return;
diff --git a/sys/netiso/tuba_subr.c b/sys/netiso/tuba_subr.c
deleted file mode 100644
index fd67c5902fe..00000000000
--- a/sys/netiso/tuba_subr.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* $OpenBSD: tuba_subr.c,v 1.14 2004/01/03 14:08:54 espie Exp $ */
-/* $NetBSD: tuba_subr.c,v 1.7 1996/02/13 22:12:32 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
- *
- * @(#)tuba_subr.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/protosw.h>
-#include <sys/errno.h>
-
-#include <net/route.h>
-#include <net/if.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
-#include <netinet/ip_var.h>
-#include <netinet/ip_icmp.h>
-#include <netinet/tcp.h>
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet/tcpip.h>
-#include <netinet/tcp_debug.h>
-
-#include <netiso/argo_debug.h>
-#include <netiso/iso.h>
-#include <netiso/clnp.h>
-#include <netiso/iso_pcb.h>
-#include <netiso/iso_var.h>
-#include <netiso/tuba_table.h>
-#include <dev/rndvar.h>
-
-#include <sys/stdarg.h>
-
-static struct sockaddr_iso null_siso = {sizeof(null_siso), AF_ISO,};
-extern int tuba_table_size, tcp_keepidle, tcp_keepintvl, tcp_maxidle;
-extern int tcppcbcachemiss, tcppredack, tcppreddat, tcprexmtthresh;
-extern struct tcpiphdr tcp_saveti;
-struct inpcbtable tuba_inpcb;
-struct isopcb tuba_isopcb;
-
-#ifndef TUBA_INPCBHASHSIZE
-#define TUBA_INPCBHASHSIZE 128
-#endif
-int tuba_inpcbhashsize = TUBA_INPCBHASHSIZE;
-
-
-struct addr_arg {
- int error;
- int offset;
- u_long sum;
-};
-
-static void tuba_getaddr(struct addr_arg *, struct sockaddr_iso **,
- u_long);
-/*
- * Tuba initialization
- */
-void
-tuba_init()
-{
-#define TUBAHDRSIZE (3 /*LLC*/ + 9 /*CLNP Fixed*/ + 42 /*Addresses*/ \
- + 6 /*CLNP Segment*/ + 20 /*TCP*/)
-
- in_pcbinit(&tuba_inpcb, tuba_inpcbhashsize);
- tuba_isopcb.isop_next = tuba_isopcb.isop_prev = &tuba_isopcb;
- tuba_isopcb.isop_faddr = &tuba_isopcb.isop_sfaddr;
- tuba_isopcb.isop_laddr = &tuba_isopcb.isop_sladdr;
- if (max_protohdr < TUBAHDRSIZE)
- max_protohdr = TUBAHDRSIZE;
- if (max_linkhdr + TUBAHDRSIZE > MHLEN)
- panic("tuba_init");
-}
-
-/*
- * Calculate contribution to fudge factor for TCP checksum,
- * and coincidentally set pointer for convenience of clnp_output
- * if we are are responding when there is no isopcb around.
- */
-static void
-tuba_getaddr(arg, siso, index)
- struct addr_arg *arg;
- struct sockaddr_iso **siso;
- u_long index;
-{
- struct tuba_cache *tc;
- if (index <= tuba_table_size && (tc = tuba_table[index])) {
- if (siso)
- *siso = &tc->tc_siso;
- arg->sum += (arg->offset & 1 ? tc->tc_ssum : tc->tc_sum)
- + (0xffff ^ index);
- arg->offset += tc->tc_siso.siso_nlen + 1;
- } else
- arg->error = 1;
-}
-
-int
-tuba_output(m, tp)
- struct mbuf *m;
- struct tcpcb *tp;
-{
- struct tcpiphdr *n;
- struct isopcb *isop;
- struct addr_arg arg;
-
- if (tp == 0 || (n = tp->t_template) == 0 ||
- (isop = (struct isopcb *) tp->t_tuba_pcb) == 0) {
- isop = &tuba_isopcb;
- n = mtod(m, struct tcpiphdr *);
- arg.error = arg.sum = arg.offset = 0;
- tuba_getaddr(&arg, &tuba_isopcb.isop_faddr, n->ti_dst.s_addr);
- tuba_getaddr(&arg, &tuba_isopcb.isop_laddr, n->ti_src.s_addr);
- REDUCE(arg.sum, arg.sum);
- goto adjust;
- }
- if (n->ti_sum == 0) {
- arg.error = arg.sum = arg.offset = 0;
- tuba_getaddr(&arg, (struct sockaddr_iso **) 0, n->ti_dst.s_addr);
- tuba_getaddr(&arg, (struct sockaddr_iso **) 0, n->ti_src.s_addr);
- REDUCE(arg.sum, arg.sum);
- n->ti_sum = arg.sum;
- n = mtod(m, struct tcpiphdr *);
-adjust:
- if (arg.error) {
- m_freem(m);
- return (EADDRNOTAVAIL);
- }
- REDUCE(n->ti_sum, n->ti_sum + (0xffff ^ arg.sum));
- }
- m->m_len -= sizeof(struct ip);
- m->m_pkthdr.len -= sizeof(struct ip);
- m->m_data += sizeof(struct ip);
- return (clnp_output(m, isop, m->m_pkthdr.len, 0));
-}
-
-void
-tuba_refcnt(isop, delta)
- struct isopcb *isop;
- int delta;
-{
- struct tuba_cache *tc;
- unsigned index;
-
- if (delta != 1)
- delta = -1;
- if (isop == 0 || isop->isop_faddr == 0 || isop->isop_laddr == 0 ||
- (delta == -1 && isop->isop_tuba_cached == 0) ||
- (delta == 1 && isop->isop_tuba_cached != 0))
- return;
- isop->isop_tuba_cached = (delta == 1);
- if ((index = tuba_lookup(isop->isop_faddr, M_DONTWAIT)) != 0 &&
- (tc = tuba_table[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
- tc->tc_refcnt += delta;
- if ((index = tuba_lookup(isop->isop_laddr, M_DONTWAIT)) != 0 &&
- (tc = tuba_table[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
- tc->tc_refcnt += delta;
-}
-
-void
-tuba_pcbdetach(v)
- void *v;
-{
- struct isopcb *isop = v;
- if (isop == 0)
- return;
- tuba_refcnt(isop, -1);
- isop->isop_socket = 0;
- iso_pcbdetach(isop);
-}
-
-/*
- * Avoid in_pcbconnect in faked out tcp_input()
- */
-int
-tuba_pcbconnect(v, nam)
- void *v;
- struct mbuf *nam;
-{
- struct inpcb *inp = v;
- struct sockaddr_iso *siso;
- struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
- struct tcpcb *tp = intotcpcb(inp);
- struct isopcb *isop = (struct isopcb *) tp->t_tuba_pcb;
- int error;
-
- /* hardwire iso_pcbbind() here */
- siso = isop->isop_laddr = &isop->isop_sladdr;
- *siso = tuba_table[inp->inp_laddr.s_addr]->tc_siso;
- siso->siso_tlen = sizeof(inp->inp_lport);
- bcopy((caddr_t) & inp->inp_lport, TSEL(siso), sizeof(inp->inp_lport));
-
- /* hardwire in_pcbconnect() here without assigning route */
- inp->inp_fport = sin->sin_port;
- inp->inp_faddr = sin->sin_addr;
-
- /* reuse nam argument to call iso_pcbconnect() */
- nam->m_len = sizeof(*siso);
- siso = mtod(nam, struct sockaddr_iso *);
- *siso = tuba_table[inp->inp_faddr.s_addr]->tc_siso;
- siso->siso_tlen = sizeof(inp->inp_fport);
- bcopy((caddr_t) & inp->inp_fport, TSEL(siso), sizeof(inp->inp_fport));
-
- if ((error = iso_pcbconnect(isop, nam)) == 0)
- tuba_refcnt(isop, 1);
- return (error);
-}
-
-/*
- * CALLED FROM:
- * clnp's input routine, indirectly through the protosw.
- * FUNCTION and ARGUMENTS:
- * Take a packet (m) from clnp, strip off the clnp header
- * and do tcp input processing.
- * No return value.
- */
-void
-tuba_tcpinput(struct mbuf *m, ...)
-{
- unsigned long lindex, findex;
- struct tcpiphdr *ti;
- struct inpcb *inp;
- caddr_t optp = NULL;
- int optlen = 0;
- int len, tlen, off;
- struct tcpcb *tp = 0;
- int tiflags;
- struct socket *so = NULL;
- int todrop, acked, ourfinisacked, needoutput = 0;
- short ostate = 0;
- struct in_addr laddr;
- int dropsocket = 0, iss = 0;
- u_long tiwin;
- u_int32_t ts_val, ts_ecr;
- int ts_present = 0;
- struct sockaddr_iso *src, *dst;
- va_list ap;
-
- va_start(ap, m);
- src = va_arg(ap, struct sockaddr_iso *);
- dst = va_arg(ap, struct sockaddr_iso *);
- va_end(ap);
-
-
- if ((m->m_flags & M_PKTHDR) == 0)
- panic("tuba_tcpinput");
- /*
- * Do some housekeeping looking up CLNP addresses.
- * If we are out of space might as well drop the packet now.
- */
- tcpstat.tcps_rcvtotal++;
- lindex = tuba_lookup(dst, M_DONTWAIT);
- findex = tuba_lookup(src, M_DONTWAIT);
- if (lindex == 0 || findex == 0)
- goto drop;
- /*
- * CLNP gave us an mbuf chain WITH the clnp header pulled up,
- * but the data pointer pushed past it.
- */
- len = m->m_len;
- tlen = m->m_pkthdr.len;
- m->m_data -= sizeof(struct ip);
- m->m_len += sizeof(struct ip);
- m->m_pkthdr.len += sizeof(struct ip);
- m->m_flags &= ~(M_MCAST | M_BCAST); /* XXX should do this in
- * clnp_input */
- /*
- * The reassembly code assumes it will be overwriting a useless
- * part of the packet, which is why we need to have it point
- * into the packet itself.
- *
- * Check to see if the data is properly alligned
- * so that we can save copying the tcp header.
- * This code knows way too much about the structure of mbufs!
- */
- off = ((sizeof(long) - 1) & ((m->m_flags & M_EXT) ?
- (m->m_data - m->m_ext.ext_buf) : (m->m_data - m->m_pktdat)));
- if (off || len < sizeof(struct tcphdr)) {
- struct mbuf *m0 = m;
-
- MGETHDR(m, M_DONTWAIT, MT_DATA);
- if (m == 0) {
- m = m0;
- goto drop;
- }
- M_MOVE_PKTHDR(m, m0);
- m->m_next = m0;
- m->m_data += max_linkhdr;
- if (len < sizeof(struct tcphdr)) {
- m->m_len = 0;
- if ((m = m_pullup(m, sizeof(struct tcpiphdr))) == 0) {
- tcpstat.tcps_rcvshort++;
- return;
- }
- } else {
- bcopy(mtod(m0, caddr_t) + sizeof(struct ip),
- mtod(m, caddr_t) + sizeof(struct ip),
- sizeof(struct tcphdr));
- m0->m_len -= sizeof(struct tcpiphdr);
- m0->m_data += sizeof(struct tcpiphdr);
- m->m_len = sizeof(struct tcpiphdr);
- }
- }
- /*
- * Calculate checksum of extended TCP header and data,
- * replacing what would have been IP addresses by
- * the IP checksum of the CLNP addresses.
- */
- ti = mtod(m, struct tcpiphdr *);
- ti->ti_dst.s_addr = tuba_table[lindex]->tc_sum;
- if (dst->siso_nlen & 1)
- ti->ti_src.s_addr = tuba_table[findex]->tc_sum;
- else
- ti->ti_src.s_addr = tuba_table[findex]->tc_ssum;
- bzero(ti->ti_x1, sizeof ti->ti_x1);
- ti->ti_pr = ISOPROTO_TCP;
- ti->ti_len = htons((u_short) tlen);
- if ((ti->ti_sum = in_cksum(m, m->m_pkthdr.len)) != 0) {
- tcpstat.tcps_rcvbadsum++;
- goto drop;
- }
- ti->ti_src.s_addr = findex;
- ti->ti_dst.s_addr = lindex;
- /*
- * Now include the rest of TCP input
- */
-#define TUBA_INCLUDE
-#define in_pcbconnect tuba_pcbconnect
-#define tcb tuba_inpcb
-
-#include <netinet/tcp_input.c>
-}
-
-#define tcp_slowtimo tuba_slowtimo
-#define tcp_fasttimo tuba_fasttimo
-
-#include <netinet/tcp_timer.c>
diff --git a/sys/netiso/tuba_table.c b/sys/netiso/tuba_table.c
deleted file mode 100644
index da28e37c723..00000000000
--- a/sys/netiso/tuba_table.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: tuba_table.c,v 1.6 2003/12/10 07:22:44 itojun Exp $ */
-/* $NetBSD: tuba_table.c,v 1.6 1996/02/13 22:12:34 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
- *
- * @(#)tuba_table.c 8.2 (Berkeley) 11/15/93
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/domain.h>
-#include <sys/protosw.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-
-#include <net/if.h>
-#include <net/radix.h>
-
-#include <netiso/iso.h>
-#include <netiso/tuba_table.h>
-
-int tuba_table_size;
-struct tuba_cache **tuba_table;
-struct radix_node_head *tuba_tree;
-extern int arpt_keep, arpt_prune; /* use same values as arp cache */
-struct timeout tuba_timeout;
-
-void
-tuba_timer(v)
- void *v;
-{
- int s = splsoftnet();
- int i;
- struct tuba_cache *tc;
- long timelimit = time.tv_sec - arpt_keep;
-
- timeout_add(&tuba_timeout, arpt_prune * hz);
- for (i = tuba_table_size; i > 0; i--)
- if ((tc = tuba_table[i]) && (tc->tc_refcnt == 0) &&
- (tc->tc_time < timelimit)) {
- tuba_table[i] = 0;
- rn_delete(&tc->tc_siso.siso_addr, NULL, tuba_tree);
- free((caddr_t) tc, M_RTABLE);
- }
- splx(s);
-}
-
-void
-tuba_table_init()
-{
- rn_inithead((void **) &tuba_tree, 40);
- timeout_set(&tuba_timeout, tuba_timer, NULL);
- timeout_add(&tuba_timeout, arpt_prune * hz);
-}
-
-int
-tuba_lookup(siso, wait)
- struct sockaddr_iso *siso;
- int wait;
-{
- struct radix_node *rn;
- struct tuba_cache *tc;
- struct tuba_cache **new;
- int dupentry = 0, sum_a = 0, sum_b = 0, old_size, i;
-
- if ((rn = rn_match((caddr_t) &siso->siso_addr, tuba_tree)) != NULL
- && ((rn->rn_flags & RNF_ROOT) == 0)) {
- tc = (struct tuba_cache *) rn;
- tc->tc_time = time.tv_sec;
- return (tc->tc_index);
- }
- if ((tc = (struct tuba_cache *) malloc(sizeof(*tc), M_RTABLE, wait))
- == NULL)
- return (0);
- bzero((caddr_t) tc, sizeof(*tc));
- bcopy(siso->siso_data, tc->tc_siso.siso_data,
- tc->tc_siso.siso_nlen = siso->siso_nlen);
- rn_insert(&tc->tc_siso.siso_addr, tuba_tree, &dupentry, tc->tc_nodes);
- if (dupentry)
- panic("tuba_lookup 1");
- tc->tc_siso.siso_family = AF_ISO;
- tc->tc_siso.siso_len = sizeof(tc->tc_siso);
- tc->tc_time = time.tv_sec;
- for (i = sum_a = tc->tc_siso.siso_nlen; --i >= 0;)
- if (i & 1)
- sum_a += (u_char) tc->tc_siso.siso_data[i];
- else
- sum_b += (u_char) tc->tc_siso.siso_data[i];
- REDUCE(tc->tc_sum, (sum_a << 8) + sum_b);
- HTONS(tc->tc_sum);
- SWAB(tc->tc_ssum, tc->tc_sum);
- for (i = tuba_table_size; i > 0; i--)
- if (tuba_table[i] == 0)
- goto fixup;
- old_size = tuba_table_size;
- if (tuba_table_size == 0)
- tuba_table_size = 15;
- if (tuba_table_size > 0x7fff)
- return (0);
- tuba_table_size = 1 + 2 * tuba_table_size;
- i = (tuba_table_size + 1) * sizeof(tc);
- new = (struct tuba_cache **) malloc((unsigned) i, M_RTABLE, wait);
- if (new == 0) {
- tuba_table_size = old_size;
- rn_delete(&tc->tc_siso.siso_addr, NULL, tuba_tree);
- free((caddr_t) tc, M_RTABLE);
- return (0);
- }
- bzero((caddr_t) new, (unsigned) i);
- if (tuba_table) {
- bcopy((caddr_t) tuba_table, (caddr_t) new, i >> 1);
- free((caddr_t) tuba_table, M_RTABLE);
- }
- tuba_table = new;
- i = tuba_table_size;
-fixup:
- tuba_table[i] = tc;
- tc->tc_index = i;
- return (tc->tc_index);
-}
diff --git a/sys/netiso/tuba_table.h b/sys/netiso/tuba_table.h
deleted file mode 100644
index dda34bd161d..00000000000
--- a/sys/netiso/tuba_table.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: tuba_table.h,v 1.4 2003/06/02 23:28:18 millert Exp $ */
-/* $NetBSD: tuba_table.h,v 1.4 1996/02/13 22:12:37 christos Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
- *
- * @(#)tuba_table.h 8.1 (Berkeley) 6/10/93
- */
-
-struct tuba_cache {
- struct radix_node tc_nodes[2]; /* convenient lookup */
- int tc_refcnt;
- int tc_time;/* last looked up */
- int tc_flags;
-#define TCF_PERM 1
- int tc_index;
- u_short tc_sum; /* cksum of nsap inc. length */
- u_short tc_ssum;/* swab(tc_sum) */
- struct sockaddr_iso tc_siso; /* for responding */
-};
-
-#define ADDCARRY(x) (x >= 65535 ? x -= 65535 : x)
-#define REDUCE(a, b) { union { u_short s[2]; long l;} l_util; long x; \
- l_util.l = (b); x = l_util.s[0] + l_util.s[1]; ADDCARRY(x); \
- if (x == 0) x = 0xffff; a = x;}
-#define SWAB(a, b) { union { u_char c[2]; u_short s;} s; u_char t; \
- s.s = (b); t = s.c[0]; s.c[0] = s.c[1]; s.c[1] = t; a = s.s;}
-
-#ifdef _KERNEL
-extern int tuba_table_size;
-extern struct tuba_cache **tuba_table;
-extern struct radix_node_head *tuba_tree;
-
-struct mbuf;
-struct tcpcb;
-struct isopcb;
-struct inpcb;
-struct sockaddr_iso;
-struct socket;
-
-/* tuba_subr.c */
-void tuba_init(void);
-int tuba_output(struct mbuf *, struct tcpcb *);
-void tuba_refcnt(struct isopcb *, int );
-void tuba_pcbdetach(void *);
-int tuba_pcbconnect(void *, struct mbuf *);
-void tuba_tcpinput(struct mbuf *, ...);
-int tuba_pcbconnect(void *, struct mbuf *);
-void tuba_slowtimo(void);
-void tuba_fasttimo(void);
-
-/* tuba_table.c */
-void tuba_timer(void *);
-void tuba_table_init(void);
-int tuba_lookup(struct sockaddr_iso *, int );
-
-/* tuba_usrreq.c */
-int tuba_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
- struct mbuf *);
-int tuba_ctloutput(int, struct socket *, int, int , struct mbuf **);
-#endif
diff --git a/sys/netiso/tuba_usrreq.c b/sys/netiso/tuba_usrreq.c
deleted file mode 100644
index a69477a6820..00000000000
--- a/sys/netiso/tuba_usrreq.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* $OpenBSD: tuba_usrreq.c,v 1.5 2003/12/10 07:22:44 itojun Exp $ */
-/* $NetBSD: tuba_usrreq.c,v 1.8 1996/02/13 22:12:40 christos Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 THE REGENTS 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.
- *
- * @(#)tuba_usrreq.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/protosw.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
-#include <netinet/ip_var.h>
-#include <netinet/tcp.h>
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet/tcpip.h>
-#include <netinet/tcp_debug.h>
-
-#include <netiso/argo_debug.h>
-#include <netiso/iso.h>
-#include <netiso/clnp.h>
-#include <netiso/iso_pcb.h>
-#include <netiso/iso_var.h>
-#include <netiso/tuba_table.h>
-/*
- * TCP protocol interface to socket abstraction.
- */
-extern char *tcpstates[];
-extern struct inpcbtable tuba_inpcb;
-extern struct isopcb tuba_isopcb;
-
-/*
- * Process a TCP user request for TCP tb. If this is a send request
- * then m is the mbuf chain of send data. If this is a timer expiration
- * (called from the software clock routine), then timertype tells which timer.
- */
-/* ARGSUSED */
-int
-tuba_usrreq(so, req, m, nam, control)
- struct socket *so;
- int req;
- struct mbuf *m, *nam, *control;
-{
- struct inpcb *inp;
- struct isopcb *isop = NULL;
- struct tcpcb *tp = NULL;
- int s;
- int error = 0;
- int ostate;
- struct sockaddr_iso *siso;
-
- if (req == PRU_CONTROL)
- return (iso_control(so, (long) m, (caddr_t) nam,
- (struct ifnet *) control));
-
- s = splsoftnet();
- inp = sotoinpcb(so);
- /*
- * When a TCP is attached to a socket, then there will be
- * a (struct inpcb) pointed at by the socket, and this
- * structure will point at a subsidary (struct tcpcb).
- */
- if (inp == 0 && req != PRU_ATTACH) {
- splx(s);
- return (EINVAL);/* XXX */
- }
- if (inp) {
- tp = intotcpcb(inp);
- if (tp == 0)
- panic("tuba_usrreq");
- ostate = tp->t_state;
- isop = (struct isopcb *) tp->t_tuba_pcb;
- if (isop == 0)
- panic("tuba_usrreq 2");
- } else
- ostate = 0;
- switch (req) {
-
- /*
- * TCP attaches to socket via PRU_ATTACH, reserving space,
- * and an internet control block. We also need to
- * allocate an isopcb and separate the control block from
- * tcp/ip ones.
- */
- case PRU_ATTACH:
- if ((error = iso_pcballoc(so, &tuba_isopcb)) != 0)
- break;
- isop = (struct isopcb *) so->so_pcb;
- so->so_pcb = 0;
- if ((error = tcp_usrreq(so, req, m, nam, control)) != 0) {
- isop->isop_socket = 0;
- iso_pcbdetach(isop);
- } else {
- inp = sotoinpcb(so);
- CIRCLEQ_REMOVE(&inp->inp_table->inpt_queue, inp,
- inp_queue);
- CIRCLEQ_INSERT_HEAD(&tuba_inpcb.inpt_queue, inp,
- inp_queue);
- inp->inp_table = &tuba_inpcb;
- tp = intotcpcb(inp);
- if (tp == 0)
- panic("tuba_usrreq 3");
- tp->t_tuba_pcb = (caddr_t) isop;
- }
- goto notrace;
-
- /*
- * PRU_DETACH detaches the TCP protocol from the socket.
- * If the protocol state is non-embryonic, then can't
- * do this directly: have to initiate a PRU_DISCONNECT,
- * which may finish later; embryonic TCB's can just
- * be discarded here.
- */
- case PRU_DETACH:
- if (tp->t_state > TCPS_LISTEN)
- tp = tcp_disconnect(tp);
- else
- tp = tcp_close(tp);
- if (tp == 0)
- tuba_pcbdetach(isop);
- break;
-
- /*
- * Give the socket an address.
- */
- case PRU_BIND:
- siso = mtod(nam, struct sockaddr_iso *);
- if (siso->siso_tlen && siso->siso_tlen != 2) {
- error = EINVAL;
- break;
- }
- if ((error = iso_pcbbind(isop, nam)) ||
- (siso = isop->isop_laddr) == 0)
- break;
- bcopy(TSEL(siso), &inp->inp_lport, 2);
- if (siso->siso_nlen &&
- !(inp->inp_laddr.s_addr = tuba_lookup(siso, M_WAITOK)))
- error = ENOBUFS;
- break;
-
- /*
- * Prepare to accept connections.
- */
- case PRU_CONNECT:
- case PRU_LISTEN:
- if (inp->inp_lport == 0 &&
- (error = iso_pcbbind(isop, NULL)))
- break;
- bcopy(TSEL(isop->isop_laddr), &inp->inp_lport, 2);
- if (req == PRU_LISTEN) {
- tp->t_state = TCPS_LISTEN;
- break;
- }
- /* FALLTHROUGH */
- /*
- * Initiate connection to peer.
- * Create a template for use in transmissions on this connection.
- * Enter SYN_SENT state, and mark socket as connecting.
- * Start keep-alive timer, and seed output sequence space.
- * Send initial segment on connection.
- */
- /* case PRU_CONNECT: */
- if ((error = iso_pcbconnect(isop, nam)) != 0)
- break;
- if ((siso = isop->isop_laddr) && siso->siso_nlen > 1)
- siso->siso_data[siso->siso_nlen - 1] = ISOPROTO_TCP;
- else
- panic("tuba_usrreq: connect");
- siso = mtod(nam, struct sockaddr_iso *);
- if (!(inp->inp_faddr.s_addr = tuba_lookup(siso, M_WAITOK))) {
- unconnect:
- iso_pcbdisconnect(isop);
- error = ENOBUFS;
- break;
- }
- bcopy(TSEL(isop->isop_faddr), &inp->inp_fport, 2);
- if (inp->inp_laddr.s_addr == 0 &&
- (inp->inp_laddr.s_addr =
- tuba_lookup(isop->isop_laddr, M_WAITOK)) == 0)
- goto unconnect;
- if ((tp->t_template = tcp_template(tp)) == 0)
- goto unconnect;
- soisconnecting(so);
- tcpstat.tcps_connattempt++;
- tp->t_state = TCPS_SYN_SENT;
- tp->t_timer[TCPT_KEEP] = TCPTV_KEEP_INIT;
- tp->iss = tcp_iss;
- tcp_iss += TCP_ISSINCR / 2;
- tcp_sendseqinit(tp);
- error = tcp_output(tp);
- tuba_refcnt(isop, 1);
- break;
-
- /*
- * Initiate disconnect from peer.
- * If connection never passed embryonic stage, just drop;
- * else if don't need to let data drain, then can just drop anyways,
- * else have to begin TCP shutdown process: mark socket disconnecting,
- * drain unread data, state switch to reflect user close, and
- * send segment (e.g. FIN) to peer. Socket will be really disconnected
- * when peer sends FIN and acks ours.
- *
- * SHOULD IMPLEMENT LATER PRU_CONNECT VIA REALLOC TCPCB.
- */
- case PRU_DISCONNECT:
- if ((tp = tcp_disconnect(tp)) == 0)
- tuba_pcbdetach(isop);
- break;
-
- /*
- * Accept a connection. Essentially all the work is
- * done at higher levels; just return the address
- * of the peer, storing through addr.
- */
- case PRU_ACCEPT:
- bcopy((caddr_t) isop->isop_faddr, mtod(nam, caddr_t),
- nam->m_len = isop->isop_faddr->siso_len);
- break;
-
- /*
- * Mark the connection as being incapable of further output.
- */
- case PRU_SHUTDOWN:
- if (so->so_state & SS_CANTSENDMORE)
- break;
- socantsendmore(so);
- tp = tcp_usrclosed(tp);
- if (tp)
- error = tcp_output(tp);
- else
- tuba_pcbdetach(isop);
- break;
- /*
- * Abort the TCP.
- */
- case PRU_ABORT:
- if ((tp = tcp_drop(tp, ECONNABORTED)) == 0)
- tuba_pcbdetach(isop);
- break;
-
-
- case PRU_SOCKADDR:
- if (isop->isop_laddr)
- bcopy((caddr_t) isop->isop_laddr, mtod(nam, caddr_t),
- nam->m_len = isop->isop_laddr->siso_len);
- break;
-
- case PRU_PEERADDR:
- if (isop->isop_faddr)
- bcopy((caddr_t) isop->isop_faddr, mtod(nam, caddr_t),
- nam->m_len = isop->isop_faddr->siso_len);
- break;
-
- default:
- error = tcp_usrreq(so, req, m, nam, control);
- goto notrace;
- }
- if (tp && (so->so_options & SO_DEBUG))
- tcp_trace(TA_USER, ostate, tp, (struct tcpiphdr *) 0, req);
-notrace:
- splx(s);
- return (error);
-}
-
-int
-tuba_ctloutput(op, so, level, optname, mp)
- int op;
- struct socket *so;
- int level, optname;
- struct mbuf **mp;
-{
- if (level != IPPROTO_TCP)
- return rclnp_ctloutput(op, so, level, optname, mp);
- else
- return tcp_ctloutput(op, so, level, optname, mp);
-}