summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/pred.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-05-08 11:07:56 +0000
committerbrian <brian@FreeBSD.org>1999-05-08 11:07:56 +0000
commitab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4 (patch)
treee79816f983bd5a5be86a78fe0aafbd00a13ac2db /usr.sbin/ppp/pred.c
parent713dd62834d401cc7b9b394a4b916ab9e5e3d4d5 (diff)
downloadFreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.zip
FreeBSD-src-ab7d88ae2d8ea955c6193cc242b9cee4d58f8fd4.tar.gz
o Redesign the layering mechanism and make the aliasing code part of
the layering. We now ``stack'' layers as soon as we open the device (when we figure out what we're dealing with). A static set of `dispatch' routines are also declared for dealing with incoming packets after they've been `pulled' up through the stacked layers. Physical devices are now assigned handlers based on the device type when they're opened. For the moment there are three device types; ttys, execs and tcps. o Increment version number to 2.2 o Make an entry in [uw]tmp for non-tty -direct invocations (after pap/chap authentication). o Make throughput counters quad_t's o Account for the absolute number of mbuf malloc()s and free()s in ``show mem''. o ``show modem'' becomes ``show physical''.
Diffstat (limited to 'usr.sbin/ppp/pred.c')
-rw-r--r--usr.sbin/ppp/pred.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/ppp/pred.c b/usr.sbin/ppp/pred.c
index 1919a8e..7e233b9 100644
--- a/usr.sbin/ppp/pred.c
+++ b/usr.sbin/ppp/pred.c
@@ -26,15 +26,17 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pred.c,v 1.23 1999/03/11 01:49:15 brian Exp $
+ * $Id: pred.c,v 1.24 1999/03/16 01:24:23 brian Exp $
*/
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
+#include <termios.h>
#include "defs.h"
+#include "layer.h"
#include "mbuf.h"
#include "log.h"
#include "timer.h"
@@ -166,8 +168,8 @@ Pred1InitOutput(struct lcp_opt *o)
return state;
}
-static int
-Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto,
+static struct mbuf *
+Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto,
struct mbuf *bp)
{
struct pred1_state *state = (struct pred1_state *)v;
@@ -183,10 +185,10 @@ Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto,
cp = bufp;
*wp++ = *cp++ = orglen >> 8;
*wp++ = *cp++ = orglen & 0377;
- *cp++ = proto >> 8;
- *cp++ = proto & 0377;
+ *cp++ = *proto >> 8;
+ *cp++ = *proto & 0377;
mbuf_Read(bp, cp, orglen - 2);
- fcs = hdlc_Fcs(INITFCS, bufp, 2 + orglen);
+ fcs = hdlc_Fcs(bufp, 2 + orglen);
fcs = ~fcs;
len = compress(state, bufp + 2, wp, orglen);
@@ -205,8 +207,8 @@ Pred1Output(void *v, struct ccp *ccp, struct link *l, int pri, u_short proto,
*wp++ = fcs & 0377;
*wp++ = fcs >> 8;
mwp->cnt = wp - MBUF_CTOP(mwp);
- hdlc_Output(l, PRI_NORMAL, ccp_Proto(ccp), mwp);
- return 1;
+ *proto = ccp_Proto(ccp);
+ return mwp;
}
static struct mbuf *
@@ -255,7 +257,7 @@ Pred1Input(void *v, struct ccp *ccp, u_short *proto, struct mbuf *bp)
}
*pp++ = *cp++; /* CRC */
*pp++ = *cp++;
- fcs = hdlc_Fcs(INITFCS, bufp, wp->cnt = pp - bufp);
+ fcs = hdlc_Fcs(bufp, wp->cnt = pp - bufp);
if (fcs == GOODFCS) {
wp->offset += 2; /* skip length */
wp->cnt -= 4; /* skip length & CRC */
OpenPOWER on IntegriCloud