X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=netbsd-1.2%2Fif_ppp.c;h=88efa84ba7f24c640e0489d208114fd8a6efcb05;hb=f9f667ee187be5d34ac94f11bf366dd218191122;hp=58b000607a3f3b32b3a9a2910286cdad823bd9e3;hpb=e28f2e9f4f40cbe35009ba554c5bd29fd456416b;p=ppp.git diff --git a/netbsd-1.2/if_ppp.c b/netbsd-1.2/if_ppp.c index 58b0006..88efa84 100644 --- a/netbsd-1.2/if_ppp.c +++ b/netbsd-1.2/if_ppp.c @@ -1,23 +1,46 @@ -/* $NetBSD: if_ppp.c,v 1.36 1997/03/04 21:40:07 mycroft 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.6 2002/12/06 12:03:44 paulus Exp $ */ /* * if_ppp.c - Point-to-Point Protocol (PPP) Asynchronous driver. * - * Copyright (c) 1989 Carnegie Mellon University. - * All rights reserved. + * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by Carnegie Mellon University. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The name "Carnegie Mellon University" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For permission or any legal + * details, please contact + * Office of Technology Transfer + * Carnegie Mellon University + * 5000 Forbes Avenue + * Pittsburgh, PA 15213-3890 + * (412) 268-4387, fax: (412) 268-7395 + * tech-transfer@andrew.cmu.edu + * + * 4. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by Computing Services + * at Carnegie Mellon University (http://www.cmu.edu/computing/)." + * + * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Drew D. Perkins * Carnegie Mellon University @@ -82,6 +105,12 @@ #define PPP_COMPRESS #include + +#ifdef __NetBSD_Version__ /* Post 1.3 */ +#include "opt_inet.h" +#include "opt_gateway.h" +#endif + #include #include #include @@ -99,7 +128,7 @@ #include #endif -#if INET +#ifdef INET #include #include #include @@ -161,7 +190,7 @@ static void pppdumpm __P((struct mbuf *m0)); */ extern struct compressor ppp_bsd_compress; -extern struct compressor ppp_deflate; +extern struct compressor ppp_deflate, ppp_deflate_draft; struct compressor *ppp_compressors[8] = { #if DO_BSD_COMPRESS && defined(PPP_BSDCOMP) @@ -169,6 +198,7 @@ struct compressor *ppp_compressors[8] = { #endif #if DO_DEFLATE && defined(PPP_DEFLATE) &ppp_deflate, + &ppp_deflate_draft, #endif NULL }; @@ -234,7 +264,7 @@ pppalloc(pid) MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress), M_DEVBUF, M_NOWAIT); if (sc->sc_comp) - sl_compress_init(sc->sc_comp, -1); + sl_compress_init(sc->sc_comp); #endif #ifdef PPP_COMPRESS sc->sc_xc_state = NULL; @@ -383,7 +413,7 @@ pppioctl(sc, cmd, data, flag, p) return (error); if (sc->sc_comp) { s = splsoftnet(); - sl_compress_init(sc->sc_comp, *(int *)data); + sl_compress_setup(sc->sc_comp, *(int *)data); splx(s); } break; @@ -470,11 +500,11 @@ pppioctl(sc, cmd, data, flag, p) if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) return (error); if (npi->mode != sc->sc_npmode[npx]) { - s = splsoftnet(); + s = splimp(); sc->sc_npmode[npx] = npi->mode; if (npi->mode != NPMODE_QUEUE) { ppp_requeue(sc); - (*sc->sc_start)(sc); + ppp_restart(sc); } splx(s); } @@ -770,7 +800,7 @@ pppoutput(ifp, m0, dst, rtp) /* * Put the packet on the appropriate queue. */ - s = splsoftnet(); + s = splimp(); if (mode == NPMODE_QUEUE) { /* XXX we should limit the number of packets on this queue */ *sc->sc_npqtail = m0; @@ -787,7 +817,7 @@ pppoutput(ifp, m0, dst, rtp) goto bad; } IF_ENQUEUE(ifq, m0); - (*sc->sc_start)(sc); + ppp_restart(sc); } ifp->if_lastchange = time; ifp->if_opackets++; @@ -804,7 +834,7 @@ bad: /* * 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) @@ -881,14 +911,18 @@ ppp_dequeue(sc) struct mbuf *m, *mp; u_char *cp; int address, control, protocol; + int s; /* * Grab a packet to send: first try the fast queue, then the * normal queue. */ + s = splimp(); IF_DEQUEUE(&sc->sc_fastq, m); if (m == NULL) IF_DEQUEUE(&sc->sc_if.if_snd, m); + splx(s); + if (m == NULL) return NULL; @@ -1013,7 +1047,8 @@ pppintr() 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); @@ -1415,6 +1450,12 @@ ppp_inproc(sc, m) 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;