2003-10-30 04:43:08 +03:00
|
|
|
/* $NetBSD: iso_pcb.c,v 1.25 2003/10/30 01:43:10 simonb Exp $ */
|
1994-06-29 10:39:25 +04:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
/*-
|
1994-05-13 10:08:03 +04:00
|
|
|
* Copyright (c) 1991, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* 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.
|
2003-08-07 20:26:28 +04:00
|
|
|
* 3. Neither the name of the University nor the names of its contributors
|
1993-04-09 16:00:07 +04:00
|
|
|
* 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.
|
|
|
|
*
|
1998-03-01 05:20:01 +03:00
|
|
|
* @(#)iso_pcb.c 8.3 (Berkeley) 7/19/94
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Copyright IBM Corporation 1987
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1993-04-09 16:00:07 +04:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-02-14 01:07:57 +03:00
|
|
|
both that copyright notice and this permission notice appear in
|
1993-04-09 16:00:07 +04:00
|
|
|
supporting documentation, and that the name of IBM not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
1996-02-14 01:07:57 +03:00
|
|
|
software without specific, written prior permission.
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Iso address family net-layer(s) pcb stuff. NEH 1/29/87
|
|
|
|
*/
|
|
|
|
|
2001-11-13 03:56:55 +03:00
|
|
|
#include <sys/cdefs.h>
|
2003-10-30 04:43:08 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: iso_pcb.c,v 1.25 2003/10/30 01:43:10 simonb Exp $");
|
2001-11-13 03:56:55 +03:00
|
|
|
|
1998-07-05 08:37:35 +04:00
|
|
|
#include "opt_iso.h"
|
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
#ifdef ISO
|
|
|
|
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/socketvar.h>
|
|
|
|
#include <sys/errno.h>
|
1996-05-22 17:54:55 +04:00
|
|
|
#include <sys/proc.h>
|
1993-12-18 03:40:47 +03:00
|
|
|
|
|
|
|
#include <netiso/argo_debug.h>
|
|
|
|
#include <netiso/iso.h>
|
|
|
|
#include <netiso/clnp.h>
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <net/route.h>
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <netiso/iso_pcb.h>
|
|
|
|
#include <netiso/iso_var.h>
|
1994-05-13 10:08:03 +04:00
|
|
|
#include <sys/protosw.h>
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
#ifdef TPCONS
|
1993-12-18 03:40:47 +03:00
|
|
|
#include <netccitt/x25.h>
|
|
|
|
#include <netccitt/pk.h>
|
|
|
|
#include <netccitt/pk_var.h>
|
1996-02-14 01:07:57 +03:00
|
|
|
#include <netccitt/pk_extern.h>
|
1993-04-09 16:00:07 +04:00
|
|
|
#endif
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
struct iso_addr zeroiso_addr = {
|
1993-04-09 16:00:07 +04:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2002-05-13 01:30:35 +04:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
unsigned char argo_debug[128];
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcballoc
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: creates an isopcb structure in an mbuf,
|
|
|
|
* with socket (so), and
|
|
|
|
* puts it in the queue with head (head)
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: 0 if OK, ENOBUFS if can't alloc the necessary mbuf
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
int
|
1996-02-14 01:07:57 +03:00
|
|
|
iso_pcballoc(so, v)
|
|
|
|
struct socket *so;
|
|
|
|
void *v;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *head = v;
|
2000-03-30 16:51:13 +04:00
|
|
|
struct isopcb *isop;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcballoc(so %p)\n", so);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
MALLOC(isop, struct isopcb *, sizeof(*isop), M_PCB, M_NOWAIT);
|
|
|
|
if (isop == NULL)
|
|
|
|
return ENOBUFS;
|
1996-02-14 01:07:57 +03:00
|
|
|
bzero(isop, sizeof(*isop));
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_head = head;
|
|
|
|
isop->isop_socket = so;
|
|
|
|
insque(isop, head);
|
|
|
|
if (so)
|
1995-08-17 06:57:20 +04:00
|
|
|
so->so_pcb = isop;
|
1993-04-09 16:00:07 +04:00
|
|
|
return 0;
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcbbind
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: binds the address given in *(nam) to the socket
|
|
|
|
* specified by the isopcb in *(isop)
|
|
|
|
* If the given address is zero, it makes sure the
|
|
|
|
* address isn't already in use and if it's got a network
|
|
|
|
* portion, we look for an interface with that network
|
|
|
|
* address. If the address given is zero, we allocate
|
|
|
|
* a port and stuff it in the (nam) structure.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: errno E* or 0 if ok.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* SIDE EFFECTS: increments head->isop_lport if it allocates a port #
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* NOTES:
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
int
|
1996-05-22 17:54:55 +04:00
|
|
|
iso_pcbbind(v, nam, p)
|
2000-03-30 16:51:13 +04:00
|
|
|
void *v;
|
1996-05-22 17:54:55 +04:00
|
|
|
struct mbuf *nam;
|
|
|
|
struct proc *p;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
struct isopcb *isop = v;
|
|
|
|
struct isopcb *head = isop->isop_head;
|
|
|
|
struct sockaddr_iso *siso;
|
1993-04-09 16:00:07 +04:00
|
|
|
struct iso_ifaddr *ia;
|
|
|
|
union {
|
1996-02-14 01:07:57 +03:00
|
|
|
char data[2];
|
|
|
|
u_short s;
|
1993-04-09 16:00:07 +04:00
|
|
|
} suf;
|
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbbind(isop %p, nam %p)\n", isop, nam);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
suf.s = 0;
|
1996-02-14 01:07:57 +03:00
|
|
|
if (iso_ifaddr.tqh_first == 0) /* any interfaces attached? */
|
1993-04-09 16:00:07 +04:00
|
|
|
return EADDRNOTAVAIL;
|
1996-02-14 01:07:57 +03:00
|
|
|
if (isop->isop_laddr) /* already bound */
|
1993-04-09 16:00:07 +04:00
|
|
|
return EADDRINUSE;
|
1996-02-14 01:07:57 +03:00
|
|
|
if (nam == (struct mbuf *) 0) {
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_laddr = &isop->isop_sladdr;
|
|
|
|
isop->isop_sladdr.siso_len = sizeof(struct sockaddr_iso);
|
|
|
|
isop->isop_sladdr.siso_family = AF_ISO;
|
|
|
|
isop->isop_sladdr.siso_tlen = 2;
|
|
|
|
isop->isop_sladdr.siso_nlen = 0;
|
|
|
|
isop->isop_sladdr.siso_slen = 0;
|
|
|
|
isop->isop_sladdr.siso_plen = 0;
|
|
|
|
goto noname;
|
|
|
|
}
|
|
|
|
siso = mtod(nam, struct sockaddr_iso *);
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbbind(name len 0x%x)\n", nam->m_len);
|
|
|
|
printf("The address is %s\n", clnp_iso_addrp(&siso->siso_addr));
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* We would like sort of length check but since some OSI addrs
|
|
|
|
* do not have fixed length, we can't really do much.
|
|
|
|
* The ONLY thing we can say is that an osi addr has to have
|
|
|
|
* at LEAST an afi and one more byte and had better fit into
|
|
|
|
* a struct iso_addr.
|
|
|
|
* However, in fact the size of the whole thing is a struct
|
|
|
|
* sockaddr_iso, so probably this is what we should check for.
|
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
if ((nam->m_len < 2) || (nam->m_len < siso->siso_len)) {
|
|
|
|
return ENAMETOOLONG;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
if (siso->siso_nlen) {
|
|
|
|
/* non-zero net addr- better match one of our interfaces */
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbbind: bind to NOT zeroisoaddr\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
for (ia = iso_ifaddr.tqh_first; ia != 0; ia = ia->ia_list.tqe_next)
|
1998-03-01 05:20:01 +03:00
|
|
|
if (SAME_ISOIFADDR(siso, &ia->ia_addr))
|
1993-04-09 16:00:07 +04:00
|
|
|
break;
|
|
|
|
if (ia == 0)
|
|
|
|
return EADDRNOTAVAIL;
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
if (siso->siso_len <= sizeof(isop->isop_sladdr)) {
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_laddr = &isop->isop_sladdr;
|
|
|
|
} else {
|
1996-02-14 01:07:57 +03:00
|
|
|
if ((nam = m_copy(nam, 0, (int) M_COPYALL)) == 0)
|
1993-04-09 16:00:07 +04:00
|
|
|
return ENOBUFS;
|
1997-06-24 06:25:59 +04:00
|
|
|
isop->isop_mladdr = nam;
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_laddr = mtod(nam, struct sockaddr_iso *);
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
bcopy((caddr_t) siso, (caddr_t) isop->isop_laddr, siso->siso_len);
|
1994-05-13 10:08:03 +04:00
|
|
|
if (siso->siso_tlen == 0)
|
|
|
|
goto noname;
|
|
|
|
if ((isop->isop_socket->so_options & SO_REUSEADDR) == 0 &&
|
1996-02-14 01:07:57 +03:00
|
|
|
iso_pcblookup(head, 0, (caddr_t) 0, isop->isop_laddr))
|
1994-05-13 10:08:03 +04:00
|
|
|
return EADDRINUSE;
|
|
|
|
if (siso->siso_tlen <= 2) {
|
|
|
|
bcopy(TSEL(siso), suf.data, sizeof(suf.data));
|
|
|
|
suf.s = ntohs(suf.s);
|
1996-05-22 17:54:55 +04:00
|
|
|
if (suf.s < ISO_PORT_RESERVED &&
|
2003-10-30 04:43:08 +03:00
|
|
|
(p == 0 || suser(p->p_ucred, &p->p_acflag)))
|
1993-04-09 16:00:07 +04:00
|
|
|
return EACCES;
|
|
|
|
} else {
|
2000-03-30 16:51:13 +04:00
|
|
|
char *cp;
|
1993-04-09 16:00:07 +04:00
|
|
|
noname:
|
|
|
|
cp = TSEL(isop->isop_laddr);
|
1998-03-01 05:20:01 +03:00
|
|
|
isop->isop_laddr->siso_tlen = 2;
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbbind noname\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
do {
|
|
|
|
if (head->isop_lport++ < ISO_PORT_RESERVED ||
|
|
|
|
head->isop_lport > ISO_PORT_USERRESERVED)
|
|
|
|
head->isop_lport = ISO_PORT_RESERVED;
|
1994-05-13 10:08:03 +04:00
|
|
|
suf.s = htons(head->isop_lport);
|
1993-04-09 16:00:07 +04:00
|
|
|
cp[0] = suf.data[0];
|
|
|
|
cp[1] = suf.data[1];
|
1996-02-14 01:07:57 +03:00
|
|
|
} while (iso_pcblookup(head, 0, (caddr_t) 0, isop->isop_laddr));
|
|
|
|
}
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbbind returns 0, suf 0x%x\n", suf.s);
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcbconnect
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: Make the isopcb (isop) look like it's connected.
|
|
|
|
* In other words, give it the peer address given in
|
|
|
|
* the mbuf * (nam). Make sure such a combination
|
|
|
|
* of local, peer addresses doesn't already exist
|
|
|
|
* for this protocol. Internet mentality prevails here,
|
|
|
|
* wherein a src,dst pair uniquely identifies a connection.
|
|
|
|
* Both net address and port must be specified in argument
|
|
|
|
* (nam).
|
|
|
|
* If we don't have a local address for this socket yet,
|
|
|
|
* we pick one by calling iso_pcbbind().
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: errno E* or 0 if ok.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* SIDE EFFECTS: Looks up a route, which may cause one to be left
|
1996-02-14 01:07:57 +03:00
|
|
|
* in the isopcb.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* NOTES:
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
int
|
1996-02-14 01:07:57 +03:00
|
|
|
iso_pcbconnect(v, nam)
|
|
|
|
void *v;
|
|
|
|
struct mbuf *nam;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
struct isopcb *isop = v;
|
|
|
|
struct sockaddr_iso *siso = mtod(nam, struct sockaddr_iso *);
|
1996-02-14 01:07:57 +03:00
|
|
|
int local_zero, error = 0;
|
|
|
|
struct iso_ifaddr *ia;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbconnect(isop %p sock %p nam %p",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop, isop->isop_socket, nam);
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("nam->m_len 0x%x), addr:\n", nam->m_len);
|
1993-04-09 16:00:07 +04:00
|
|
|
dump_isoaddr(siso);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (nam->m_len < siso->siso_len)
|
1996-02-14 01:07:57 +03:00
|
|
|
return EINVAL;
|
1993-04-09 16:00:07 +04:00
|
|
|
if (siso->siso_family != AF_ISO)
|
|
|
|
return EAFNOSUPPORT;
|
|
|
|
if (siso->siso_nlen == 0) {
|
1996-02-14 01:07:57 +03:00
|
|
|
if ((ia = iso_ifaddr.tqh_first) != NULL) {
|
|
|
|
int nlen = ia->ia_addr.siso_nlen;
|
1999-03-13 01:42:30 +03:00
|
|
|
memmove(nlen + TSEL(siso), TSEL(siso),
|
1996-02-14 01:07:57 +03:00
|
|
|
siso->siso_plen + siso->siso_tlen + siso->siso_slen);
|
|
|
|
bcopy((caddr_t) & ia->ia_addr.siso_addr,
|
|
|
|
(caddr_t) & siso->siso_addr, nlen + 1);
|
1993-04-09 16:00:07 +04:00
|
|
|
/* includes siso->siso_nlen = nlen; */
|
|
|
|
} else
|
|
|
|
return EADDRNOTAVAIL;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* Local zero means either not bound, or bound to a TSEL, but no
|
|
|
|
* particular local interface. So, if we want to send somebody
|
|
|
|
* we need to choose a return address.
|
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
local_zero =
|
1993-04-09 16:00:07 +04:00
|
|
|
((isop->isop_laddr == 0) || (isop->isop_laddr->siso_nlen == 0));
|
|
|
|
if (local_zero) {
|
1996-02-14 01:07:57 +03:00
|
|
|
int flags;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbconnect localzero 1\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* If route is known or can be allocated now, our src addr is
|
|
|
|
* taken from the i/f, else punt.
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
flags = isop->isop_socket->so_options & SO_DONTROUTE;
|
1996-02-14 01:07:57 +03:00
|
|
|
error = clnp_route(&siso->siso_addr, &isop->isop_route, flags,
|
|
|
|
NULL, &ia);
|
|
|
|
if (error)
|
1993-04-09 16:00:07 +04:00
|
|
|
return error;
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbconnect localzero 2, ro->ro_rt %p",
|
1996-04-13 05:34:06 +04:00
|
|
|
isop->isop_route.ro_rt);
|
1996-10-13 06:03:00 +04:00
|
|
|
printf(" ia %p\n", ia);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("in iso_pcbconnect before lookup isop %p isop->sock %p\n",
|
1996-04-13 05:34:06 +04:00
|
|
|
isop, isop->isop_socket);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (local_zero) {
|
1996-02-14 01:07:57 +03:00
|
|
|
int nlen, tlen, totlen;
|
|
|
|
caddr_t oldtsel, newtsel;
|
1993-04-09 16:00:07 +04:00
|
|
|
siso = isop->isop_laddr;
|
|
|
|
if (siso == 0 || siso->siso_tlen == 0)
|
1996-05-22 17:54:55 +04:00
|
|
|
(void) iso_pcbbind(isop, (struct mbuf *)0,
|
|
|
|
(struct proc *)0);
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* Here we have problem of squezeing in a definite network address
|
|
|
|
* into an existing sockaddr_iso, which in fact may not have room
|
|
|
|
* for it. This gets messy.
|
|
|
|
*/
|
|
|
|
siso = isop->isop_laddr;
|
|
|
|
oldtsel = TSEL(siso);
|
|
|
|
tlen = siso->siso_tlen;
|
|
|
|
nlen = ia->ia_addr.siso_nlen;
|
1998-01-28 05:35:10 +03:00
|
|
|
totlen = tlen + nlen + offsetof(struct sockaddr_iso, siso_data[0]);
|
1993-04-09 16:00:07 +04:00
|
|
|
if ((siso == &isop->isop_sladdr) &&
|
1996-02-14 01:07:57 +03:00
|
|
|
(totlen > sizeof(isop->isop_sladdr))) {
|
|
|
|
struct mbuf *m = m_get(M_DONTWAIT, MT_SONAME);
|
1993-04-09 16:00:07 +04:00
|
|
|
if (m == 0)
|
1996-02-14 01:07:57 +03:00
|
|
|
return ENOBUFS;
|
1993-04-09 16:00:07 +04:00
|
|
|
m->m_len = totlen;
|
1997-06-24 06:25:59 +04:00
|
|
|
isop->isop_mladdr = m;
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_laddr = siso = mtod(m, struct sockaddr_iso *);
|
|
|
|
}
|
|
|
|
siso->siso_nlen = ia->ia_addr.siso_nlen;
|
|
|
|
newtsel = TSEL(siso);
|
1999-03-13 01:42:30 +03:00
|
|
|
memmove(newtsel, oldtsel, tlen);
|
1993-04-09 16:00:07 +04:00
|
|
|
bcopy(ia->ia_addr.siso_data, siso->siso_data, nlen);
|
|
|
|
siso->siso_tlen = tlen;
|
|
|
|
siso->siso_family = AF_ISO;
|
|
|
|
siso->siso_len = totlen;
|
|
|
|
siso = mtod(nam, struct sockaddr_iso *);
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("in iso_pcbconnect before bcopy isop %p isop->sock %p\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop, isop->isop_socket);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* If we had to allocate space to a previous big foreign address,
|
|
|
|
* and for some reason we didn't free it, we reuse it knowing
|
|
|
|
* that is going to be big enough, as sockaddrs are delivered in
|
|
|
|
* 128 byte mbufs.
|
|
|
|
* If the foreign address is small enough, we use default space;
|
|
|
|
* otherwise, we grab an mbuf to copy into.
|
|
|
|
*/
|
|
|
|
if (isop->isop_faddr == 0 || isop->isop_faddr == &isop->isop_sfaddr) {
|
|
|
|
if (siso->siso_len <= sizeof(isop->isop_sfaddr))
|
|
|
|
isop->isop_faddr = &isop->isop_sfaddr;
|
|
|
|
else {
|
1996-02-14 01:07:57 +03:00
|
|
|
struct mbuf *m = m_get(M_DONTWAIT, MT_SONAME);
|
1993-04-09 16:00:07 +04:00
|
|
|
if (m == 0)
|
|
|
|
return ENOBUFS;
|
1997-06-24 06:25:59 +04:00
|
|
|
isop->isop_mfaddr = m;
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_faddr = mtod(m, struct sockaddr_iso *);
|
|
|
|
}
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
bcopy((caddr_t) siso, (caddr_t) isop->isop_faddr, siso->siso_len);
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("in iso_pcbconnect after bcopy isop %p isop->sock %p\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop, isop->isop_socket);
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbconnect connected to addr:\n");
|
1993-04-09 16:00:07 +04:00
|
|
|
dump_isoaddr(isop->isop_faddr);
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbconnect end: src addr:\n");
|
1993-04-09 16:00:07 +04:00
|
|
|
dump_isoaddr(isop->isop_laddr);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcbdisconnect()
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: washes away the peer address info so the socket
|
|
|
|
* appears to be disconnected.
|
|
|
|
* If there's no file descriptor associated with the socket
|
|
|
|
* it detaches the pcb.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: Nada.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
|
|
|
* SIDE EFFECTS: May detach the pcb.
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* NOTES:
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
void
|
1996-02-14 01:07:57 +03:00
|
|
|
iso_pcbdisconnect(v)
|
|
|
|
void *v;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *isop = v;
|
2000-03-30 16:51:13 +04:00
|
|
|
struct sockaddr_iso *siso;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdisconnect(isop %p)\n", isop);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
/*
|
|
|
|
* Preserver binding infnormation if already bound.
|
|
|
|
*/
|
|
|
|
if ((siso = isop->isop_laddr) && siso->siso_nlen && siso->siso_tlen) {
|
1996-02-14 01:07:57 +03:00
|
|
|
caddr_t otsel = TSEL(siso);
|
1993-04-09 16:00:07 +04:00
|
|
|
siso->siso_nlen = 0;
|
1999-03-13 01:42:30 +03:00
|
|
|
memmove(TSEL(siso), otsel, siso->siso_tlen);
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
if (isop->isop_faddr && isop->isop_faddr != &isop->isop_sfaddr)
|
1997-06-24 06:25:59 +04:00
|
|
|
m_freem(isop->isop_mfaddr);
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_faddr = 0;
|
|
|
|
if (isop->isop_socket->so_state & SS_NOFDREF)
|
|
|
|
iso_pcbdetach(isop);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcbdetach
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: detach the pcb at *(isop) from it's socket and free
|
|
|
|
* the mbufs associated with the pcb..
|
|
|
|
* Dequeues (isop) from its head.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: Nada.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* SIDE EFFECTS:
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* NOTES:
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
void
|
1996-02-14 01:07:57 +03:00
|
|
|
iso_pcbdetach(v)
|
|
|
|
void *v;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *isop = v;
|
|
|
|
struct socket *so = isop->isop_socket;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach(isop %p socket %p so %p)\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop, isop->isop_socket, so);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
#ifdef TPCONS
|
1994-05-13 10:08:03 +04:00
|
|
|
if (isop->isop_chan) {
|
2000-03-30 16:51:13 +04:00
|
|
|
struct pklcd *lcp = (struct pklcd *) isop->isop_chan;
|
1993-04-09 16:00:07 +04:00
|
|
|
if (--isop->isop_refcnt > 0)
|
|
|
|
return;
|
1994-05-13 10:08:03 +04:00
|
|
|
if (lcp && lcp->lcd_state == DATA_TRANSFER) {
|
|
|
|
lcp->lcd_upper = 0;
|
|
|
|
lcp->lcd_upnext = 0;
|
1993-04-09 16:00:07 +04:00
|
|
|
pk_disconnect(lcp);
|
1994-05-13 10:08:03 +04:00
|
|
|
}
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_chan = 0;
|
|
|
|
}
|
|
|
|
#endif
|
1996-02-14 01:07:57 +03:00
|
|
|
if (so) { /* in the x.25 domain, we sometimes have no
|
|
|
|
* socket */
|
1993-04-09 16:00:07 +04:00
|
|
|
so->so_pcb = 0;
|
1996-02-14 01:07:57 +03:00
|
|
|
sofree(so);
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 2 \n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (isop->isop_options)
|
1996-02-14 01:07:57 +03:00
|
|
|
(void) m_free(isop->isop_options);
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 3 \n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (isop->isop_route.ro_rt)
|
|
|
|
rtfree(isop->isop_route.ro_rt);
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 3.1\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (isop->isop_clnpcache != NULL) {
|
|
|
|
struct clnp_cache *clcp =
|
1996-02-14 01:07:57 +03:00
|
|
|
mtod(isop->isop_clnpcache, struct clnp_cache *);
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 3.2: clcp %p freeing clc_hdr %p\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
clcp, clcp->clc_hdr);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (clcp->clc_hdr != NULL)
|
|
|
|
m_free(clcp->clc_hdr);
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 3.3: freeing cache %p\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop->isop_clnpcache);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
m_free(isop->isop_clnpcache);
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 4 \n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
remque(isop);
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbdetach 5 \n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
if (isop->isop_laddr && (isop->isop_laddr != &isop->isop_sladdr))
|
1997-06-24 06:25:59 +04:00
|
|
|
m_freem(isop->isop_mladdr);
|
1996-02-14 01:07:57 +03:00
|
|
|
free((caddr_t) isop, M_PCB);
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcbnotify
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: notify all connections in this protocol's queue (head)
|
|
|
|
* that have peer address (dst) of the problem (errno)
|
|
|
|
* by calling (notify) on the connections' isopcbs.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: Rien.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* SIDE EFFECTS:
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
2001-04-14 03:29:55 +04:00
|
|
|
* NOTES: (notify) is called at splnet!
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
iso_pcbnotify(head, siso, errno, notify)
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *head;
|
2000-03-30 16:51:13 +04:00
|
|
|
struct sockaddr_iso *siso;
|
1996-02-14 01:07:57 +03:00
|
|
|
int errno;
|
|
|
|
void (*notify) __P((struct isopcb *));
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
struct isopcb *isop;
|
2001-04-14 03:29:55 +04:00
|
|
|
int s = splnet();
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbnotify(head %p, notify %p) dst:\n",
|
1996-04-13 05:34:06 +04:00
|
|
|
head, notify);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
for (isop = head->isop_next; isop != head; isop = isop->isop_next) {
|
|
|
|
if (isop->isop_socket == 0 || isop->isop_faddr == 0 ||
|
1996-02-14 01:07:57 +03:00
|
|
|
!SAME_ISOADDR(siso, isop->isop_faddr)) {
|
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcbnotify: CONTINUE isop %p, sock %p\n",
|
1996-10-11 03:12:43 +04:00
|
|
|
isop, isop->isop_socket);
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("addrmatch cmp'd with (%p):\n",
|
1996-04-13 05:34:06 +04:00
|
|
|
isop->isop_faddr);
|
1993-04-09 16:00:07 +04:00
|
|
|
dump_isoaddr(isop->isop_faddr);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
continue;
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
if (errno)
|
1993-04-09 16:00:07 +04:00
|
|
|
isop->isop_socket->so_error = errno;
|
|
|
|
if (notify)
|
1996-02-14 01:07:57 +03:00
|
|
|
(*notify) (isop);
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
splx(s);
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("END OF iso_pcbnotify\n");
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FUNCTION: iso_pcblookup
|
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* PURPOSE: looks for a given combination of (faddr), (fport),
|
|
|
|
* (lport), (laddr) in the queue named by (head).
|
|
|
|
* Argument (flags) is ignored.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* RETURNS: ptr to the isopcb if it finds a connection matching
|
|
|
|
* these arguments, o.w. returns zero.
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* SIDE EFFECTS:
|
1993-04-09 16:00:07 +04:00
|
|
|
*
|
1996-02-14 01:07:57 +03:00
|
|
|
* NOTES:
|
1993-04-09 16:00:07 +04:00
|
|
|
*/
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *
|
1993-04-09 16:00:07 +04:00
|
|
|
iso_pcblookup(head, fportlen, fport, laddr)
|
1996-02-14 01:07:57 +03:00
|
|
|
struct isopcb *head;
|
2000-03-30 16:51:13 +04:00
|
|
|
struct sockaddr_iso *laddr;
|
1996-02-14 01:07:57 +03:00
|
|
|
caddr_t fport;
|
|
|
|
int fportlen;
|
1993-04-09 16:00:07 +04:00
|
|
|
{
|
2000-03-30 16:51:13 +04:00
|
|
|
struct isopcb *isop;
|
|
|
|
caddr_t lp = TSEL(laddr);
|
1996-02-14 01:07:57 +03:00
|
|
|
unsigned int llen = laddr->siso_tlen;
|
1993-04-09 16:00:07 +04:00
|
|
|
|
1996-02-14 01:07:57 +03:00
|
|
|
#ifdef ARGO_DEBUG
|
|
|
|
if (argo_debug[D_ISO]) {
|
1996-10-13 06:03:00 +04:00
|
|
|
printf("iso_pcblookup(head %p laddr %p fport %p)\n",
|
1996-04-13 05:34:06 +04:00
|
|
|
head, laddr, fport);
|
1996-02-14 01:07:57 +03:00
|
|
|
}
|
|
|
|
#endif
|
1993-04-09 16:00:07 +04:00
|
|
|
for (isop = head->isop_next; isop != head; isop = isop->isop_next) {
|
|
|
|
if (isop->isop_laddr == 0 || isop->isop_laddr == laddr)
|
|
|
|
continue;
|
|
|
|
if (isop->isop_laddr->siso_tlen != llen)
|
|
|
|
continue;
|
|
|
|
if (bcmp(lp, TSEL(isop->isop_laddr), llen))
|
|
|
|
continue;
|
|
|
|
if (fportlen && isop->isop_faddr &&
|
1996-02-14 01:07:57 +03:00
|
|
|
bcmp(fport, TSEL(isop->isop_faddr), (unsigned) fportlen))
|
1993-04-09 16:00:07 +04:00
|
|
|
continue;
|
1996-02-14 01:07:57 +03:00
|
|
|
/*
|
|
|
|
* PHASE2 addrmatch1 should be iso_addrmatch(a, b, mask)
|
|
|
|
* where mask is taken from isop->isop_laddrmask (new field)
|
|
|
|
* isop_lnetmask will also be available in isop if (laddr !=
|
|
|
|
* &zeroiso_addr && !iso_addrmatch1(laddr,
|
|
|
|
* &(isop->isop_laddr.siso_addr))) continue;
|
|
|
|
*/
|
1993-04-09 16:00:07 +04:00
|
|
|
if (laddr->siso_nlen && (!SAME_ISOADDR(laddr, isop->isop_laddr)))
|
|
|
|
continue;
|
|
|
|
return (isop);
|
|
|
|
}
|
1996-02-14 01:07:57 +03:00
|
|
|
return (struct isopcb *) 0;
|
1993-04-09 16:00:07 +04:00
|
|
|
}
|
1994-05-13 10:08:03 +04:00
|
|
|
#endif /* ISO */
|