diff options
author | chuck <chuck@cvs.openbsd.org> | 1996-07-03 17:24:31 +0000 |
---|---|---|
committer | chuck <chuck@cvs.openbsd.org> | 1996-07-03 17:24:31 +0000 |
commit | 73e06b23207009eef589976eeefda52b10cd5f05 (patch) | |
tree | 3a40ebce4d966231faf9043f994e0ab413ee0b59 /sys | |
parent | 5965b4a0810d35646281676f2d88192803f36981 (diff) |
ported to FreeBSD 2.2-960612-SNAP.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netnatm/natm.c | 25 | ||||
-rw-r--r-- | sys/netnatm/natm.h | 21 | ||||
-rw-r--r-- | sys/netnatm/natm_pcb.c | 4 | ||||
-rw-r--r-- | sys/netnatm/natm_proto.c | 19 |
4 files changed, 61 insertions, 8 deletions
diff --git a/sys/netnatm/natm.c b/sys/netnatm/natm.c index 51da47eb433..289aeab3017 100644 --- a/sys/netnatm/natm.c +++ b/sys/netnatm/natm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: natm.c,v 1.1 1996/06/30 21:40:12 chuck Exp $ */ +/* $OpenBSD: natm.c,v 1.2 1996/07/03 17:24:29 chuck Exp $ */ /* * @@ -38,6 +38,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/kernel.h> #include <sys/domain.h> #include <sys/ioctl.h> #include <sys/proc.h> @@ -48,6 +49,7 @@ #include <net/if.h> #include <net/if_atm.h> +#include <net/netisr.h> #include <net/radix.h> #include <net/route.h> @@ -65,12 +67,18 @@ u_long natm0_recvspace = 16*1024; * user requests */ +#if defined(__NetBSD__) || defined(__OpenBSD__) int natm_usrreq(so, req, m, nam, control, p) +#elif defined(__FreeBSD__) +int natm_usrreq(so, req, m, nam, control) +#endif struct socket *so; int req; struct mbuf *m, *nam, *control; +#if defined(__NetBSD__) || defined(__OpenBSD__) struct proc *p; +#endif { int error = 0, s, s2; @@ -82,7 +90,7 @@ struct proc *p; struct ifnet *ifp; int proto = so->so_proto->pr_protocol; - s = splsoftnet(); + s = SPLSOFTNET(); npcb = (struct natmpcb *) so->so_pcb; @@ -109,7 +117,7 @@ struct proc *p; break; } - so->so_pcb = npcb = npcb_alloc(M_WAITOK); + so->so_pcb = (caddr_t) (npcb = npcb_alloc(M_WAITOK)); npcb->npcb_socket = so; break; @@ -259,9 +267,15 @@ struct proc *p; case PRU_PEERADDR: /* fetch peer's address */ snatm = mtod(nam, struct sockaddr_natm *); + bzero(snatm, sizeof(*snatm)); nam->m_len = snatm->snatm_len = sizeof(*snatm); snatm->snatm_family = AF_NATM; +#if defined(__NetBSD__) || defined(__OpenBSD__) bcopy(npcb->npcb_ifp->if_xname, snatm->snatm_if, sizeof(snatm->snatm_if)); +#elif defined(__FreeBSD__) + sprintf(snatm->snatm_if, "%s%d", npcb->npcb_ifp->if_name, + npcb->npcb_ifp->if_unit); +#endif snatm->snatm_vci = npcb->npcb_vci; snatm->snatm_vpi = npcb->npcb_vpi; break; @@ -396,6 +410,11 @@ m->m_pkthdr.rcvif = NULL; /* null it out to be safe */ goto next; } +#if defined(__FreeBSD__) +NETISR_SET(NETISR_NATM, natmintr); +#endif + + /* * natm0_sysctl: not used, but here in case we want to add something * later... diff --git a/sys/netnatm/natm.h b/sys/netnatm/natm.h index 143d1623cc4..032c59d35fa 100644 --- a/sys/netnatm/natm.h +++ b/sys/netnatm/natm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: natm.h,v 1.1 1996/06/30 21:40:14 chuck Exp $ */ +/* $OpenBSD: natm.h,v 1.2 1996/07/03 17:24:30 chuck Exp $ */ /* * @@ -57,6 +57,20 @@ struct sockaddr_natm { }; +#if defined(__FreeBSD__) && defined(KERNEL) + +#ifndef _KERNEL +#define _KERNEL +#endif + +#define SPLSOFTNET() splnet() + +#elif defined(__NetBSD__) || defined(__OpenBSD__) + +#define SPLSOFTNET() splsoftnet() + +#endif + #ifdef _KERNEL /* @@ -124,8 +138,13 @@ void npcb_free __P((struct natmpcb *, int)); struct natmpcb *npcb_add __P((struct natmpcb *, struct ifnet *, int, int)); /* natm.c */ +#if defined(__NetBSD__) || defined(__OpenBSD__) int natm_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *)); +#elif defined(__FreeBSD__) +int natm_usrreq __P((struct socket *, int, struct mbuf *, + struct mbuf *, struct mbuf *)); +#endif int natm0_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); int natm5_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); void natmintr __P((void)); diff --git a/sys/netnatm/natm_pcb.c b/sys/netnatm/natm_pcb.c index 3be08a0c920..68c5ebc6776 100644 --- a/sys/netnatm/natm_pcb.c +++ b/sys/netnatm/natm_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: natm_pcb.c,v 1.1 1996/06/30 21:40:13 chuck Exp $ */ +/* $OpenBSD: natm_pcb.c,v 1.2 1996/07/03 17:24:29 chuck Exp $ */ /* * @@ -38,6 +38,8 @@ */ #include <sys/param.h> +#include <sys/systm.h> +#include <sys/queue.h> #include <sys/socket.h> #include <sys/protosw.h> #include <sys/domain.h> diff --git a/sys/netnatm/natm_proto.c b/sys/netnatm/natm_proto.c index 33eaf6b0f97..dbb3fe9eaad 100644 --- a/sys/netnatm/natm_proto.c +++ b/sys/netnatm/natm_proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: natm_proto.c,v 1.1 1996/06/30 21:40:14 chuck Exp $ */ +/* $OpenBSD: natm_proto.c,v 1.2 1996/07/03 17:24:29 chuck Exp $ */ /* * @@ -37,6 +37,9 @@ */ #include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/queue.h> #include <sys/socket.h> #include <sys/protosw.h> #include <sys/domain.h> @@ -58,12 +61,18 @@ struct protosw natmsw[] = { { SOCK_STREAM, &natmdomain, PROTO_NATMAAL5, PR_CONNREQUIRED, 0, 0, 0, 0, natm_usrreq, - 0, 0, 0, 0, natm5_sysctl + 0, 0, 0, 0, +#if defined(__NetBSD__) || defined(__OpenBSD__) + natm5_sysctl +#endif }, { SOCK_STREAM, &natmdomain, PROTO_NATMAAL0, PR_CONNREQUIRED, 0, 0, 0, 0, natm_usrreq, - 0, 0, 0, 0, natm0_sysctl + 0, 0, 0, 0, +#if defined(__NetBSD__) || defined(__OpenBSD__) + natm0_sysctl +#endif }, }; @@ -90,3 +99,7 @@ void natm_init() bzero(&natmintrq, sizeof(natmintrq)); natmintrq.ifq_maxlen = natmqmaxlen; } + +#if defined(__FreeBSD__) +DOMAIN_SET(natm); +#endif |