diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-04 08:20:36 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-04 08:20:36 +0000 |
commit | 92cdd22ea0b6e6726ed0f81d2d9acd458ee929e6 (patch) | |
tree | e70710a7096df97500809f354b7fe982ec043c8c /sys/netns/ns_input.c | |
parent | adf1528ae6bd8dbe337c45c0a67cac4d76b1635f (diff) |
From NetBSD: 960217 merge
Diffstat (limited to 'sys/netns/ns_input.c')
-rw-r--r-- | sys/netns/ns_input.c | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/sys/netns/ns_input.c b/sys/netns/ns_input.c index 16927880871..af48cbf7df7 100644 --- a/sys/netns/ns_input.c +++ b/sys/netns/ns_input.c @@ -1,4 +1,5 @@ -/* $NetBSD: ns_input.c,v 1.8 1995/07/27 20:37:27 mycroft Exp $ */ +/* $OpenBSD: ns_input.c,v 1.2 1996/03/04 08:20:26 niklas Exp $ */ +/* $NetBSD: ns_input.c,v 1.9 1996/02/13 22:13:56 christos Exp $ */ /* * Copyright (c) 1984, 1985, 1986, 1987, 1993 @@ -52,11 +53,16 @@ #include <net/raw_cb.h> #include <netns/ns.h> -#include <netns/ns_if.h> #include <netns/ns_pcb.h> +#include <netns/ns_if.h> +#include <netns/ns_var.h> #include <netns/idp.h> #include <netns/idp_var.h> #include <netns/ns_error.h> +#include <netns/sp.h> +#include <netns/spidp.h> +#include <netns/spp_timer.h> +#include <netns/spp_var.h> /* * NS initialization. @@ -79,6 +85,7 @@ int nsqmaxlen = IFQ_MAXLEN; int idpcksum = 1; long ns_pexseq; +void ns_init() { @@ -101,6 +108,7 @@ ns_init() */ int nsintr_getpck = 0; int nsintr_swtch = 0; +void nsintr() { register struct idp *idp; @@ -137,7 +145,7 @@ next: idp = mtod(m, struct idp *); len = ntohs(idp->idp_len); - if (oddpacketp = len & 1) { + if ((oddpacketp = len & 1) != 0) { len++; /* If this packet is of odd length, preserve garbage byte for checksum */ } @@ -246,21 +254,21 @@ u_char nsctlerrmap[PRC_NCMDS] = { int idp_donosocks = 1; -idp_ctlinput(cmd, arg) +void * +idp_ctlinput(cmd, sa, arg) int cmd; - caddr_t arg; + struct sockaddr *sa; + void *arg; { struct ns_addr *ns; struct nspcb *nsp; - struct ns_errp *errp; - int idp_abort(); - extern struct nspcb *idp_drop(); + struct ns_errp *errp = NULL; int type; if (cmd < 0 || cmd > PRC_NCMDS) - return; + return NULL; if (nsctlerrmap[cmd] == 0) - return; /* XXX */ + return NULL; /* XXX */ type = NS_ERR_UNREACH_HOST; switch (cmd) { struct sockaddr_ns *sns; @@ -268,14 +276,14 @@ idp_ctlinput(cmd, arg) case PRC_IFDOWN: case PRC_HOSTDEAD: case PRC_HOSTUNREACH: - sns = (struct sockaddr_ns *)arg; + sns = arg; if (sns->sns_family != AF_NS) - return; + return NULL; ns = &sns->sns_addr; break; default: - errp = (struct ns_errp *)arg; + errp = arg; ns = &errp->ns_err_idp.idp_dna; type = errp->ns_err_num; type = ntohs((u_short)type); @@ -288,10 +296,11 @@ idp_ctlinput(cmd, arg) case NS_ERR_NOSOCK: nsp = ns_pcblookup(ns, errp->ns_err_idp.idp_sna.x_port, - NS_WILDCARD); + NS_WILDCARD); if(nsp && idp_donosocks && ! ns_nullhost(nsp->nsp_faddr)) (void) idp_drop(nsp, (int)nsctlerrmap[cmd]); } + return NULL; } int idpprintfs = 0; @@ -305,6 +314,7 @@ int idpforwarding = 1; struct route idp_droute; struct route idp_sroute; +void idp_forward(m) struct mbuf *m; { @@ -388,7 +398,7 @@ struct mbuf *m; x.l = x.s[0] + x.s[1]; if (x.l==0xffff) idp->idp_sum = 0; else idp->idp_sum = x.l; } - if ((error = ns_output(m, &idp_droute, flags)) && + if ((error = ns_output(m, &idp_droute, flags)) != 0 && (mcopy!=NULL)) { idp = mtod(mcopy, struct idp *); type = NS_ERR_UNSPEC_T, code = 0; @@ -424,6 +434,7 @@ cleanup: m_freem(mcopy); } +int idp_do_route(src, ro) struct ns_addr *src; struct route *ro; @@ -446,12 +457,14 @@ struct route *ro; return (1); } +void idp_undo_route(ro) register struct route *ro; { if (ro->ro_rt) {RTFREE(ro->ro_rt);} } +void ns_watch_output(m, ifp) struct mbuf *m; struct ifnet *ifp; |