X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=modules%2Fppp.c;h=d033f6e173196303a70f4821809df1986e27b7cb;hb=2b4e267c6dab168d8c3bb61021e285c0a43042e4;hp=164f1c87cc64083877015771cd7ad31c0f7d04a6;hpb=ac19750e0fb64986870e9bd9bad52d5ae46e2551;p=ppp.git diff --git a/modules/ppp.c b/modules/ppp.c index 164f1c8..d033f6e 100644 --- a/modules/ppp.c +++ b/modules/ppp.c @@ -24,7 +24,7 @@ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. * - * $Id: ppp.c,v 1.17 1999/03/08 05:34:16 paulus Exp $ + * $Id: ppp.c,v 1.21 1999/09/15 23:49:05 masputra Exp $ */ /* @@ -255,7 +255,9 @@ static upperstr_t *find_dest __P((upperstr_t *, int)); static int putctl2 __P((queue_t *, int, int, int)); static int putctl4 __P((queue_t *, int, int, int)); static int pass_packet __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +#ifdef FILTER_PACKETS static int ip_hard_filter __P((upperstr_t *ppa, mblk_t *mp, int outbound)); +#endif /* FILTER_PACKETS */ #define PPP_ID 0xb1a6 static struct module_info ppp_info = { @@ -556,7 +558,7 @@ pppuwput(q, mp) queue_t *q; mblk_t *mp; { - upperstr_t *us, *usnext, *ppa, *os, *nps; + upperstr_t *us, *ppa, *nps; struct iocblk *iop; struct linkblk *lb; #ifdef LACHTCP @@ -567,7 +569,6 @@ pppuwput(q, mp) int error, n, sap; mblk_t *mq; struct ppp_idle *pip; - int len; #ifdef PRIOQ queue_t *tlq; #endif /* PRIOQ */ @@ -809,7 +810,7 @@ pppuwput(q, mp) if (n == PPPDBG_DUMP + PPPDBG_DRIVER) { qwriter(q, NULL, debug_dump, PERIM_OUTER); iop->ioc_count = 0; - error = 0; + error = -1; } else if (n == PPPDBG_LOG + PPPDBG_DRIVER) { DPRINT1("ppp/%d: debug log enabled\n", us->mn); us->flags |= US_DBGLOG; @@ -1042,7 +1043,7 @@ dlpi_request(q, mp, us) int size = mp->b_wptr - mp->b_rptr; mblk_t *reply, *np; upperstr_t *ppa, *os; - int sap, *ip, len; + int sap, len; dl_info_ack_t *info; dl_bind_ack_t *ackp; @@ -1098,7 +1099,7 @@ dlpi_request(q, mp, us) } us->ppa = ppa; qwriter(q, mp, attach_ppa, PERIM_OUTER); - break; + return; case DL_DETACH_REQ: if (size < sizeof(dl_detach_req_t)) @@ -1108,7 +1109,7 @@ dlpi_request(q, mp, us) break; } qwriter(q, mp, detach_ppa, PERIM_OUTER); - break; + return; case DL_BIND_REQ: if (size < sizeof(dl_bind_req_t)) @@ -1129,6 +1130,18 @@ dlpi_request(q, mp, us) except that we accept ETHERTYPE_IP in place of PPP_IP. */ sap = d->bind_req.dl_sap; us->req_sap = sap; + +#ifdef SOL2 + /* + * ip will send a sap value of 0 (post-Solaris 7), or + * ETHERTYPE_IP (0x800) (pre-Solaris 8) due to how the + * ppp DLPI provider declares its characteristics. + * + */ + if (sap == 0) + sap = ETHERTYPE_IP; +#endif /* SOL2 */ + if (sap == ETHERTYPE_IP) sap = PPP_IP; if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) { @@ -1423,7 +1436,6 @@ send_data(mp, us) mblk_t *mp; upperstr_t *us; { - queue_t *q; upperstr_t *ppa; if ((us->flags & US_BLOCKED) || us->npmode == NPMODE_QUEUE) @@ -1435,7 +1447,7 @@ send_data(mp, us) freemsg(mp); return 1; } - if ((q = ppa->lowerq) == 0) { + if (ppa->lowerq == 0) { /* try to send it up the control stream */ if (bcanputnext(ppa->q, mp->b_band)) { /* @@ -1699,9 +1711,7 @@ pppurput(q, mp) mblk_t *mp; { upperstr_t *ppa, *us; - queue_t *uq; int proto, len; - mblk_t *np; struct iocblk *iop; ppa = (upperstr_t *) q->q_ptr; @@ -1967,6 +1977,25 @@ ppplrput(q, mp) mblk_t *mp; { queue_t *uq; + struct iocblk *iop; + + switch (mp->b_datap->db_type) { + case M_IOCTL: + iop = (struct iocblk *) mp->b_rptr; + iop->ioc_error = EINVAL; + mp->b_datap->db_type = M_IOCNAK; + qreply(q, mp); + return 0; + case M_FLUSH: + if (*mp->b_rptr & FLUSHR) + flushq(q, FLUSHDATA); + if (*mp->b_rptr & FLUSHW) { + *mp->b_rptr &= ~FLUSHR; + qreply(q, mp); + } else + freemsg(mp); + return 0; + } /* * If we can't get the lower lock straight away, queue this one @@ -2073,8 +2102,8 @@ putctl4(q, type, code, val) static void debug_dump(q, mp) - queue_t *q; /* not used */ - mblk_t *mp; /* not used either */ + queue_t *q; + mblk_t *mp; { upperstr_t *us; queue_t *uq, *lq; @@ -2100,6 +2129,8 @@ debug_dump(q, mp) (lq? qsize(lq): 0), us->mru, us->mtu); } } + mp->b_datap->db_type = M_IOCACK; + qreply(q, mp); } #ifdef FILTER_PACKETS