diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-01-11 01:26:23 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2000-01-11 01:26:23 +0000 |
commit | e2ebbd5b47142b0984167448df5e603b00d324df (patch) | |
tree | 9ea5438233dfcee8937b9168b0ff274568cfcaa5 /sys | |
parent | 8e69f01041c984d91992efac1a688e84049d5620 (diff) |
Remove references to ipx_error. IPX does not generate any errors.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netipx/ipx.c | 62 | ||||
-rw-r--r-- | sys/netipx/ipx.h | 3 | ||||
-rw-r--r-- | sys/netipx/ipx_error.c | 386 | ||||
-rw-r--r-- | sys/netipx/ipx_error.h | 105 | ||||
-rw-r--r-- | sys/netipx/ipx_input.c | 112 | ||||
-rw-r--r-- | sys/netipx/ipx_usrreq.c | 3 | ||||
-rw-r--r-- | sys/netipx/spx_debug.c | 3 | ||||
-rw-r--r-- | sys/netipx/spx_usrreq.c | 44 |
8 files changed, 94 insertions, 624 deletions
diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c index efa1fac5f5a..2f125d29da0 100644 --- a/sys/netipx/ipx.c +++ b/sys/netipx/ipx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx.c,v 1.3 1996/10/26 09:34:48 mickey Exp $ */ +/* $OpenBSD: ipx.c,v 1.4 2000/01/11 01:26:20 fgsch Exp $ */ /*- * @@ -347,6 +347,66 @@ 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.ipx_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.ipx_net.c_net; + snprintf(cnet, sizeof(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.ipx_host.c_host; + snprintf(chost, sizeof(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 = ""; + snprintf(cport, sizeof(cport), "%x", port); + } else + snprintf(cport, sizeof(cport), ".%x", port); + } else + *cport = 0; + + printf("%s.%s%s", net, host, cport); +} + #ifdef IPXDEBUG struct ipx_addr ipx_addr(str) diff --git a/sys/netipx/ipx.h b/sys/netipx/ipx.h index 233e6a24654..8a11c075b9d 100644 --- a/sys/netipx/ipx.h +++ b/sys/netipx/ipx.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx.h,v 1.5 1996/12/23 08:47:03 mickey Exp $ */ +/* $OpenBSD: ipx.h,v 1.6 2000/01/11 01:26:20 fgsch Exp $ */ /*- * @@ -230,6 +230,7 @@ int ipx_usrreq __P((struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control)); void ipx_watch_output __P((struct mbuf *m, struct ifnet *ifp)); int ipx_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); +void ipx_printhost __P((struct ipx_addr *addr)); #ifdef IPXDEBUG struct ipx_addr ipx_addr __P((const char *)); diff --git a/sys/netipx/ipx_error.c b/sys/netipx/ipx_error.c deleted file mode 100644 index e0617a21c5f..00000000000 --- a/sys/netipx/ipx_error.c +++ /dev/null @@ -1,386 +0,0 @@ -/* $OpenBSD: ipx_error.c,v 1.2 1996/10/26 09:34:49 mickey Exp $ */ - -/*- - * - * Copyright (c) 1996 Michael Shalayeff - * 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 - * - * from FreeBSD Id: ipx_error.c,v 1.4 1995/12/16 02:14:32 bde 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> - -/* - * 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.ipx_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.ipx_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); - 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.ipx_host = oip->ipx_sna.ipx_host; - nip->ipx_sna.ipx_host = oip->ipx_dna.ipx_host; - if (ipxcksum) { - nip->ipx_sum = 0; - nip->ipx_sum = ipx_cksum(m, sizeof(*ep)); - } else - nip->ipx_sum = 0xffff; - (void) ipx_outputfl(m, (struct route *)0, 0); - -freeit: - m_freem(om); -} - -void -ipx_printhost(addr) - register ipx_addr_t *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.ipx_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.ipx_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.ipx_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); -} - -/* - * 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)) == 0) { - 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; - - (void) ipx_outputfl(m, (struct route *)0, IPX_FORWARDING); - - return(0); -} diff --git a/sys/netipx/ipx_error.h b/sys/netipx/ipx_error.h deleted file mode 100644 index ae0af5f58a4..00000000000 --- a/sys/netipx/ipx_error.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $OpenBSD: ipx_error.h,v 1.2 1996/10/26 09:34:50 mickey Exp $ */ - -/*- - * - * Copyright (c) 1996 Michael Shalayeff - * 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 - * - * from FreeBSD Id: ipx_error.h,v 1.5 1995/11/24 12:25:04 bde Exp - */ - -#ifndef _NETIPX_IPX_ERROR_H_ -#define _NETIPX_IPX_ERROR_H_ - -/* - * IPX error messages - */ - -struct ipx_errp { - u_int32_t ipx_err_num; /* Error Number */ - u_int32_t ipx_err_param; /* Error Parameter */ - struct ipx ipx_err_ipx; /* Initial segment of offending pkt */ - u_int8_t ipx_err_lev2[12];/* this is 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 IPX 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 */ -}; - -#ifdef _KERNEL -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)); -void ipx_printhost __P((ipx_addr_t *addr)); -#endif - -#endif /* !_NETIPX_IPX_ERROR_H_ */ diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index 8639feb4170..7880ec82e4c 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx_input.c,v 1.4 1996/12/23 08:47:04 mickey Exp $ */ +/* $OpenBSD: ipx_input.c,v 1.5 2000/01/11 01:26:21 fgsch Exp $ */ /*- * @@ -65,7 +65,6 @@ #include <netipx/ipx_if.h> #include <netipx/ipx_pcb.h> #include <netipx/ipx_var.h> -#include <netipx/ipx_error.h> #ifndef IPXPRINTFS #define IPXPRINTFS 1 /* printing forwarding information */ @@ -138,8 +137,7 @@ ipxintr() register struct mbuf *m; register struct ipxpcb *ipxp; register int i; - int len, s, error; - char oddpacketp; + int len, s; next: /* @@ -188,12 +186,6 @@ next: } ipx = mtod(m, struct ipx *); - len = ntohs(ipx->ipx_len); - if (oddpacketp == (len & 1)) { - len++; /* If this packet is of odd length, - preserve garbage byte for checksum */ - } - /* * Check that the amount of data in the buffers * is as at least much as the IPX header would have us expect. @@ -221,13 +213,7 @@ next: #ifdef IPXDEBUG printf("ipxintr: bad sum [%u]\n", i); #endif - ipx->ipx_sum = i; - if (ipx_hosteqnh(ipx_thishost, ipx->ipx_dna.ipx_host)) - error = IPX_ERR_BADSUM; - else - error = IPX_ERR_BADSUM_T; - ipx_error(m, error, 0); - goto next; + goto bad; } } /* @@ -275,9 +261,6 @@ next: */ ipxintr_swtch++; if (ipxp) { - if (oddpacketp) { - m_adj(m, -1); - } if ((ipxp->ipxp_flags & IPXP_ALL_PACKETS)==0) switch (ipx->ipx_pt) { @@ -288,19 +271,13 @@ next: spx_input(m, ipxp); goto next; - case IPXPROTO_ERROR: -#ifdef IPXDEBUG - printf("ipxintr: error packet\n"); -#endif - ipx_err_input(m); - goto next; } #ifdef IPXDEBUG printf("ipxintr: ipx packet\n"); #endif ipx_input(m, ipxp); } else - ipx_error(m, IPX_ERR_NOSOCK, 0); + goto bad; goto next; @@ -309,14 +286,6 @@ bad: goto next; } -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 -}; - void * ipx_ctlinput(cmd, arg_as_sa, dummy) int cmd; @@ -325,16 +294,9 @@ ipx_ctlinput(cmd, arg_as_sa, dummy) { caddr_t arg = (/* XXX */ caddr_t)arg_as_sa; struct ipx_addr *ipx; - struct ipxpcb *ipxp; - struct ipx_errp *errp; - int type; if (cmd < 0 || cmd > PRC_NCMDS) return NULL; - if (ipxctlerrmap[cmd] == 0) - return NULL; /* XXX */ - type = IPX_ERR_UNREACH_HOST; - errp = (struct ipx_errp *)arg; switch (cmd) { struct sockaddr_ipx *sipx; @@ -348,22 +310,7 @@ ipx_ctlinput(cmd, arg_as_sa, dummy) break; default: - ipx = &errp->ipx_err_ipx.ipx_dna; - type = errp->ipx_err_num; - type = ntohs((u_short)type); - break; - } - 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.ipx_port, - IPX_WILDCARD); - if(ipxp && ipxdonosocks && ! ipx_nullhost(ipxp->ipxp_faddr)) - (void) ipx_drop(ipxp, (int)ipxctlerrmap[cmd]); } return NULL; } @@ -382,7 +329,7 @@ ipx_forward(m) struct mbuf *m; { register struct ipx *ipx = mtod(m, struct ipx *); - register int error, type, code; + register int error; struct mbuf *mcopy = NULL; int agedelta = 1; int flags = IPX_FORWARDING; @@ -390,24 +337,18 @@ struct mbuf *m; int ok_back = 0; if (ipxforwarding == 0) { - /* can't tell difference between net and host */ - type = IPX_ERR_UNREACH_HOST, code = 0; - goto senderror; + m_freem(m); + goto cleanup; } ipx->ipx_tc++; if (ipx->ipx_tc > IPX_MAXHOPS) { - type = IPX_ERR_TOO_OLD, code = 0; - goto senderror; + m_freem(m); + goto cleanup; } - /* - * 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)); if ((ok_there = ipx_do_route(&ipx->ipx_dna,&ipx_droute))==0) { - type = IPX_ERR_UNREACH_HOST, code = 0; - goto senderror; + m_freem(m); + goto cleanup; } /* * Here we think about forwarding broadcast packets, @@ -435,8 +376,8 @@ struct mbuf *m; (ifp!=ipx_sroute.ro_rt->rt_ifp)) { flags |= IPX_ALLOWBROADCAST; } else { - type = IPX_ERR_UNREACH_HOST, code = 0; - goto senderror; + m_freem(m); + goto cleanup; } } /* need to adjust checksum */ @@ -457,18 +398,16 @@ struct mbuf *m; ipx->ipx_sum = 0xffff; error = ipx_outputfl(m, &ipx_droute, flags); - - if (ipxprintfs && !error) { - printf("forward: "); - ipx_printhost(&ipx->ipx_sna); - printf(" to "); - ipx_printhost(&ipx->ipx_dna); - printf(" hops %d\n", ipx->ipx_tc); - } - - if (error && mcopy != NULL) { + if (error == 0) { + if (ipxprintfs) { + printf("forward: "); + ipx_printhost(&ipx->ipx_sna); + printf(" to "); + ipx_printhost(&ipx->ipx_dna); + printf(" hops %d\n", ipx->ipx_tc); + } + } else if (mcopy != NULL) { ipx = mtod(mcopy, struct ipx *); - type = IPX_ERR_UNSPEC_T, code = 0; switch (error) { case ENETUNREACH: @@ -476,21 +415,16 @@ struct mbuf *m; case EHOSTUNREACH: case ENETDOWN: case EPERM: - type = IPX_ERR_UNREACH_HOST; break; case EMSGSIZE: - type = IPX_ERR_TOO_BIG; - code = 576; /* too hard to figure out mtu here */ break; case ENOBUFS: - type = IPX_ERR_UNSPEC_T; break; } mcopy = NULL; - senderror: - ipx_error(m, type, code); + m_freem(m); } cleanup: if (ok_there) diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c index 80a32cd59df..1e2f5116ad3 100644 --- a/sys/netipx/ipx_usrreq.c +++ b/sys/netipx/ipx_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipx_usrreq.c,v 1.5 1997/01/18 17:53:54 mickey Exp $ */ +/* $OpenBSD: ipx_usrreq.c,v 1.6 2000/01/11 01:26:21 fgsch Exp $ */ /*- * @@ -64,7 +64,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> #include <machine/stdarg.h> diff --git a/sys/netipx/spx_debug.c b/sys/netipx/spx_debug.c index cf713339c0c..a98a46f4afc 100644 --- a/sys/netipx/spx_debug.c +++ b/sys/netipx/spx_debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spx_debug.c,v 1.2 1996/10/26 09:34:56 mickey Exp $ */ +/* $OpenBSD: spx_debug.c,v 1.3 2000/01/11 01:26:21 fgsch Exp $ */ /*- * @@ -57,7 +57,6 @@ #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> diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c index 8690bd6226d..560447b5816 100644 --- a/sys/netipx/spx_usrreq.c +++ b/sys/netipx/spx_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spx_usrreq.c,v 1.6 1998/03/18 21:30:06 mickey Exp $ */ +/* $OpenBSD: spx_usrreq.c,v 1.7 2000/01/11 01:26:22 fgsch Exp $ */ /*- * @@ -57,7 +57,6 @@ #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> @@ -289,7 +288,7 @@ dropwithreset: si->si_seq = ntohs(si->si_seq); si->si_ack = ntohs(si->si_ack); si->si_alo = ntohs(si->si_alo); - ipx_error(dtom(si), IPX_ERR_NOSOCK, 0); + m_freem(dtom(si)); if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs) spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0); return; @@ -467,18 +466,18 @@ update_window: spxstat.spxs_rcvpackafterwin++; if (si->si_cc & SPX_OB) { if (SSEQ_GT(si->si_seq, cb->s_alo + 60)) { - ipx_error(dtom(si), IPX_ERR_FULLUP, 0); + m_freem(dtom(si)); 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); + m_freem(dtom(si)); (void)spx_close(cb); } else would crash system*/ spx_istat.notyet++; - ipx_error(dtom(si), IPX_ERR_FULLUP, 0); + m_freem(dtom(si)); return (0); } } @@ -615,14 +614,10 @@ spx_ctlinput(cmd, arg_as_sa, dummy) { caddr_t arg = (/* XXX */ caddr_t)arg_as_sa; struct ipx_addr *na; - struct ipx_errp *errp = (struct ipx_errp *)arg; - struct ipxpcb *ipxp; struct sockaddr_ipx *sipx; - int type; if (cmd < 0 || cmd > PRC_NCMDS) return NULL; - type = IPX_ERR_UNREACH_HOST; switch (cmd) { @@ -639,38 +634,11 @@ spx_ctlinput(cmd, arg_as_sa, dummy) break; default: - errp = (struct ipx_errp *)arg; - na = &errp->ipx_err_ipx.ipx_dna; - type = errp->ipx_err_num; - type = ntohs((u_short)type); break; } - 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.ipx_port, - IPX_WILDCARD); - if (ipxp) { - if(ipxp->ipxp_ppcb) - (void)spx_drop((struct spxpcb *)ipxp->ipxp_ppcb, - (int)ipxctlerrmap[cmd]); - else - (void)ipx_drop(ipxp, (int)ipxctlerrmap[cmd]); - } - break; - - case IPX_ERR_FULLUP: - ipx_pcbnotify(na, 0, spx_quench, (long)0); - break; - } - return NULL; } + /* * When a source quench is received, close congestion window * to one packet. We will gradually open it again as we proceed. |