summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1999-10-23 22:46:38 +0000
committerjulian <julian@FreeBSD.org>1999-10-23 22:46:38 +0000
commit48db5a679e6a04d4083989d866a6095e4b8e7e8c (patch)
treeed9a2866a395aa2fc2cf9595f1911601b1628e2d /sys
parentb08edd32335a272168ca14ad99a071979ff2bac0 (diff)
downloadFreeBSD-src-48db5a679e6a04d4083989d866a6095e4b8e7e8c.zip
FreeBSD-src-48db5a679e6a04d4083989d866a6095e4b8e7e8c.tar.gz
more fixes, braino's, typo's, etc.
Diffstat (limited to 'sys')
-rw-r--r--sys/netgraph/ng_pppoe.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c
index 63eb0d0..76ef344 100644
--- a/sys/netgraph/ng_pppoe.c
+++ b/sys/netgraph/ng_pppoe.c
@@ -397,7 +397,7 @@ pppoe_findsession(node_p node, struct pppoe_full_hdr *wh)
sessp sp = NULL;
hook_p hook = NULL;
priv_p privp = node->private;
- u_int16_t session = wh->ph.sid;
+ u_int16_t session = ntohs(wh->ph.sid);
/*
* find matching peer/session combination.
@@ -790,12 +790,15 @@ AAA
* use them to decide where to send it.
*/
+#if 0
printf("got packet\n");
LEAVE(0);
+#endif
privp->packets_in++;
m_pullup(m, sizeof(*wh)); /* Checks length */
if (m == NULL) {
+ printf("couldn't m_pullup\n");
LEAVE(ENOBUFS);
}
wh = mtod(m, struct pppoe_full_hdr *);
@@ -817,6 +820,7 @@ LEAVE(0);
* We need to do extra work.
*/
printf("packet fragmented\n");
+ LEAVE(EMSGSIZE);
}
switch(code) {
@@ -831,6 +835,7 @@ LEAVE(0);
*/
tag = get_tag(ph, PTT_SRV_NAME);
if (tag == NULL) {
+ printf("no service tag\n");
LEAVE(ENETUNREACH);
}
sendhook = pppoe_match_svc(hook->node,
@@ -838,6 +843,7 @@ LEAVE(0);
if (sendhook) {
NG_SEND_DATA(error, sendhook, m, meta);
} else {
+ printf("no such service\n");
LEAVE(ENETUNREACH);
}
break;
@@ -846,17 +852,19 @@ LEAVE(0);
* We are a client:
* Use the host_uniq tag to find the
* hook this is in response to.
- *
+ * Received #2, now send #3
* For now simply accept the first we receive.
*/
tag = get_tag(ph, PTT_HOST_UNIQ);
if ((tag == NULL)
|| (ntohs(tag->tag_len) != sizeof(sp))) {
+ printf("no host unique field\n");
LEAVE(ENETUNREACH);
}
sendhook = pppoe_finduniq(node, tag);
if (sendhook == NULL) {
+ printf("no matching session\n");
LEAVE(ENETUNREACH);
}
@@ -866,6 +874,7 @@ LEAVE(0);
*/
sp = sendhook->private;
if (sp->state != PPPOE_SINIT) {
+ printf("session in wrong state\n");
LEAVE(ENETUNREACH);
}
neg = sp->neg;
@@ -884,10 +893,11 @@ LEAVE(0);
neg->timeout = 0;
neg->pkt->pkt_header.ph.code = PADR_CODE;
init_tags(sp);
- insert_tag(sp,&neg->service.hdr); /* Service */
+ insert_tag(sp, &neg->service.hdr); /* Service */
insert_tag(sp, tag); /* Host Unique */
tag = get_tag(ph, PTT_AC_COOKIE);
- insert_tag(sp, tag); /* returned cookie */
+ if (tag)
+ insert_tag(sp, tag); /* return cookie */
scan_tags(sp, ph);
make_packet(sp);
sp->state = PPPOE_SREQ;
@@ -937,7 +947,8 @@ LEAVE(0);
neg->pkt->pkt_header.ph.code = PADS_CODE;
if (sp->Session_ID == 0)
neg->pkt->pkt_header.ph.sid =
- sp->Session_ID = get_new_sid(node);
+ htons(sp->Session_ID
+ = get_new_sid(node));
neg->timeout = 0;
/*
* start working out the tags to respond with.
@@ -1001,7 +1012,7 @@ LEAVE(0);
neg = sp->neg;
untimeout(pppoe_ticker, sendhook,
neg->timeout_handle);
- sp->Session_ID = wh->ph.sid;
+ sp->Session_ID = ntohs(wh->ph.sid);
neg->timeout = 0;
sp->state = PPPOE_CONNECTED;
sendpacket(sp);
@@ -1316,7 +1327,7 @@ AAA
case PPPOE_SNONE:
case PPPOE_NEWCONNECTED:
case PPPOE_CONNECTED:
- printf("pppoe: timeout: unexpected state\n");
+ printf("pppoe: sendpacket: unexpected state\n");
break;
case PPPOE_PRIMED:
@@ -1339,7 +1350,7 @@ AAA
case PPPOE_SINIT:
case PPPOE_SREQ:
m0 = m_copypacket(sp->neg->m, M_DONTWAIT);
- NG_SEND_DATA( error, sp->hook, m0, dummy);
+ NG_SEND_DATA( error, privp->ethernet_hook, m0, dummy);
neg->timeout_handle = timeout(pppoe_ticker, hook, hz);
neg->timeout = 2;
break;
OpenPOWER on IntegriCloud