other ppp ports.
- XXX: we don't check for the exact version of new features added, so
this might not compile for all post 1.3 versions. It should be trivial
to fix.
- ppp can delay the last packet so check:
&& (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head
|| sc->sc_outm)) {
instead of just:
&& (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head)) {
- glue in ipflow fast forwarding.
- Only run pppasyncstart (sc->sc_start) from the netisr handler.
This allows pppoutput to be called from splimp (e.g., when ipflow is
in use.) without requiring pppasyncstart to run at splimp.
- defopt INET, NETATALK
- Remove force argument to pppstart; it is not necessary anymore.
-/* $NetBSD: if_ppp.c,v 1.41 1998/05/02 14:34:24 christos Exp $ */
-/* Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp */
+/* $NetBSD: if_ppp.c,v 1.46 1998/08/02 15:09:50 sommerfe Exp $ */
+/* $Id: if_ppp.c,v 1.5 1998/09/02 21:19:44 christos Exp $ */
/*
* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver.
/*
* if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver.
#define PPP_COMPRESS
#include <sys/param.h>
#define PPP_COMPRESS
#include <sys/param.h>
+
+#ifdef __NetBSD_Version__ /* Post 1.3 */
+#include "opt_inet.h"
+#include "opt_gateway.h"
+#endif
+
#include <sys/proc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/proc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <net/bpf.h>
#endif
#include <net/bpf.h>
#endif
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (npi->mode != sc->sc_npmode[npx]) {
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
return (error);
if (npi->mode != sc->sc_npmode[npx]) {
sc->sc_npmode[npx] = npi->mode;
if (npi->mode != NPMODE_QUEUE) {
ppp_requeue(sc);
sc->sc_npmode[npx] = npi->mode;
if (npi->mode != NPMODE_QUEUE) {
ppp_requeue(sc);
/*
* Put the packet on the appropriate queue.
*/
/*
* Put the packet on the appropriate queue.
*/
if (mode == NPMODE_QUEUE) {
/* XXX we should limit the number of packets on this queue */
*sc->sc_npqtail = m0;
if (mode == NPMODE_QUEUE) {
/* XXX we should limit the number of packets on this queue */
*sc->sc_npqtail = m0;
goto bad;
}
IF_ENQUEUE(ifq, m0);
goto bad;
}
IF_ENQUEUE(ifq, m0);
}
ifp->if_lastchange = time;
ifp->if_opackets++;
}
ifp->if_lastchange = time;
ifp->if_opackets++;
/*
* After a change in the NPmode for some NP, move packets from the
* npqueue to the send queue or the fast queue as appropriate.
/*
* After a change in the NPmode for some NP, move packets from the
* npqueue to the send queue or the fast queue as appropriate.
- * Should be called at splsoftnet.
+ * Should be called at splimp, since we muck with the queues.
*/
static void
ppp_requeue(sc)
*/
static void
ppp_requeue(sc)
struct mbuf *m, *mp;
u_char *cp;
int address, control, protocol;
struct mbuf *m, *mp;
u_char *cp;
int address, control, protocol;
/*
* Grab a packet to send: first try the fast queue, then the
* normal queue.
*/
/*
* Grab a packet to send: first try the fast queue, then the
* normal queue.
*/
IF_DEQUEUE(&sc->sc_fastq, m);
if (m == NULL)
IF_DEQUEUE(&sc->sc_if.if_snd, m);
IF_DEQUEUE(&sc->sc_fastq, m);
if (m == NULL)
IF_DEQUEUE(&sc->sc_if.if_snd, m);
if (m == NULL)
return NULL;
if (m == NULL)
return NULL;
s = splsoftnet();
for (i = 0; i < NPPP; ++i, ++sc) {
if (!(sc->sc_flags & SC_TBUSY)
s = splsoftnet();
for (i = 0; i < NPPP; ++i, ++sc) {
if (!(sc->sc_flags & SC_TBUSY)
- && (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head)) {
+ && (sc->sc_if.if_snd.ifq_head || sc->sc_fastq.ifq_head
+ || sc->sc_outm)) {
s2 = splimp();
sc->sc_flags |= SC_TBUSY;
splx(s2);
s2 = splimp();
sc->sc_flags |= SC_TBUSY;
splx(s2);
m->m_pkthdr.len -= PPP_HDRLEN;
m->m_data += PPP_HDRLEN;
m->m_len -= PPP_HDRLEN;
m->m_pkthdr.len -= PPP_HDRLEN;
m->m_data += PPP_HDRLEN;
m->m_len -= PPP_HDRLEN;
+#ifdef __NetBSD_Version__
+#ifdef GATEWAY
+ if (ipflow_fastforward(m))
+ return;
+#endif
+#endif
schednetisr(NETISR_IP);
inq = &ipintrq;
break;
schednetisr(NETISR_IP);
inq = &ipintrq;
break;
-/* $NetBSD: ppp_tty.c,v 1.13 1997/03/25 22:33:25 christos Exp $ */
-/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */
+/* $NetBSD: ppp_tty.c,v 1.14 1998/08/02 15:09:50 sommerfe Exp $ */
+/* $Id: ppp_tty.c,v 1.3 1998/09/02 21:19:45 christos Exp $ */
/*
* ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
/*
* ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag,
struct proc *));
int pppinput __P((int c, struct tty *tp));
int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag,
struct proc *));
int pppinput __P((int c, struct tty *tp));
-int pppstart __P((struct tty *tp, int));
+int pppstart __P((struct tty *tp));
static u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len));
static void pppasyncstart __P((struct ppp_softc *));
static u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len));
static void pppasyncstart __P((struct ppp_softc *));
/* Call pppstart to start output again if necessary. */
s = spltty();
/* Call pppstart to start output again if necessary. */
s = spltty();
/*
* This timeout is needed for operation on a pseudo-tty,
/*
* This timeout is needed for operation on a pseudo-tty,
* Called at spltty or higher.
*/
int
* Called at spltty or higher.
*/
int
{
register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc;
{
register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc;
* or been disconnected from the ppp unit, then tell if_ppp.c that
* we need more output.
*/
* or been disconnected from the ppp unit, then tell if_ppp.c that
* we need more output.
*/
- if (CCOUNT(&tp->t_outq) >= PPP_LOWAT && !force)
+ if ((CCOUNT(&tp->t_outq) >= PPP_LOWAT)
+ && ((sc == NULL) || (sc->sc_flags & SC_TIMEOUT)))
return 0;
if (!((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
&& sc != NULL && tp == (struct tty *) sc->sc_devp) {
return 0;
if (!((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0)
&& sc != NULL && tp == (struct tty *) sc->sc_devp) {
s = spltty();
sc->sc_flags &= ~SC_TIMEOUT;
s = spltty();
sc->sc_flags &= ~SC_TIMEOUT;