SCCS-vsn: sys/netiso/tuba_table.h 7.3
SCCS-vsn: sys/netiso/tuba_subr.c 7.4
SCCS-vsn: sys/netiso/tuba_table.c 7.3
SCCS-vsn: sys/netiso/tuba_usrreq.c 7.3
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)tuba_subr.c 7.3 (Berkeley) %G%
+ * @(#)tuba_subr.c 7.4 (Berkeley) %G%
-#include "param.h"
-#include "proc.h"
-#include "systm.h"
-#include "malloc.h"
-#include "mbuf.h"
-#include "socket.h"
-#include "socketvar.h"
-#include "protosw.h"
-#include "errno.h"
+#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 <net/route.h>
+#include <net/if.h>
-#include "in.h"
-#include "in_systm.h"
-#include "ip.h"
-#include "in_pcb.h"
-#include "ip_var.h"
-#include "ip_icmp.h"
-#include "tcp.h"
-#include "tcp_fsm.h"
-#include "tcp_seq.h"
-#include "tcp_timer.h"
-#include "tcp_var.h"
-#include "tcpip.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/argo_debug.h>
+#include <netiso/iso.h>
+#include <netiso/clnp.h>
+#include <netiso/iso_pcb.h>
+#include <netiso/iso_var.h>
+#include <netiso/tuba_addr.h>
-#include "tuba_addr.h"
-static struct sockaddr_iso null_siso = { sizeof(null_siso), AF_ISO, };
+static struct sockaddr_iso null_siso = { sizeof(null_siso), AF_ISO, };
+extern struct isopcb tuba_isopcb;
+extern int tuba_table_size;
+extern int tcppcbcachemiss, tcppredack, tcppreddat, tcprexmtthresh;
+extern struct inpcb *tcp_last_inpcb;
+extern struct tcpiphdr tcp_saveti;
/*
* Tuba initialization
*/
/*
* Tuba initialization
*/
{
#define TUBAHDRSIZE (3 /*LLC*/ + 9 /*CLNP Fixed*/ + 42 /*Addresses*/ \
+ 6 /*CLNP Segment*/ + 20 /*TCP*/)
{
#define TUBAHDRSIZE (3 /*LLC*/ + 9 /*CLNP Fixed*/ + 42 /*Addresses*/ \
+ 6 /*CLNP Segment*/ + 20 /*TCP*/)
- extern struct isopcb tuba_isopcb;
tuba_isopcb.isop_next = tuba_isopcb.isop_prev = &tuba_isopcb;
tuba_isopcb.isop_next = tuba_isopcb.isop_prev = &tuba_isopcb;
- tuba_isopcb.isop_faddr = &tuba_isop.isop_sfaddr;
- tuba_isopcb.isop_laddr = &tuba_isop.isop_sladdr;
+ 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");
if (max_protohdr < TUBAHDRSIZE)
max_protohdr = TUBAHDRSIZE;
if (max_linkhdr + TUBAHDRSIZE > MHLEN)
panic("tuba_init");
*siso = null_siso;
siso->siso_addr = tc->tc_addr;
}
*siso = null_siso;
siso->siso_addr = tc->tc_addr;
}
register struct tcpiphdr *n;
u_long sum, i;
register struct tcpiphdr *n;
u_long sum, i;
- if (tp == 0 || (n = tp->tp_template) == 0) {
+ if (tp == 0 || (n = tp->t_template) == 0) {
isop = &tuba_isopcb;
i = sum = 0;
n = mtod(m, struct tcpiphdr *);
isop = &tuba_isopcb;
i = sum = 0;
n = mtod(m, struct tcpiphdr *);
- tuba_getaddr(&i, &sum, tuba_isop.isop_faddr, n->ti_dst.s_addr);
- tuba_getaddr(&i, &sum, tuba_isop.isop_laddr, n->ti_src.s_addr);
+ tuba_getaddr(&i, &sum, tuba_isopcb.isop_faddr,
+ n->ti_dst.s_addr);
+ tuba_getaddr(&i, &sum, tuba_isopcb.isop_laddr,
+ n->ti_src.s_addr);
goto adjust;
}
isop = (struct isopcb *)tp->t_tuba_pcb;
goto adjust;
}
isop = (struct isopcb *)tp->t_tuba_pcb;
i = sum = 0;
tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0,
n->ti_dst.s_addr);
i = sum = 0;
tuba_getaddr(&i, &sum, (struct sockaddr_iso *)0,
n->ti_dst.s_addr);
(delta == 1 && isop->isop_tuba_cached != 0))
return;
isop->isop_tuba_cached = (delta == 1);
(delta == 1 && isop->isop_tuba_cached != 0))
return;
isop->isop_tuba_cached = (delta == 1);
- if ((index = tuba_lookup(&isop->isop_faddr.siso_addr)) != 0 &&
- (tc = tuba_cache[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
+ if ((index = tuba_lookup(&isop->isop_sfaddr.siso_addr)) != 0 &&
+ (tc = tuba_table[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
- if ((index = tuba_lookup(&isop->isop_laddr.siso_addr)) != 0 &&
- (tc = tuba_cache[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
+ if ((index = tuba_lookup(&isop->isop_sladdr.siso_addr)) != 0 &&
+ (tc = tuba_table[index]) != 0 && (delta == 1 || tc->tc_refcnt > 0))
tc->tc_refcnt += delta;
}
tc->tc_refcnt += delta;
}
register struct inpcb *inp;
struct mbuf *nam;
{
register struct inpcb *inp;
struct mbuf *nam;
{
- register struct sockaddr_iso *siso = mtod(m, struct sockaddr_iso *);
- struct sockaddr_in *sin = mtod(m, struct sockaddr_in *);
+ register struct sockaddr_iso *siso = mtod(nam, struct sockaddr_iso *);
+ struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *);
struct tcpcb *tp = intotcpcb(inp);
unsigned index = sin->sin_addr.s_addr;
struct tuba_cache *tc = tuba_table[index];
struct tcpcb *tp = intotcpcb(inp);
unsigned index = sin->sin_addr.s_addr;
struct tuba_cache *tc = tuba_table[index];
- struct isopcb *isop = (struct isopcb *)tp->tp_tuba_pcb;
+ struct isopcb *isop = (struct isopcb *)tp->t_tuba_pcb;
int error;
inp->inp_faddr.s_addr = index;
int error;
inp->inp_faddr.s_addr = index;
* CALLED FROM:
* clnp's input routine, indirectly through the protosw.
* FUNCTION and ARGUMENTS:
* 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 give it to tcp
- * or udp.
+ * Take a packet (m) from clnp, strip off the clnp header
+ * and do tcp input processing.
-ProtoHook
-tpclnp_input(m, src, dst, clnp_len, ce_bit)
+tuba_tcpinput(m, src, dst, clnp_len, ce_bit)
register struct mbuf *m;
struct sockaddr_iso *src, *dst;
int clnp_len, ce_bit;
{
int s = splnet();
register struct mbuf *m;
struct sockaddr_iso *src, *dst;
int clnp_len, ce_bit;
{
int s = splnet();
- unsigned long fix_csum, lindex, findex;
+ unsigned long fix_cksum, lindex, findex;
register struct tcpiphdr *ti;
register struct inpcb *inp;
struct mbuf *om = 0;
register struct tcpiphdr *ti;
register struct inpcb *inp;
struct mbuf *om = 0;
* If we are out of space might as well drop the packet now.
*/
tcpstat.tcps_rcvtotal++;
* If we are out of space might as well drop the packet now.
*/
tcpstat.tcps_rcvtotal++;
- if ((lindex = tuba_lookup(&dst->siso_addr) == 0 ||
+ if ((lindex = tuba_lookup(&dst->siso_addr) == 0) ||
(findex = tuba_lookup(&dst->siso_addr) == 0))
goto drop;
/*
(findex = tuba_lookup(&dst->siso_addr) == 0))
goto drop;
/*
* so that we can save copying the tcp header.
* This code knows way too much about the structure of mbufs!
*/
* 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 & EXT) ?
- (m->m_data - m->m_ext.ext_buf) : (m->m_data - m_pktdat)));
+ off = ((sizeof (long) - 1) & ((m->m_flags & M_EXT) ?
+ (m->m_data - m->m_ext.ext_buf) : (m->m_data - m->m_pktdat)));
- struct mbuf *m0 = m_gethdr(M_DONTWAIT, MT_DATA)
+ struct mbuf *m0 = m_gethdr(M_DONTWAIT, MT_DATA);
if (m0 == 0) {
goto drop;
}
if (m0 == 0) {
goto drop;
}
m->m_data += sizeof(struct tcpiphdr);
m0->m_next = m;
m0->m_pkthdr = m->m_pkthdr;
m->m_data += sizeof(struct tcpiphdr);
m0->m_next = m;
m0->m_pkthdr = m->m_pkthdr;
- m0->m_flags = m->m_pkthdr & M_COPYFLAGS;
+ m0->m_flags = m->m_flags & M_COPYFLAGS;
m0->m_len = sizeof(struct tcpiphdr);
m = m0;
}
m0->m_len = sizeof(struct tcpiphdr);
m = m0;
}
/*
* Now include the rest of TCP input
*/
/*
* Now include the rest of TCP input
*/
#define in_pcbconnect tuba_pcbconnect
#define in_pcbconnect tuba_pcbconnect
-#include "../netinet/tcp_input.c"
+#include <netinet/tcp_input.c>
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)tuba_table.c 7.2 (Berkeley) %G%
+ * @(#)tuba_table.c 7.3 (Berkeley) %G%
-#include "param.h"
-#include "systm.h"
-#include "proc.h"
-#include "mbuf.h"
-#include "socket.h"
-#include "socketvar.h"
-#include "domain.h"
-#include "protosw.h"
-#include "ioctl.h"
+#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 "net/if.h"
-#include "net/af.h"
-#include "net/radix.h"
+#include <net/if.h>
+#include <net/af.h>
+#include <net/radix.h>
-#include "netiso/iso.h"
-#include "tuba_addr.h"
+#include <netiso/iso.h>
+#include <netiso/tuba_addr.h>
int tuba_table_size;
struct tuba_cache **tuba_table;
int tuba_table_size;
struct tuba_cache **tuba_table;
{
int s = splnet();
int i;
{
int s = splnet();
int i;
- register struct tuba_cache **tc;
+ register struct tuba_cache *tc;
long timelimit = time.tv_sec - arpt_keep;
timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
long timelimit = time.tv_sec - arpt_keep;
timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
{
rn_inithead((void **)&tuba_tree, 40);
timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
{
rn_inithead((void **)&tuba_tree, 40);
timeout(tuba_timer, (caddr_t)0, arpt_prune * hz);
register struct iso_addr *isoa;
int flags;
{
register struct iso_addr *isoa;
int flags;
{
+ struct radix_node *rn, *rn_match();
register struct tuba_cache *tc;
register struct tuba_cache *tc;
- int dupentry = 0, sum_even = 0, sum_odd = 0, delta, i;
+ struct tuba_cache **new;
+ int dupentry = 0, sum_even = 0, sum_odd = 0, old_size, i;
if (rn = rn_match(tuba_tree, (caddr_t)isoa)) {
tc = (struct tuba_cache *)rn;
if (rn = rn_match(tuba_tree, (caddr_t)isoa)) {
tc = (struct tuba_cache *)rn;
if ((tc = (struct tuba_cache *)malloc(sizeof(*tc), M_RTABLE, wait))
== NULL)
return (0);
if ((tc = (struct tuba_cache *)malloc(sizeof(*tc), M_RTABLE, wait))
== NULL)
return (0);
- bzero((caddr_t)tc, sizeof (*tc))
+ bzero((caddr_t)tc, sizeof (*tc));
bcopy((caddr_t)isoa, (caddr_t)&tc->tc_addr, 1 + isoa->isoa_len);
rn_insert((caddr_t)&tc->tc_addr, tuba_tree, &dupentry, tc->tc_nodes);
if (dupentry)
panic("tuba_lookup 1");
tc->tc_time = time.tv_sec;
tc->tc_flags = flags;
bcopy((caddr_t)isoa, (caddr_t)&tc->tc_addr, 1 + isoa->isoa_len);
rn_insert((caddr_t)&tc->tc_addr, tuba_tree, &dupentry, tc->tc_nodes);
if (dupentry)
panic("tuba_lookup 1");
tc->tc_time = time.tv_sec;
tc->tc_flags = flags;
- sum_even = isoa->isoa_len;
- for (i = sum_even; --i >= 0; ) {
- delta = isoa->isoa_genaddr[i];
- i & 1 ? sum_even += delta : sum_odd += delta;
- }
+ for (i = isoa->isoa_len; --i >= 0; )
+ (i & 1 ? sum_even : sum_odd) += isoa->isoa_genaddr[i];
ICKSUM(tc->tc_sum_in, (sum_even << 8) + sum_odd);
ICKSUM(tc->tc_sum_in, (sum_even << 8) + sum_odd);
- ICKSUM(tc->tc_sum_out, tc->sum_in + 0x1fffe - tc->tc_index);
+ ICKSUM(tc->tc_sum_out, tc->tc_sum_in + 0x1fffe - tc->tc_index);
for (i = tuba_table_size; i > 0; i--)
if (tuba_table[i] == 0)
break;
for (i = tuba_table_size; i > 0; i--)
if (tuba_table[i] == 0)
break;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)tuba_table.h 7.2 (Berkeley) %G%
+ * @(#)tuba_table.h 7.3 (Berkeley) %G%
#define ICKSUM(a, b) ((a = (b) % 0xffff), (a == 0 ? a = 0xffff : a))
#ifdef KERNEL
#define ICKSUM(a, b) ((a = (b) % 0xffff), (a == 0 ? a = 0xffff : a))
#ifdef KERNEL
-extern struct tuba_cache **tuba_table;
-struct radix_node_head *tuba_tree;
+extern int tuba_table_size;
+extern struct tuba_cache **tuba_table;
+extern struct radix_node_head *tuba_tree;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)tuba_usrreq.c 7.2 (Berkeley) %G%
+ * @(#)tuba_usrreq.c 7.3 (Berkeley) %G%
-#include "param.h"
-#include "systm.h"
-#include "malloc.h"
-#include "mbuf.h"
-#include "socket.h"
-#include "socketvar.h"
-#include "protosw.h"
-#include "errno.h"
-#include "stat.h"
+#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 <net/if.h>
+#include <net/route.h>
-#include "in.h"
-#include "in_systm.h"
-#include "ip.h"
-#include "in_pcb.h"
-#include "ip_var.h"
-#include "tcp.h"
-#include "tcp_fsm.h"
-#include "tcp_seq.h"
-#include "tcp_timer.h"
-#include "tcp_var.h"
-#include "tcpip.h"
-#include "tcp_debug.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/argo_debug.h>
+#include <netiso/iso.h>
+#include <netiso/clnp.h>
+#include <netiso/iso_pcb.h>
+#include <netiso/iso_var.h>
+#include <netiso/tuba_addr.h>
/*
* TCP protocol interface to socket abstraction.
*/
/*
* TCP protocol interface to socket abstraction.
*/
int s;
int error = 0;
int ostate;
int s;
int error = 0;
int ostate;
- struct sockaddr_iso siso;
+ struct sockaddr_iso *siso;
if (req == PRU_CONTROL)
return (iso_control(so, (int)m, (caddr_t)nam,
if (req == PRU_CONTROL)
return (iso_control(so, (int)m, (caddr_t)nam,
return (EINVAL); /* XXX */
}
if (inp) {
return (EINVAL); /* XXX */
}
if (inp) {
- tp = inpcbtotcpcb(inp);
if (tp == 0)
panic("tuba_usrreq");
ostate = tp->t_state;
if (tp == 0)
panic("tuba_usrreq");
ostate = tp->t_state;
- isop = tp->tp_tuba_pcb;
+ isop = (struct isopcb *)tp->t_tuba_pcb;
if (isop == 0)
panic("tuba_usrreq 2");
} else
if (isop == 0)
panic("tuba_usrreq 2");
} else
case PRU_ATTACH:
if (error = iso_pcballoc(so, &tuba_isopcb))
break;
case PRU_ATTACH:
if (error = iso_pcballoc(so, &tuba_isopcb))
break;
- isop = (struct isopcb *) tp->tp_tuba_pcb = so->so_pcb;
+ isop = (struct isopcb *) tp->t_tuba_pcb = so->so_pcb;
if (error = tcp_userreq(so, req, m, nam, control)) {
isop->isop_socket = 0;
isop_detach(isop);
if (error = tcp_userreq(so, req, m, nam, control)) {
isop->isop_socket = 0;
isop_detach(isop);
(error = iso_pcbbind(isop, (struct mbuf *)0)))
break;
bcopy(TSEL(isop->isop_laddr), &inp->inp_lport, 2);
(error = iso_pcbbind(isop, (struct mbuf *)0)))
break;
bcopy(TSEL(isop->isop_laddr), &inp->inp_lport, 2);
- if (cmd == PRU_LISTEN) {
+ if (req == PRU_LISTEN) {
tp->t_state = TCPS_LISTEN;
break;
}
tp->t_state = TCPS_LISTEN;
break;
}
break;
}
bcopy(TSEL(isop->isop_faddr), &inp->inp_fport, 2);
break;
}
bcopy(TSEL(isop->isop_faddr), &inp->inp_fport, 2);
- if ((inp->inp_laddr.s_addr == 0 &&
+ if (inp->inp_laddr.s_addr == 0 &&
(inp->inp_laddr.s_addr =
tuba_lookup(&isop->isop_laddr->siso_addr)) == 0)
goto unconnect;
(inp->inp_laddr.s_addr =
tuba_lookup(&isop->isop_laddr->siso_addr)) == 0)
goto unconnect;