summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/cbcp.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/cbcp.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/cbcp.c')
-rw-r--r--usr.sbin/ppp/cbcp.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.sbin/ppp/cbcp.c b/usr.sbin/ppp/cbcp.c
index a901ef9..bea92f3 100644
--- a/usr.sbin/ppp/cbcp.c
+++ b/usr.sbin/ppp/cbcp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cbcp.c,v 1.10 1999/02/26 21:28:07 brian Exp $
+ * $Id: cbcp.c,v 1.11 1999/03/29 08:21:26 brian Exp $
*/
#include <sys/param.h>
@@ -33,6 +33,7 @@
#include <string.h>
#include <termios.h>
+#include "layer.h"
#include "defs.h"
#include "log.h"
#include "timer.h"
@@ -47,7 +48,7 @@
#include "link.h"
#include "async.h"
#include "physical.h"
-#include "lcpproto.h"
+#include "proto.h"
#include "cbcp.h"
#include "mp.h"
#include "chat.h"
@@ -201,7 +202,8 @@ cbcp_Output(struct cbcp *cbcp, u_char code, struct cbcp_data *data)
head->length = htons(sizeof *head + data->length);
memcpy(MBUF_CTOP(bp) + sizeof *head, data, data->length);
log_DumpBp(LogDEBUG, "cbcp_Output", bp);
- hdlc_Output(&cbcp->p->link, PRI_LINK, PROTO_CBCP, bp);
+ link_PushPacket(&cbcp->p->link, bp, cbcp->p->dl->bundle,
+ PRI_LINK, PROTO_CBCP);
}
static const char *
@@ -600,26 +602,33 @@ cbcp_SendAck(struct cbcp *cbcp)
cbcp_NewPhase(cbcp, CBCP_ACKSENT); /* Wait for an ACK */
}
-void
-cbcp_Input(struct physical *p, struct mbuf *bp)
+extern struct mbuf *
+cbcp_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
{
+ struct physical *p = link2physical(l);
struct cbcp_header *head;
struct cbcp_data *data;
struct cbcp *cbcp = &p->dl->cbcp;
int len;
+ if (p == NULL) {
+ log_Printf(LogERROR, "cbcp_Input: Not a physical link - dropped\n");
+ mbuf_Free(bp);
+ return NULL;
+ }
+
bp = mbuf_Contiguous(bp);
len = mbuf_Length(bp);
if (len < sizeof(struct cbcp_header)) {
mbuf_Free(bp);
- return;
+ return NULL;
}
head = (struct cbcp_header *)MBUF_CTOP(bp);
if (ntohs(head->length) != len) {
log_Printf(LogWARN, "Corrupt CBCP packet (code %d, length %d not %d)"
" - ignored\n", head->code, ntohs(head->length), len);
mbuf_Free(bp);
- return;
+ return NULL;
}
/* XXX check the id */
@@ -706,6 +715,7 @@ cbcp_Input(struct physical *p, struct mbuf *bp)
}
mbuf_Free(bp);
+ return NULL;
}
void
OpenPOWER on IntegriCloud