RFC 1661 requires that all LCP packets are sent with no address and

control field compression. The ng_ppp(4) node correctly follows this
rule. However, PPPoE is an exception: when doing PPPoE *all* frames
are sent with address and control field compression.

Alter this node's behavior so that when an outgoing frame is received,
any leading address and control field bytes are removed. This makes
this node compatible with ng_ppp(4).
This commit is contained in:
Archie Cobbs 2000-08-10 20:05:12 +00:00
parent 70d25dfbce
commit 7b38c4e4d9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64502

View File

@ -1123,7 +1123,21 @@ AAA
switch (sp->state) {
case PPPOE_NEWCONNECTED:
case PPPOE_CONNECTED: {
static const u_char addrctrl[] = { 0xff, 0x03 };
struct pppoe_full_hdr *wh;
/*
* Remove PPP address and control fields, if any.
* For example, ng_ppp(4) always sends LCP packets
* with address and control fields as required by
* generic PPP. PPPoE is an exception to the rule.
*/
if (m->m_pkthdr.len >= 2) {
if (m->m_len < 2 && !(m = m_pullup(m, 2)))
LEAVE(ENOBUFS);
if (bcmp(mtod(m, u_char *), addrctrl, 2) == 0)
m_adj(m, 2);
}
/*
* Bang in a pre-made header, and set the length up
* to be correct. Then send it to the ethernet driver.