summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_atm.h10
-rw-r--r--sys/net/if_atmsubr.c68
2 files changed, 48 insertions, 30 deletions
diff --git a/sys/net/if_atm.h b/sys/net/if_atm.h
index 7cac9f22004..e4115f34504 100644
--- a/sys/net/if_atm.h
+++ b/sys/net/if_atm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atm.h,v 1.3 1996/06/26 04:21:31 chuck Exp $ */
+/* $OpenBSD: if_atm.h,v 1.4 1996/06/27 04:33:10 chuck Exp $ */
/*
*
@@ -89,7 +89,9 @@ struct atmllc {
}
#ifdef _KERNEL
-void atm_ifattach __P((struct ifnet *));
-int atm_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
- struct rtentry *));
+void atm_ifattach __P((struct ifnet *));
+void atm_input __P((struct ifnet *, struct atm_pseudohdr *,
+ struct mbuf *, struct socket *));
+int atm_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *));
#endif
diff --git a/sys/net/if_atmsubr.c b/sys/net/if_atmsubr.c
index c460ef14287..d8e95763558 100644
--- a/sys/net/if_atmsubr.c
+++ b/sys/net/if_atmsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_atmsubr.c,v 1.3 1996/06/26 04:21:32 chuck Exp $ */
+/* $OpenBSD: if_atmsubr.c,v 1.4 1996/06/27 04:33:10 chuck Exp $ */
/*
*
@@ -61,6 +61,9 @@
#ifdef INET
#include <netinet/in_var.h>
#endif
+#ifdef NATM
+#include <netnatm/natm.h>
+#endif
#define senderr(e) { error = (e); goto bad;}
@@ -198,10 +201,11 @@ bad:
* the packet is in the mbuf chain m.
*/
void
-atm_input(ifp, ah, m)
+atm_input(ifp, ah, m, so)
struct ifnet *ifp;
register struct atm_pseudohdr *ah;
struct mbuf *m;
+ struct socket *so;
{
register struct ifqueue *inq;
u_int16_t etype = ETHERTYPE_IP; /* default */
@@ -214,34 +218,46 @@ atm_input(ifp, ah, m)
ifp->if_lastchange = time;
ifp->if_ibytes += m->m_pkthdr.len;
- /*
- * handle LLC/SNAP header, if present
- */
- if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) {
- struct atmllc *alc;
- if (m->m_len < sizeof(*alc) && (m = m_pullup(m, sizeof(*alc))) == 0)
- return; /* failed */
- alc = mtod(m, struct atmllc *);
- if (bcmp(alc, ATMLLC_HDR, 6)) {
- printf("%s: recv'd invalid LLC/SNAP frame [vp=%d,vc=%d]\n",
- ifp->if_xname, ATM_PH_VPI(ah), ATM_PH_VCI(ah));
- m_freem(m);
- return;
+ if (so) {
+#ifdef NATM
+ schednetisr(NETISR_NATM);
+ inq = &natmintrq;
+ m->m_pkthdr.rcvif = (struct ifnet *) so; /* XXX: overload */
+#else
+ printf("atm_input: NATM detected but not configured in kernel\n");
+ m_freem(m);
+ return;
+#endif
+ } else {
+ /*
+ * handle LLC/SNAP header, if present
+ */
+ if (ATM_PH_FLAGS(ah) & ATM_PH_LLCSNAP) {
+ struct atmllc *alc;
+ if (m->m_len < sizeof(*alc) && (m = m_pullup(m, sizeof(*alc))) == 0)
+ return; /* failed */
+ alc = mtod(m, struct atmllc *);
+ if (bcmp(alc, ATMLLC_HDR, 6)) {
+ printf("%s: recv'd invalid LLC/SNAP frame [vp=%d,vc=%d]\n",
+ ifp->if_xname, ATM_PH_VPI(ah), ATM_PH_VCI(ah));
+ m_freem(m);
+ return;
+ }
+ etype = ATM_LLC_TYPE(alc);
+ m_adj(m, sizeof(*alc));
}
- etype = ATM_LLC_TYPE(alc);
- m_adj(m, sizeof(*alc));
- }
- switch (etype) {
+ switch (etype) {
#ifdef INET
- case ETHERTYPE_IP:
- schednetisr(NETISR_IP);
- inq = &ipintrq;
- break;
+ case ETHERTYPE_IP:
+ schednetisr(NETISR_IP);
+ inq = &ipintrq;
+ break;
#endif
- default:
- m_freem(m);
- return;
+ default:
+ m_freem(m);
+ return;
+ }
}
s = splimp();