fix/improvement:
- add proto if atm_input - add native mode atm hooks to if_atmsubr.c (atm_input)
This commit is contained in:
parent
ff6f7d186b
commit
849f947488
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_atm.h,v 1.2 1996/06/26 04:22:54 chuck Exp $ */
|
||||
/* $NetBSD: if_atm.h,v 1.3 1996/06/27 04:34:17 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
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_atmsubr.c,v 1.2 1996/06/26 04:22:56 chuck Exp $ */
|
||||
/* $NetBSD: if_atmsubr.c,v 1.3 1996/06/27 04:34:21 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;
|
||||
}
|
||||
etype = ATM_LLC_TYPE(alc);
|
||||
m_adj(m, sizeof(*alc));
|
||||
}
|
||||
|
||||
switch (etype) {
|
||||
#ifdef INET
|
||||
case ETHERTYPE_IP:
|
||||
schednetisr(NETISR_IP);
|
||||
inq = &ipintrq;
|
||||
break;
|
||||
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
|
||||
default:
|
||||
m_freem(m);
|
||||
return;
|
||||
} 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));
|
||||
}
|
||||
|
||||
switch (etype) {
|
||||
#ifdef INET
|
||||
case ETHERTYPE_IP:
|
||||
schednetisr(NETISR_IP);
|
||||
inq = &ipintrq;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
s = splimp();
|
||||
|
Loading…
Reference in New Issue
Block a user