summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchuck <chuck@openbsd.org>1996-06-26 04:21:31 +0000
committerchuck <chuck@openbsd.org>1996-06-26 04:21:31 +0000
commit2839dc7688274aa43d27c82b5de9c140f0c2b8e8 (patch)
tree15c6525cfab20b1026dd2a887e47461be2d7d43e
parentfixes/new stuff: (diff)
downloadwireguard-openbsd-2839dc7688274aa43d27c82b5de9c140f0c2b8e8.tar.xz
wireguard-openbsd-2839dc7688274aa43d27c82b5de9c140f0c2b8e8.zip
[1] add new rxso passing structure to if_atm.h
[2] modify atm_output to handle native mode atm output mbufs
-rw-r--r--sys/net/if_atm.h12
-rw-r--r--sys/net/if_atmsubr.c78
2 files changed, 56 insertions, 34 deletions
diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h
index f2a413ad5f3..7cac9f22004 100644
--- a/sys/net/if_atm.h
+++ b/sys/net/if_atm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atm.h,v 1.2 1996/06/21 21:35:18 chuck Exp $ */
+/* $OpenBSD: if_atm.h,v 1.3 1996/06/26 04:21:31 chuck Exp $ */
/*
*
@@ -63,8 +63,14 @@ struct atm_pseudohdr {
to comer */
/* pseudo ioctl */
-#define SIOCATMENA _IOWR('a', 122, struct atm_pseudohdr) /* enable */
-#define SIOCATMDIS _IOWR('a', 123, struct atm_pseudohdr) /* disable */
+
+struct atm_pseudoioctl {
+ struct atm_pseudohdr aph;
+ struct socket *asock;
+};
+
+#define SIOCATMENA _IOWR('a', 122, struct atm_pseudoioctl) /* enable */
+#define SIOCATMDIS _IOWR('a', 123, struct atm_pseudoioctl) /* disable */
/*
* XXX forget all the garbage in if_llc.h and do it the easy way
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index d0a71f570e3..c460ef14287 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atmsubr.c,v 1.2 1996/06/21 21:35:19 chuck Exp $ */
+/* $OpenBSD: if_atmsubr.c,v 1.3 1996/06/26 04:21:32 chuck Exp $ */
/*
*
@@ -15,8 +15,8 @@
* 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 Charles D. Cranor and
- * Washington University.
+ * This product includes software developed by Charles D. Cranor and
+ * Washington University.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
@@ -72,6 +72,11 @@
* "dst" = the sockaddr to send to (either IP addr, or raw VPI/VCI)
* "rt0" = the route to use
* returns: error code [0 == ok]
+ *
+ * note: special semantic: if (dst == NULL) then we assume "m" already
+ * has an atm_pseudohdr on it and just send it directly.
+ * [for native mode ATM output] if dst is null, then
+ * rt0 must also be NULL.
*/
int
@@ -119,38 +124,49 @@ atm_output(ifp, m0, dst, rt0)
/* XXX: put RTF_REJECT code here if doing ATMARP */
}
- switch (dst->sa_family) {
+
+ /*
+ * check for non-native ATM traffic (dst != NULL)
+ */
+ if (dst) {
+ switch (dst->sa_family) {
#ifdef INET
- case AF_INET:
- if (!atmresolve(rt, m, dst, &atmdst)) {
- m = NULL; /* XXX: atmresolve already free'd it */
- senderr(EHOSTUNREACH);
- /* XXX: ATMARP stuff here, watch who frees m on fail */
- }
- etype = htons(ETHERTYPE_IP);
- break;
+ case AF_INET:
+ if (!atmresolve(rt, m, dst, &atmdst)) {
+ m = NULL;
+ /* XXX: atmresolve already free'd it */
+ senderr(EHOSTUNREACH);
+ /* XXX: put ATMARP stuff here */
+ /* XXX: watch who frees m on failure */
+ }
+ etype = htons(ETHERTYPE_IP);
+ break;
#endif
- /* case AF_ATM: XXX: need raw ATM handle here? */
-
- default:
- printf("%s: can't handle af%d\n", ifp->if_xname,
- dst->sa_family);
- senderr(EAFNOSUPPORT);
- }
+ default:
+ printf("%s: can't handle af%d\n", ifp->if_xname,
+ dst->sa_family);
+ senderr(EAFNOSUPPORT);
+ }
- sz = sizeof(atmdst);
- atm_flags = ATM_PH_FLAGS(&atmdst);
- if (atm_flags & ATM_PH_LLCSNAP) sz += 8; /* sizeof snap == 8 */
- M_PREPEND(m, sz, M_DONTWAIT);
- if (m == 0)
- senderr(ENOBUFS);
- ad = mtod(m, struct atm_pseudohdr *);
- *ad = atmdst;
- if (atm_flags & ATM_PH_LLCSNAP) {
- atmllc = (struct atmllc *)(ad + 1);
- bcopy(ATMLLC_HDR, atmllc->llchdr, sizeof(atmllc->llchdr));
- ATM_LLC_SETTYPE(atmllc, etype); /* already in network order */
+ /*
+ * must add atm_pseudohdr to data
+ */
+ sz = sizeof(atmdst);
+ atm_flags = ATM_PH_FLAGS(&atmdst);
+ if (atm_flags & ATM_PH_LLCSNAP) sz += 8; /* sizeof snap == 8 */
+ M_PREPEND(m, sz, M_DONTWAIT);
+ if (m == 0)
+ senderr(ENOBUFS);
+ ad = mtod(m, struct atm_pseudohdr *);
+ *ad = atmdst;
+ if (atm_flags & ATM_PH_LLCSNAP) {
+ atmllc = (struct atmllc *)(ad + 1);
+ bcopy(ATMLLC_HDR, atmllc->llchdr,
+ sizeof(atmllc->llchdr));
+ ATM_LLC_SETTYPE(atmllc, etype);
+ /* note: already in network order */
+ }
}
/*