* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: ppp.c,v 1.16 1999/02/26 10:52:06 paulus Exp $
+ * $Id: ppp.c,v 1.22 1999/09/17 05:59:00 paulus Exp $
*/
/*
#define LOCK_LOWER_R 0
#define TRYLOCK_LOWER_R 1
#define UNLOCK_LOWER 0
-#define MUTEX_ENTER(x) 0
-#define MUTEX_EXIT(x) 0
+#define MT_ENTER(x) 0
+#define MT_EXIT(x) 0
#endif /* SOL2 */
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 = {
#endif
if (up->lowerq != 0) {
/* Gack! the lower stream should have be unlinked earlier! */
- cmn_err(CE_WARN, "ppp%d: lower stream still connected on close?\n",
+ DPRINT1("ppp%d: lower stream still connected on close?\n",
up->mn);
LOCK_LOWER_W;
up->lowerq->q_ptr = 0;
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
int error, n, sap;
mblk_t *mq;
struct ppp_idle *pip;
- int len;
#ifdef PRIOQ
queue_t *tlq;
#endif /* PRIOQ */
+#ifdef NO_DLPI
+ upperstr_t *os;
+#endif
us = (upperstr_t *) q->q_ptr;
if (us == 0) {
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;
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;
}
us->ppa = ppa;
qwriter(q, mp, attach_ppa, PERIM_OUTER);
- break;
+ return;
case DL_DETACH_REQ:
if (size < sizeof(dl_detach_req_t))
break;
}
qwriter(q, mp, detach_ppa, PERIM_OUTER);
- break;
+ return;
case DL_BIND_REQ:
if (size < sizeof(dl_bind_req_t))
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.
+ * <adi.masputra@sun.com>
+ */
+ if (sap == 0)
+ sap = ETHERTYPE_IP;
+#endif /* SOL2 */
+
if (sap == ETHERTYPE_IP)
sap = PPP_IP;
if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) {
mblk_t *mp;
upperstr_t *us;
{
- queue_t *q;
upperstr_t *ppa;
if ((us->flags & US_BLOCKED) || us->npmode == NPMODE_QUEUE)
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)) {
/*
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;
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
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;
(lq? qsize(lq): 0), us->mru, us->mtu);
}
}
+ mp->b_datap->db_type = M_IOCACK;
+ qreply(q, mp);
}
#ifdef FILTER_PACKETS