Removed the #ifdef IPXERRORMSGS'ed code. Fix a lot of style errors that I
introduced with the previous commit. Style fixes Submitted by: Bruce Evans <bde@FreeBSD.ORG>
This commit is contained in:
parent
ee97e537f7
commit
8f65b5944d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26965
@ -242,7 +242,6 @@ netinet/ip_proxy.c optional ipfilter inet
|
||||
netinet/mln_ipl.c optional ipfilter inet
|
||||
netipx/ipx.c optional ipx
|
||||
netipx/ipx_cksum.c optional ipx
|
||||
netipx/ipx_error.c optional ipx
|
||||
netipx/ipx_input.c optional ipx
|
||||
netipx/ipx_ip.c optional ipx
|
||||
netipx/ipx_outputfl.c optional ipx
|
||||
|
@ -33,19 +33,15 @@
|
||||
*
|
||||
* @(#)ipx.c
|
||||
*
|
||||
* $Id: ipx.c,v 1.9 1997/05/01 06:21:27 jhay Exp $
|
||||
* $Id: ipx.c,v 1.10 1997/05/10 09:58:48 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
@ -333,3 +329,64 @@ ipx_iaonnetof(dst)
|
||||
}
|
||||
return (ia_maybe);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ipx_printhost(addr)
|
||||
register struct ipx_addr *addr;
|
||||
{
|
||||
u_short port;
|
||||
struct ipx_addr work = *addr;
|
||||
register char *p; register u_char *q;
|
||||
register char *net = "", *host = "";
|
||||
char cport[10], chost[15], cnet[15];
|
||||
|
||||
port = ntohs(work.x_port);
|
||||
|
||||
if (ipx_nullnet(work) && ipx_nullhost(work)) {
|
||||
|
||||
if (port)
|
||||
printf("*.%x", port);
|
||||
else
|
||||
printf("*.*");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipx_wildnet(work))
|
||||
net = "any";
|
||||
else if (ipx_nullnet(work))
|
||||
net = "*";
|
||||
else {
|
||||
q = work.x_net.c_net;
|
||||
sprintf(cnet, "%x%x%x%x",
|
||||
q[0], q[1], q[2], q[3]);
|
||||
for (p = cnet; *p == '0' && p < cnet + 8; p++)
|
||||
continue;
|
||||
net = p;
|
||||
}
|
||||
|
||||
if (ipx_wildhost(work))
|
||||
host = "any";
|
||||
else if (ipx_nullhost(work))
|
||||
host = "*";
|
||||
else {
|
||||
q = work.x_host.c_host;
|
||||
sprintf(chost, "%x%x%x%x%x%x",
|
||||
q[0], q[1], q[2], q[3], q[4], q[5]);
|
||||
for (p = chost; *p == '0' && p < chost + 12; p++)
|
||||
continue;
|
||||
host = p;
|
||||
}
|
||||
|
||||
if (port) {
|
||||
if (strcmp(host, "*") == 0) {
|
||||
host = "";
|
||||
sprintf(cport, "%x", port);
|
||||
} else
|
||||
sprintf(cport, ".%x", port);
|
||||
} else
|
||||
*cport = 0;
|
||||
|
||||
printf("%s.%s%s", net, host, cport);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx.h
|
||||
*
|
||||
* $Id: ipx.h,v 1.11 1997/05/01 06:21:27 jhay Exp $
|
||||
* $Id: ipx.h,v 1.12 1997/05/10 09:58:49 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPX_H_
|
||||
@ -68,11 +68,11 @@
|
||||
#define IPXPORT_NETBIOS 0x0455 /* NW NetBIOS */
|
||||
#define IPXPORT_DIAGS 0x0456 /* NW Diagnostics */
|
||||
/*
|
||||
* Ports < IPXPORT_RESERVED are reserved for priveleged
|
||||
* Ports < IPXPORT_RESERVED are reserved for privileged
|
||||
*/
|
||||
#define IPXPORT_RESERVED 0x4000
|
||||
/*
|
||||
* Ports > IPXPORT_WELLKNOWN are reserved for priveleged
|
||||
* Ports > IPXPORT_WELLKNOWN are reserved for privileged
|
||||
* processes (e.g. root).
|
||||
*/
|
||||
#define IPXPORT_WELLKNOWN 0x6000
|
||||
@ -168,4 +168,4 @@ struct ipx_addr ipx_addr __P((const char *));
|
||||
char *ipx_ntoa __P((struct ipx_addr));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _NETIPX_IPX_H_ */
|
||||
#endif /* !_NETIPX_IPX_H_ */
|
||||
|
@ -33,17 +33,12 @@
|
||||
*
|
||||
* @(#)ipx_cksum.c
|
||||
*
|
||||
* $Id: ipx_cksum.c,v 1.5 1997/02/22 09:41:52 peter Exp $
|
||||
* $Id: ipx_cksum.c,v 1.6 1997/05/10 09:58:50 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
|
||||
/*
|
||||
|
@ -1,391 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1995, Mike Mitchell
|
||||
* Copyright (c) 1984, 1988, 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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.
|
||||
*
|
||||
* @(#)ipx_error.c
|
||||
*
|
||||
* $Id: ipx_error.c,v 1.7 1997/02/22 09:41:53 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/spx.h>
|
||||
#include <netipx/ipx_pcb.h>
|
||||
#include <netipx/ipx_error.h>
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
|
||||
/*
|
||||
* IPX_ERR routines: error generation, receive packet processing, and
|
||||
* routines to turnaround packets back to the originator.
|
||||
*/
|
||||
#ifndef IPX_ERRPRINTFS
|
||||
#define IPX_ERRPRINTFS 0
|
||||
#endif
|
||||
int ipx_errprintfs = IPX_ERRPRINTFS;
|
||||
|
||||
struct ipx_errstat ipx_errstat;
|
||||
|
||||
int
|
||||
ipx_err_x(c)
|
||||
int c;
|
||||
{
|
||||
register u_short *w, *lim, *base = ipx_errstat.ipx_es_codes;
|
||||
u_short x = c;
|
||||
|
||||
/*
|
||||
* zero is a legit error code, handle specially
|
||||
*/
|
||||
if (x == 0)
|
||||
return (0);
|
||||
lim = base + IPX_ERR_MAX - 1;
|
||||
for (w = base + 1; w < lim; w++) {
|
||||
if (*w == 0)
|
||||
*w = x;
|
||||
if (*w == x)
|
||||
break;
|
||||
}
|
||||
return (w - base);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate an error packet of type error
|
||||
* in response to bad packet.
|
||||
*/
|
||||
|
||||
void
|
||||
ipx_error(om, type, param)
|
||||
struct mbuf *om;
|
||||
int type, param;
|
||||
{
|
||||
register struct ipx_epipx *ep;
|
||||
struct mbuf *m;
|
||||
struct ipx *nip;
|
||||
register struct ipx *oip = mtod(om, struct ipx *);
|
||||
|
||||
/*
|
||||
* If this packet was sent to the echo port,
|
||||
* and nobody was there, just echo it.
|
||||
* (Yes, this is a wart!)
|
||||
*/
|
||||
if (type == IPX_ERR_NOSOCK &&
|
||||
oip->ipx_dna.x_port == htons(2) &&
|
||||
(type = ipx_echo(om)) == 0)
|
||||
return;
|
||||
|
||||
if (ipx_errprintfs)
|
||||
printf("ipx_error(%x, %u, %d)\n", oip, type, param);
|
||||
|
||||
/*
|
||||
* Don't Generate error packets in response to multicasts.
|
||||
*/
|
||||
if (oip->ipx_dna.x_host.c_host[0] & 1)
|
||||
goto freeit;
|
||||
|
||||
ipx_errstat.ipx_es_error++;
|
||||
/*
|
||||
* Make sure that the old IPX packet had 30 bytes of data to return;
|
||||
* if not, don't bother. Also don't EVER error if the old
|
||||
* packet protocol was IPX_ERR.
|
||||
*/
|
||||
if (oip->ipx_len < sizeof(struct ipx)) {
|
||||
ipx_errstat.ipx_es_oldshort++;
|
||||
goto freeit;
|
||||
}
|
||||
if (oip->ipx_pt == IPXPROTO_ERROR) {
|
||||
ipx_errstat.ipx_es_oldipx_err++;
|
||||
goto freeit;
|
||||
}
|
||||
|
||||
/*
|
||||
* First, formulate ipx_err message
|
||||
*/
|
||||
m = m_gethdr(M_DONTWAIT, MT_HEADER);
|
||||
if (m == NULL)
|
||||
goto freeit;
|
||||
m->m_len = sizeof(*ep);
|
||||
m->m_pkthdr.len = m->m_len;
|
||||
m->m_pkthdr.rcvif = om->m_pkthdr.rcvif;
|
||||
MH_ALIGN(m, m->m_len);
|
||||
ep = mtod(m, struct ipx_epipx *);
|
||||
if ((u_int)type > IPX_ERR_TOO_BIG)
|
||||
panic("ipx_err_error");
|
||||
ipx_errstat.ipx_es_outhist[ipx_err_x(type)]++;
|
||||
ep->ipx_ep_errp.ipx_err_num = htons((u_short)type);
|
||||
ep->ipx_ep_errp.ipx_err_param = htons((u_short)param);
|
||||
bcopy((caddr_t)oip, (caddr_t)&ep->ipx_ep_errp.ipx_err_ipx, 42);
|
||||
nip = &ep->ipx_ep_ipx;
|
||||
nip->ipx_len = sizeof(*ep);
|
||||
nip->ipx_len = htons((u_short)nip->ipx_len);
|
||||
nip->ipx_pt = IPXPROTO_ERROR;
|
||||
nip->ipx_tc = 0;
|
||||
nip->ipx_dna = oip->ipx_sna;
|
||||
nip->ipx_sna = oip->ipx_dna;
|
||||
if (ipxcksum) {
|
||||
nip->ipx_sum = 0;
|
||||
nip->ipx_sum = ipx_cksum(m, sizeof(*ep));
|
||||
} else
|
||||
nip->ipx_sum = 0xffff;
|
||||
ipx_outputfl(m, (struct route *)NULL, 0);
|
||||
|
||||
freeit:
|
||||
m_freem(om);
|
||||
}
|
||||
|
||||
#endif /* IPXERRORMSGS */
|
||||
|
||||
void
|
||||
ipx_printhost(addr)
|
||||
register struct ipx_addr *addr;
|
||||
{
|
||||
u_short port;
|
||||
struct ipx_addr work = *addr;
|
||||
register char *p; register u_char *q;
|
||||
register char *net = "", *host = "";
|
||||
char cport[10], chost[15], cnet[15];
|
||||
|
||||
port = ntohs(work.x_port);
|
||||
|
||||
if (ipx_nullnet(work) && ipx_nullhost(work)) {
|
||||
|
||||
if (port)
|
||||
printf("*.%x", port);
|
||||
else
|
||||
printf("*.*");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipx_wildnet(work))
|
||||
net = "any";
|
||||
else if (ipx_nullnet(work))
|
||||
net = "*";
|
||||
else {
|
||||
q = work.x_net.c_net;
|
||||
sprintf(cnet, "%x%x%x%x",
|
||||
q[0], q[1], q[2], q[3]);
|
||||
for (p = cnet; *p == '0' && p < cnet + 8; p++)
|
||||
continue;
|
||||
net = p;
|
||||
}
|
||||
|
||||
if (ipx_wildhost(work))
|
||||
host = "any";
|
||||
else if (ipx_nullhost(work))
|
||||
host = "*";
|
||||
else {
|
||||
q = work.x_host.c_host;
|
||||
sprintf(chost, "%x%x%x%x%x%x",
|
||||
q[0], q[1], q[2], q[3], q[4], q[5]);
|
||||
for (p = chost; *p == '0' && p < chost + 12; p++)
|
||||
continue;
|
||||
host = p;
|
||||
}
|
||||
|
||||
if (port) {
|
||||
if (strcmp(host, "*") == 0) {
|
||||
host = "";
|
||||
sprintf(cport, "%x", port);
|
||||
} else
|
||||
sprintf(cport, ".%x", port);
|
||||
} else
|
||||
*cport = 0;
|
||||
|
||||
printf("%s.%s%s", net, host, cport);
|
||||
}
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
|
||||
/*
|
||||
* Process a received IPX_ERR message.
|
||||
*/
|
||||
void
|
||||
ipx_err_input(m)
|
||||
struct mbuf *m;
|
||||
{
|
||||
register struct ipx_errp *ep;
|
||||
register struct ipx_epipx *epipx = mtod(m, struct ipx_epipx *);
|
||||
register int i;
|
||||
int type, code, param;
|
||||
|
||||
/*
|
||||
* Locate ipx_err structure in mbuf, and check
|
||||
* that not corrupted and of at least minimum length.
|
||||
*/
|
||||
|
||||
if (ipx_errprintfs) {
|
||||
printf("ipx_err_input ");
|
||||
ipx_printhost(&epipx->ipx_ep_ipx.ipx_sna);
|
||||
printf("%d\n", ntohs(epipx->ipx_ep_ipx.ipx_len));
|
||||
}
|
||||
|
||||
i = sizeof(struct ipx_epipx);
|
||||
if (((m->m_flags & M_EXT) || m->m_len < i) &&
|
||||
(m = m_pullup(m, i)) == NULL) {
|
||||
ipx_errstat.ipx_es_tooshort++;
|
||||
return;
|
||||
}
|
||||
ep = &(mtod(m, struct ipx_epipx *)->ipx_ep_errp);
|
||||
type = ntohs(ep->ipx_err_num);
|
||||
param = ntohs(ep->ipx_err_param);
|
||||
ipx_errstat.ipx_es_inhist[ipx_err_x(type)]++;
|
||||
|
||||
/*
|
||||
* Message type specific processing.
|
||||
*/
|
||||
if (ipx_errprintfs)
|
||||
printf("ipx_err_input, type %d param %d\n", type, param);
|
||||
|
||||
if (type >= IPX_ERR_TOO_BIG) {
|
||||
goto badcode;
|
||||
}
|
||||
ipx_errstat.ipx_es_outhist[ipx_err_x(type)]++;
|
||||
switch (type) {
|
||||
|
||||
case IPX_ERR_UNREACH_HOST:
|
||||
code = PRC_UNREACH_NET;
|
||||
goto deliver;
|
||||
|
||||
case IPX_ERR_TOO_OLD:
|
||||
code = PRC_TIMXCEED_INTRANS;
|
||||
goto deliver;
|
||||
|
||||
case IPX_ERR_TOO_BIG:
|
||||
code = PRC_MSGSIZE;
|
||||
goto deliver;
|
||||
|
||||
case IPX_ERR_FULLUP:
|
||||
code = PRC_QUENCH;
|
||||
goto deliver;
|
||||
|
||||
case IPX_ERR_NOSOCK:
|
||||
code = PRC_UNREACH_PORT;
|
||||
goto deliver;
|
||||
|
||||
case IPX_ERR_UNSPEC_T:
|
||||
case IPX_ERR_BADSUM_T:
|
||||
case IPX_ERR_BADSUM:
|
||||
case IPX_ERR_UNSPEC:
|
||||
code = PRC_PARAMPROB;
|
||||
goto deliver;
|
||||
|
||||
deliver:
|
||||
/*
|
||||
* Problem with datagram; advise higher level routines.
|
||||
*/
|
||||
|
||||
if (ipx_errprintfs)
|
||||
printf("deliver to protocol %d\n",
|
||||
ep->ipx_err_ipx.ipx_pt);
|
||||
|
||||
switch(ep->ipx_err_ipx.ipx_pt) {
|
||||
case IPXPROTO_SPX:
|
||||
spx_ctlinput(code, (/* XXX */ struct sockaddr *)ep,
|
||||
(void *)NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
ipx_ctlinput(code, (/* XXX */ struct sockaddr *)ep,
|
||||
(void *)NULL);
|
||||
}
|
||||
|
||||
goto freeit;
|
||||
|
||||
default:
|
||||
badcode:
|
||||
ipx_errstat.ipx_es_badcode++;
|
||||
goto freeit;
|
||||
|
||||
}
|
||||
freeit:
|
||||
m_freem(m);
|
||||
}
|
||||
|
||||
#ifdef notdef
|
||||
u_long
|
||||
ipxtime()
|
||||
{
|
||||
int s = splclock();
|
||||
u_long t;
|
||||
|
||||
t = (time.tv_sec % (24*60*60)) * 1000 + time.tv_usec / 1000;
|
||||
splx(s);
|
||||
return (htonl(t));
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ipx_echo(m)
|
||||
struct mbuf *m;
|
||||
{
|
||||
register struct ipx *ipx = mtod(m, struct ipx *);
|
||||
register struct echo {
|
||||
struct ipx ec_ipx;
|
||||
u_short ec_op; /* Operation, 1 = request, 2 = reply */
|
||||
} *ec = (struct echo *)ipx;
|
||||
struct ipx_addr temp;
|
||||
|
||||
if (ipx->ipx_pt != IPXPROTO_ECHO)
|
||||
return (IPX_ERR_NOSOCK);
|
||||
if (ec->ec_op != htons(1))
|
||||
return (IPX_ERR_UNSPEC);
|
||||
|
||||
ec->ec_op = htons(2);
|
||||
|
||||
temp = ipx->ipx_dna;
|
||||
ipx->ipx_dna = ipx->ipx_sna;
|
||||
ipx->ipx_sna = temp;
|
||||
|
||||
if (ipxcksum && ipx->ipx_sum != 0xffff) {
|
||||
ipx->ipx_sum = 0;
|
||||
ipx->ipx_sum = ipx_cksum(m,
|
||||
(int)(((ntohs(ipx->ipx_len) - 1) | 1) + 1));
|
||||
}
|
||||
else
|
||||
ipx->ipx_sum = 0xffff;
|
||||
|
||||
ipx_outputfl(m, (struct route *)NULL, IPX_FORWARDING);
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif /* IPXERRORMSGS */
|
@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1995, Mike Mitchell
|
||||
* Copyright (c) 1984, 1988, 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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.
|
||||
*
|
||||
* @(#)ipx_error.h
|
||||
*
|
||||
* $Id: ipx_error.h,v 1.7 1997/02/22 09:41:53 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPX_ERROR_H_
|
||||
#define _NETIPX_IPX_ERROR_H_
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
|
||||
/*
|
||||
* IPX error messages
|
||||
*/
|
||||
|
||||
struct ipx_errp {
|
||||
u_short ipx_err_num; /* Error Number */
|
||||
u_short ipx_err_param; /* Error Parameter */
|
||||
struct ipx ipx_err_ipx; /* Initial segment of offending
|
||||
packet */
|
||||
u_char ipx_err_lev2[12]; /* at least this much higher
|
||||
level protocol */
|
||||
};
|
||||
struct ipx_epipx {
|
||||
struct ipx ipx_ep_ipx;
|
||||
struct ipx_errp ipx_ep_errp;
|
||||
};
|
||||
|
||||
#define IPX_ERR_UNSPEC 0 /* Unspecified Error detected at dest. */
|
||||
#define IPX_ERR_BADSUM 1 /* Bad Checksum detected at dest */
|
||||
#define IPX_ERR_NOSOCK 2 /* Specified socket does not exist at dest*/
|
||||
#define IPX_ERR_FULLUP 3 /* Dest. refuses packet due to resource lim.*/
|
||||
#define IPX_ERR_UNSPEC_T 0x200 /* Unspec. Error occured before reaching dest*/
|
||||
#define IPX_ERR_BADSUM_T 0x201 /* Bad Checksum detected in transit */
|
||||
#define IPX_ERR_UNREACH_HOST 0x202 /* Dest cannot be reached from here*/
|
||||
#define IPX_ERR_TOO_OLD 0x203 /* Packet x'd 15 routers without delivery*/
|
||||
#define IPX_ERR_TOO_BIG 0x204 /* Packet too large to be forwarded through
|
||||
some intermediate gateway. The error
|
||||
parameter field contains the max packet
|
||||
size that can be accommodated */
|
||||
#define IPX_ERR_MAX 20
|
||||
|
||||
/*
|
||||
* Variables related to this implementation
|
||||
* of the network systems error message protocol.
|
||||
*/
|
||||
struct ipx_errstat {
|
||||
/* statistics related to ipx_err packets generated */
|
||||
int ipx_es_error; /* # of calls to ipx_error */
|
||||
int ipx_es_oldshort; /* no error 'cuz old ip too short */
|
||||
int ipx_es_oldipx_err; /* no error 'cuz old was ipx_err */
|
||||
int ipx_es_outhist[IPX_ERR_MAX];
|
||||
/* statistics related to input messages processed */
|
||||
int ipx_es_badcode; /* ipx_err_code out of range */
|
||||
int ipx_es_tooshort; /* packet < IPX_MINLEN */
|
||||
int ipx_es_checksum; /* bad checksum */
|
||||
int ipx_es_badlen; /* calculated bound mismatch */
|
||||
int ipx_es_reflect; /* number of responses */
|
||||
int ipx_es_inhist[IPX_ERR_MAX];
|
||||
u_short ipx_es_codes[IPX_ERR_MAX];/* which error code for outhist
|
||||
since we might not know all */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
|
||||
extern u_char ipxctlerrmap[];
|
||||
extern struct ipx_errstat ipx_errstat;
|
||||
|
||||
int ipx_echo __P((struct mbuf *m));
|
||||
void ipx_err_input __P((struct mbuf *m));
|
||||
int ipx_err_x __P((int c));
|
||||
void ipx_error __P((struct mbuf *om, int type, int param));
|
||||
|
||||
#endif
|
||||
void ipx_printhost __P((struct ipx_addr *addr));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_IPX_ERROR_H_ */
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx_if.h
|
||||
*
|
||||
* $Id: ipx_if.h,v 1.7 1997/02/22 09:41:53 peter Exp $
|
||||
* $Id: ipx_if.h,v 1.8 1997/05/10 09:58:51 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPX_IF_H_
|
||||
@ -94,4 +94,4 @@ extern struct ipx_ifaddr *ipx_ifaddr;
|
||||
struct ipx_ifaddr *ipx_iaonnetof __P((struct ipx_addr *dst));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_IPX_IF_H_ */
|
||||
#endif /* !_NETIPX_IPX_IF_H_ */
|
||||
|
@ -33,48 +33,40 @@
|
||||
*
|
||||
* @(#)ipx_input.c
|
||||
*
|
||||
* $Id: ipx_input.c,v 1.12 1997/02/22 09:41:54 peter Exp $
|
||||
* $Id: ipx_input.c,v 1.13 1997/05/10 09:58:52 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/raw_cb.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/spx.h>
|
||||
#include <netipx/ipx_if.h>
|
||||
#include <netipx/ipx_pcb.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
#include <netipx/ipx_error.h>
|
||||
|
||||
int ipxcksum = 0;
|
||||
SYSCTL_INT(_net_ipx_ipx, OID_AUTO, checksum, CTLFLAG_RW,
|
||||
&ipxcksum, 0, "");
|
||||
|
||||
int ipxprintfs = 0; /* printing forwarding information */
|
||||
static int ipxprintfs = 0; /* printing forwarding information */
|
||||
SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxprintfs, CTLFLAG_RW,
|
||||
&ipxprintfs, 0, "");
|
||||
|
||||
int ipxforwarding = 0;
|
||||
static int ipxforwarding = 0;
|
||||
SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxforwarding, CTLFLAG_RW,
|
||||
&ipxforwarding, 0, "");
|
||||
|
||||
int ipxnetbios = 0;
|
||||
static int ipxnetbios = 0;
|
||||
SYSCTL_INT(_net_ipx, OID_AUTO, ipxnetbios, CTLFLAG_RW,
|
||||
&ipxnetbios, 0, "");
|
||||
|
||||
@ -290,21 +282,11 @@ ipxintr()
|
||||
case IPXPROTO_SPX:
|
||||
spx_input(m, ipxp);
|
||||
goto next;
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
case IPXPROTO_ERROR:
|
||||
ipx_err_input(m);
|
||||
goto next;
|
||||
#endif
|
||||
}
|
||||
ipx_input(m, ipxp);
|
||||
} else {
|
||||
#ifdef IPXERRORMSGS
|
||||
ipx_error(m, IPX_ERR_NOSOCK, 0);
|
||||
#else
|
||||
} else
|
||||
goto bad;
|
||||
#endif
|
||||
}
|
||||
|
||||
goto next;
|
||||
|
||||
bad:
|
||||
@ -312,16 +294,6 @@ ipxintr()
|
||||
goto next;
|
||||
}
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
u_char ipxctlerrmap[PRC_NCMDS] = {
|
||||
ECONNABORTED, ECONNABORTED, 0, 0,
|
||||
0, 0, EHOSTDOWN, EHOSTUNREACH,
|
||||
ENETUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED,
|
||||
EMSGSIZE, 0, 0, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
void
|
||||
ipx_ctlinput(cmd, arg_as_sa, dummy)
|
||||
int cmd;
|
||||
@ -330,20 +302,9 @@ ipx_ctlinput(cmd, arg_as_sa, dummy)
|
||||
{
|
||||
caddr_t arg = (/* XXX */ caddr_t)arg_as_sa;
|
||||
struct ipx_addr *ipx;
|
||||
#ifdef IPXERRORMSGS
|
||||
struct ipxpcb *ipxp;
|
||||
struct ipx_errp *errp;
|
||||
int type;
|
||||
#endif
|
||||
|
||||
if (cmd < 0 || cmd > PRC_NCMDS)
|
||||
return;
|
||||
#ifdef IPXERRORMSGS
|
||||
if (ipxctlerrmap[cmd] == 0)
|
||||
return; /* XXX */
|
||||
type = IPX_ERR_UNREACH_HOST;
|
||||
errp = (struct ipx_errp *)arg;
|
||||
#endif
|
||||
switch (cmd) {
|
||||
struct sockaddr_ipx *sipx;
|
||||
|
||||
@ -357,43 +318,15 @@ ipx_ctlinput(cmd, arg_as_sa, dummy)
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef IPXERRORMSGS
|
||||
ipx = &errp->ipx_err_ipx.ipx_dna;
|
||||
type = errp->ipx_err_num;
|
||||
type = ntohs((u_short)type);
|
||||
#endif
|
||||
printf("ipx_ctlinput: cmd %d.\n", cmd);
|
||||
break;
|
||||
}
|
||||
#ifdef IPXERRORMSGS
|
||||
switch (type) {
|
||||
|
||||
case IPX_ERR_UNREACH_HOST:
|
||||
ipx_pcbnotify(ipx, (int)ipxctlerrmap[cmd], ipx_abort, (long)0);
|
||||
break;
|
||||
|
||||
case IPX_ERR_NOSOCK:
|
||||
ipxp = ipx_pcblookup(ipx, errp->ipx_err_ipx.ipx_sna.x_port,
|
||||
IPX_WILDCARD);
|
||||
if(ipxp && ! ipx_nullhost(ipxp->ipxp_faddr))
|
||||
ipx_drop(ipxp, (int)ipxctlerrmap[cmd]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
/*
|
||||
* Forward a packet. If some error occurs return the sender
|
||||
* an error packet. Note we can't always generate a meaningful
|
||||
* error message because the IPX errors don't have a large enough repetoire
|
||||
* of codes and types.
|
||||
*/
|
||||
#else
|
||||
/*
|
||||
* Forward a packet. If some error occurs drop the packet. IPX don't
|
||||
* have a way to return errors to the sender.
|
||||
*/
|
||||
#endif
|
||||
|
||||
struct route ipx_droute;
|
||||
struct route ipx_sroute;
|
||||
@ -404,9 +337,6 @@ struct mbuf *m;
|
||||
{
|
||||
register struct ipx *ipx = mtod(m, struct ipx *);
|
||||
register int error;
|
||||
#ifdef IPXERRORMSGS
|
||||
int type, code;
|
||||
#endif
|
||||
struct mbuf *mcopy = NULL;
|
||||
int agedelta = 1;
|
||||
int flags = IPX_FORWARDING;
|
||||
@ -416,43 +346,20 @@ struct mbuf *m;
|
||||
if (ipxforwarding == 0) {
|
||||
/* can't tell difference between net and host */
|
||||
ipxstat.ipxs_cantforward++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNREACH_HOST, code = 0;
|
||||
goto senderror;
|
||||
#else
|
||||
m_freem(m);
|
||||
goto cleanup;
|
||||
#endif
|
||||
}
|
||||
ipx->ipx_tc++;
|
||||
if (ipx->ipx_tc > IPX_MAXHOPS) {
|
||||
ipxstat.ipxs_cantforward++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_TOO_OLD, code = 0;
|
||||
goto senderror;
|
||||
#else
|
||||
m_freem(m);
|
||||
goto cleanup;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
/*
|
||||
* Save at most 42 bytes of the packet in case
|
||||
* we need to generate an IPX error message to the src.
|
||||
*/
|
||||
mcopy = m_copy(m, 0, imin((int)ntohs(ipx->ipx_len), 42));
|
||||
#endif
|
||||
|
||||
if ((ok_there = ipx_do_route(&ipx->ipx_dna,&ipx_droute)) == 0) {
|
||||
ipxstat.ipxs_noroute++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNREACH_HOST, code = 0;
|
||||
goto senderror;
|
||||
#else
|
||||
m_freem(m);
|
||||
goto cleanup;
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* Here we think about forwarding broadcast packets,
|
||||
@ -482,13 +389,8 @@ struct mbuf *m;
|
||||
flags |= IPX_ALLOWBROADCAST;
|
||||
} else {
|
||||
ipxstat.ipxs_noroute++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNREACH_HOST, code = 0;
|
||||
goto senderror;
|
||||
#else
|
||||
m_freem(m);
|
||||
goto cleanup;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* XXX
|
||||
@ -531,9 +433,6 @@ struct mbuf *m;
|
||||
}
|
||||
} else if (mcopy != NULL) {
|
||||
ipx = mtod(mcopy, struct ipx *);
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNSPEC_T, code = 0;
|
||||
#endif
|
||||
switch (error) {
|
||||
|
||||
case ENETUNREACH:
|
||||
@ -542,33 +441,18 @@ struct mbuf *m;
|
||||
case ENETDOWN:
|
||||
case EPERM:
|
||||
ipxstat.ipxs_noroute++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNREACH_HOST;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EMSGSIZE:
|
||||
ipxstat.ipxs_mtutoosmall++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_TOO_BIG;
|
||||
code = 576; /* too hard to figure out mtu here */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ENOBUFS:
|
||||
ipxstat.ipxs_odropped++;
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNSPEC_T;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
mcopy = NULL;
|
||||
#ifdef IPXERRORMSGS
|
||||
senderror:
|
||||
ipx_error(m, type, code);
|
||||
#else
|
||||
m_freem(m);
|
||||
#endif
|
||||
}
|
||||
cleanup:
|
||||
if (ok_there)
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx_ip.c
|
||||
*
|
||||
* $Id: ipx_ip.c,v 1.14 1997/05/01 06:21:28 jhay Exp $
|
||||
* $Id: ipx_ip.c,v 1.15 1997/05/10 09:58:52 jhay Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -42,15 +42,11 @@
|
||||
|
||||
#ifdef IPXIP
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sockio.h>
|
||||
|
||||
#include <net/if.h>
|
||||
@ -63,8 +59,6 @@
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <machine/mtpr.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_if.h>
|
||||
#include <netipx/ipx_ip.h>
|
||||
@ -384,12 +378,11 @@ ipxip_route(so, m, p)
|
||||
ifr_ipxip.ifr_dstaddr = *(struct sockaddr *)ipx_dst;
|
||||
ipx_control(so, (int)SIOCSIFDSTADDR, (caddr_t)&ifr_ipxip,
|
||||
(struct ifnet *)ifn, p);
|
||||
/* use any our address */
|
||||
#if XXX_Hmmmm
|
||||
if (ia != NULL)
|
||||
satoipx_addr(ifr_ipxip.ifr_addr).x_host =
|
||||
|
||||
/* use any of our addresses */
|
||||
satoipx_addr(ifr_ipxip.ifr_addr).x_host =
|
||||
ipx_ifaddr->ia_addr.sipx_addr.x_host;
|
||||
#endif
|
||||
|
||||
return (ipx_control(so, (int)SIOCSIFADDR, (caddr_t)&ifr_ipxip,
|
||||
(struct ifnet *)ifn, p));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipxip.h
|
||||
*
|
||||
* $Id: ipx_ip.h,v 1.9 1997/05/01 06:21:28 jhay Exp $
|
||||
* $Id: ipx_ip.h,v 1.10 1997/05/10 09:58:53 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPXIP_H_
|
||||
@ -57,4 +57,4 @@ int ipxip_route __P((struct socket *so, struct mbuf *m, struct proc *p));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_IPXIP_H_ */
|
||||
#endif /* !_NETIPX_IPXIP_H_ */
|
||||
|
@ -33,17 +33,13 @@
|
||||
*
|
||||
* @(#)ipx_outputfl.c
|
||||
*
|
||||
* $Id: ipx_outputfl.c,v 1.6 1997/02/22 09:41:55 peter Exp $
|
||||
* $Id: ipx_outputfl.c,v 1.7 1997/05/10 09:58:53 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
@ -33,16 +33,13 @@
|
||||
*
|
||||
* @(#)ipx_pcb.c
|
||||
*
|
||||
* $Id: ipx_pcb.c,v 1.8 1997/05/01 06:21:29 jhay Exp $
|
||||
* $Id: ipx_pcb.c,v 1.9 1997/05/10 09:58:54 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx_pcb.h
|
||||
*
|
||||
* $Id: ipx_pcb.h,v 1.9 1997/05/01 06:21:29 jhay Exp $
|
||||
* $Id: ipx_pcb.h,v 1.10 1997/05/10 09:58:54 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPX_PCB_H_
|
||||
@ -97,4 +97,4 @@ void ipx_setpeeraddr __P((struct ipxpcb *ipxp, struct mbuf *nam));
|
||||
void ipx_setsockaddr __P((struct ipxpcb *ipxp, struct mbuf *nam));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_IPX_PCB_H_ */
|
||||
#endif /* !_NETIPX_IPX_PCB_H_ */
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx_proto.c
|
||||
*
|
||||
* $Id: ipx_proto.c,v 1.9 1997/05/01 12:24:20 jhay Exp $
|
||||
* $Id: ipx_proto.c,v 1.10 1997/05/10 09:58:54 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,12 +41,9 @@
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <net/radix.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
@ -59,7 +56,7 @@ static struct pr_usrreqs nousrreqs;
|
||||
* IPX protocol family: IPX, ERR, PXP, SPX, ROUTE.
|
||||
*/
|
||||
|
||||
struct protosw ipxsw[] = {
|
||||
static struct protosw ipxsw[] = {
|
||||
{ 0, &ipxdomain, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0,
|
||||
@ -90,14 +87,6 @@ struct protosw ipxsw[] = {
|
||||
0, 0, 0, 0,
|
||||
&ripx_usrreqs
|
||||
},
|
||||
#ifdef IPXERRORMSGS
|
||||
{ SOCK_RAW, &ipxdomain, IPXPROTO_ERROR, PR_ATOMIC|PR_ADDR,
|
||||
0, 0, 0, ipx_ctloutput,
|
||||
0,
|
||||
0, 0, 0, 0,
|
||||
&ripx_usrreqs
|
||||
},
|
||||
#endif
|
||||
#ifdef IPTUNNEL
|
||||
#if 0
|
||||
{ SOCK_RAW, &ipxdomain, IPPROTO_IPX, PR_ATOMIC|PR_ADDR,
|
||||
@ -121,7 +110,3 @@ SYSCTL_NODE(_net, PF_IPX, ipx, CTLFLAG_RW, 0,
|
||||
|
||||
SYSCTL_NODE(_net_ipx, IPXPROTO_RAW, ipx, CTLFLAG_RW, 0, "IPX");
|
||||
SYSCTL_NODE(_net_ipx, IPXPROTO_SPX, spx, CTLFLAG_RW, 0, "SPX");
|
||||
#ifdef IPXERRORMSGS
|
||||
SYSCTL_NODE(_net_ipx, IPXPROTO_ERROR, error, CTLFLAG_RW, 0,
|
||||
"Error Protocol");
|
||||
#endif
|
||||
|
@ -33,38 +33,10 @@
|
||||
*
|
||||
* @(#)ipx_tun.c
|
||||
*
|
||||
* $Id: ipx_tun.c,v 1.6 1997/02/22 09:41:57 peter Exp $
|
||||
* $Id: ipx_tun.c,v 1.7 1997/03/24 11:33:34 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Software interface driver for encapsulating IP in IPX.
|
||||
* XXX not implemented.
|
||||
*/
|
||||
|
||||
#ifdef IPTUNNEL
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/in_var.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip_var.h>
|
||||
|
||||
#include <machine/mtpr.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_if.h>
|
||||
|
||||
#endif
|
||||
|
@ -33,21 +33,17 @@
|
||||
*
|
||||
* @(#)ipx_usrreq.c
|
||||
*
|
||||
* $Id: ipx_usrreq.c,v 1.13 1997/05/01 06:21:30 jhay Exp $
|
||||
* $Id: ipx_usrreq.c,v 1.14 1997/05/10 09:58:55 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <net/if.h>
|
||||
@ -59,7 +55,6 @@
|
||||
#include <netipx/ipx_pcb.h>
|
||||
#include <netipx/ipx_if.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
#include <netipx/ipx_error.h>
|
||||
#include <netipx/ipx_ip.h>
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)ipx_var.h
|
||||
*
|
||||
* $Id: ipx_var.h,v 1.5 1997/02/22 09:41:58 peter Exp $
|
||||
* $Id: ipx_var.h,v 1.6 1997/05/10 09:58:55 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_IPX_VAR_H_
|
||||
@ -57,6 +57,7 @@ struct ipxstat {
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
extern int ipxcksum;
|
||||
extern long ipx_pexseq;
|
||||
extern struct ipxstat ipxstat;
|
||||
@ -71,6 +72,13 @@ extern union ipx_host ipx_zerohost;
|
||||
extern union ipx_net ipx_broadnet;
|
||||
extern union ipx_host ipx_broadhost;
|
||||
|
||||
struct ifnet;
|
||||
struct ipx_addr;
|
||||
struct mbuf;
|
||||
struct route;
|
||||
struct sockaddr;
|
||||
struct socket;
|
||||
|
||||
void ipx_abort __P((struct ipxpcb *ipxp));
|
||||
u_short ipx_cksum __P((struct mbuf *m, int len));
|
||||
int ipx_control __P((struct socket *so, int cmd, caddr_t data,
|
||||
@ -83,11 +91,12 @@ void ipx_init __P((void));
|
||||
void ipx_input __P((struct mbuf *m, struct ipxpcb *ipxp));
|
||||
void ipxintr __P((void));
|
||||
int ipx_outputfl __P((struct mbuf *m0, struct route *ro, int flags));
|
||||
int ipx_output_type20(struct mbuf *);
|
||||
int ipx_output_type20 __P((struct mbuf *));
|
||||
int ipx_peeraddr __P((struct socket *so, struct mbuf *nam));
|
||||
void ipx_printhost __P((struct ipx_addr *addr));
|
||||
int ipx_sockaddr __P((struct socket *so, struct mbuf *nam));
|
||||
void ipx_watch_output __P((struct mbuf *m, struct ifnet *ifp));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_IPX_VAR_H_ */
|
||||
#endif /* !_NETIPX_IPX_VAR_H_ */
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)spx.h
|
||||
*
|
||||
* $Id: spx.h,v 1.11 1997/05/01 06:21:30 jhay Exp $
|
||||
* $Id: spx.h,v 1.12 1997/05/10 09:58:56 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_SPX_H_
|
||||
@ -168,6 +168,7 @@ struct spxpcb {
|
||||
#define sotospxpcb(so) (ipxtospxpcb(sotoipxpcb(so)))
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
extern struct pr_usrreqs spx_usrreqs;
|
||||
extern struct pr_usrreqs spx_usrreq_sps;
|
||||
|
||||
@ -181,4 +182,4 @@ void spx_slowtimo __P((void));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_SPX_H_ */
|
||||
#endif /* !_NETIPX_SPX_H_ */
|
||||
|
@ -33,32 +33,20 @@
|
||||
*
|
||||
* @(#)spx_debug.c
|
||||
*
|
||||
* $Id: spx_debug.c,v 1.8 1997/02/22 09:41:58 peter Exp $
|
||||
* $Id: spx_debug.c,v 1.9 1997/05/10 09:58:56 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.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_systm.h>
|
||||
#include <netinet/tcp_fsm.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_error.h>
|
||||
#include <netipx/ipx_pcb.h>
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
#include <netipx/spx.h>
|
||||
#define SPXTIMERS
|
||||
#include <netipx/spx_timer.h>
|
||||
#include <netipx/spx_var.h>
|
||||
#define SANAMES
|
||||
#include <netipx/spx_debug.h>
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)spx_debug.h
|
||||
*
|
||||
* $Id: spx_debug.h,v 1.8 1997/02/22 09:41:59 peter Exp $
|
||||
* $Id: spx_debug.h,v 1.9 1997/05/10 09:58:57 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_SPX_DEBUG_H_
|
||||
@ -76,4 +76,4 @@ void spx_trace __P((int act, int ostate, struct spxpcb *sp, struct spx *si,
|
||||
int req));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* _NETIPX_SPX_DEBUG_H_ */
|
||||
#endif /* !_NETIPX_SPX_DEBUG_H_ */
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)spx_timer.h
|
||||
*
|
||||
* $Id: spx_timer.h,v 1.7 1997/02/22 09:41:59 peter Exp $
|
||||
* $Id: spx_timer.h,v 1.8 1997/05/10 09:58:57 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_SPX_TIMER_H_
|
||||
@ -121,4 +121,4 @@ char *spxtimers[] =
|
||||
(tv) = (tvmax); \
|
||||
}
|
||||
|
||||
#endif /* _NETIPX_SPX_TIMER_H_ */
|
||||
#endif /* !_NETIPX_SPX_TIMER_H_ */
|
||||
|
@ -33,28 +33,23 @@
|
||||
*
|
||||
* @(#)spx_usrreq.h
|
||||
*
|
||||
* $Id: spx_usrreq.c,v 1.12 1997/05/01 06:21:31 jhay Exp $
|
||||
* $Id: spx_usrreq.c,v 1.13 1997/05/10 09:58:58 jhay Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/socketvar.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
#include <netinet/tcp_fsm.h>
|
||||
|
||||
#include <netipx/ipx.h>
|
||||
#include <netipx/ipx_pcb.h>
|
||||
#include <netipx/ipx_var.h>
|
||||
#include <netipx/ipx_error.h>
|
||||
#include <netipx/spx.h>
|
||||
#include <netipx/spx_timer.h>
|
||||
#include <netipx/spx_var.h>
|
||||
@ -324,11 +319,7 @@ spx_input(m, ipxp)
|
||||
si->si_seq = ntohs(si->si_seq);
|
||||
si->si_ack = ntohs(si->si_ack);
|
||||
si->si_alo = ntohs(si->si_alo);
|
||||
#ifdef IPXERRORMSGS
|
||||
ipx_error(dtom(si), IPX_ERR_NOSOCK, 0);
|
||||
#else
|
||||
m_freem(dtom(si));
|
||||
#endif
|
||||
if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs)
|
||||
spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
|
||||
return;
|
||||
@ -506,26 +497,17 @@ register struct spx *si;
|
||||
spxstat.spxs_rcvpackafterwin++;
|
||||
if (si->si_cc & SPX_OB) {
|
||||
if (SSEQ_GT(si->si_seq, cb->s_alo + 60)) {
|
||||
#ifdef IPXERRORMSGS
|
||||
ipx_error(dtom(si), IPX_ERR_FULLUP, 0);
|
||||
#else
|
||||
m_freem(dtom(si));
|
||||
#endif
|
||||
return (0);
|
||||
} /* else queue this packet; */
|
||||
} else {
|
||||
/*register struct socket *so = cb->s_ipxpcb->ipxp_socket;
|
||||
if (so->so_state && SS_NOFDREF) {
|
||||
ipx_error(dtom(si), IPX_ERR_NOSOCK, 0);
|
||||
spx_close(cb);
|
||||
} else
|
||||
would crash system*/
|
||||
spx_istat.notyet++;
|
||||
#ifdef IPXERRORMSGS
|
||||
ipx_error(dtom(si), IPX_ERR_FULLUP, 0);
|
||||
#else
|
||||
m_freem(dtom(si));
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -655,19 +637,10 @@ spx_ctlinput(cmd, arg_as_sa, dummy)
|
||||
caddr_t arg = (/* XXX */ caddr_t)arg_as_sa;
|
||||
struct ipx_addr *na;
|
||||
struct sockaddr_ipx *sipx;
|
||||
#ifdef IPXERRORMSGS
|
||||
struct ipxpcb *ipxp;
|
||||
struct ipx_errp *errp = (struct ipx_errp *)arg;
|
||||
int type;
|
||||
#endif
|
||||
|
||||
if (cmd < 0 || cmd > PRC_NCMDS)
|
||||
return;
|
||||
|
||||
#ifdef IPXERRORMSGS
|
||||
type = IPX_ERR_UNREACH_HOST;
|
||||
#endif
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case PRC_ROUTEDEAD:
|
||||
@ -683,39 +656,8 @@ spx_ctlinput(cmd, arg_as_sa, dummy)
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef IPXERRORMSGS
|
||||
errp = (struct ipx_errp *)arg;
|
||||
na = &errp->ipx_err_ipx.ipx_dna;
|
||||
type = errp->ipx_err_num;
|
||||
type = ntohs((u_short)type);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#ifdef IPXERRORMSGS
|
||||
switch (type) {
|
||||
|
||||
case IPX_ERR_UNREACH_HOST:
|
||||
ipx_pcbnotify(na, (int)ipxctlerrmap[cmd], spx_abort, (long)0);
|
||||
break;
|
||||
|
||||
case IPX_ERR_TOO_BIG:
|
||||
case IPX_ERR_NOSOCK:
|
||||
ipxp = ipx_pcblookup(na, errp->ipx_err_ipx.ipx_sna.x_port,
|
||||
IPX_WILDCARD);
|
||||
if (ipxp != NULL) {
|
||||
if(ipxp->ipxp_pcb != NULL)
|
||||
spx_drop((struct spxpcb *)ipxp->ipxp_pcb,
|
||||
(int)ipxctlerrmap[cmd]);
|
||||
else
|
||||
ipx_drop(ipxp, (int)ipxctlerrmap[cmd]);
|
||||
}
|
||||
break;
|
||||
|
||||
case IPX_ERR_FULLUP:
|
||||
ipx_pcbnotify(na, 0, spx_quench, (long)0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*
|
||||
* When a source quench is received, close congestion window
|
||||
|
@ -33,7 +33,7 @@
|
||||
*
|
||||
* @(#)spx_var.h
|
||||
*
|
||||
* $Id: spx_var.h,v 1.6 1997/02/22 09:42:00 peter Exp $
|
||||
* $Id: spx_var.h,v 1.7 1997/05/10 09:58:58 jhay Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETIPX_SPX_VAR_H_
|
||||
@ -118,4 +118,4 @@ struct spx_istat {
|
||||
#define SSEQ_GT(a,b) (((short)((a)-(b))) > 0)
|
||||
#define SSEQ_GEQ(a,b) (((short)((a)-(b))) >= 0)
|
||||
|
||||
#endif /* _NETIPX_SPX_VAR_H_ */
|
||||
#endif /* !_NETIPX_SPX_VAR_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user