add real life testing for PPPoE and VLANs

This commit is contained in:
Sergio R. Caprile committed 2026-07-03 14:45:20 -03:00
1 parent ba2abbc444
commit 9448625662
9 files changed
+251 -50

No files matched your search

+14 -6
View File
@@ -1922,11 +1922,12 @@ static void mg_ip6_poll(struct mg_tcpip_if *ifp, bool s1) {
static void mg_ip6_link(struct mg_tcpip_if *ifp, bool drv_up, bool l2_up) {
bool cur_drv = (ifp->state6 != MG_TCPIP_STATE_DOWN);
bool cur_l2 = (ifp->state6 >= MG_TCPIP_STATE_UP);
const uint8_t px[8] = {0xfe, 0x80, 0, 0, 0, 0, 0, 0}; // RFC-4291 2.5.6
if (drv_up != cur_drv || l2_up != cur_l2) { // link/L2 state has changed
if (l2_up && ifp->ip6ll[0] == 0 && ifp->ip6ll[1] == 0) { // gen ll address
uint8_t px[8] = {0xfe, 0x80, 0, 0, 0, 0, 0, 0}; // RFC-4291 2.5.6
if (ifp->l2type == MG_TCPIP_L2_ETH && l2_up && ifp->ip6ll[0] == 0 &&
ifp->ip6ll[1] == 0) { // gen ll address
mg_l2_genip6(ifp->l2type, ifp->ip6ll, 64, ifp->mac);
memcpy(ifp->ip6ll, px, 8); // RFC-4291 2.5.4
memcpy(ifp->ip6ll, px, 8); // RFC-2464 5
} // just got our link local address if we didn't have one.
// If static configuration is used, global addresses,
// prefix length, and gw are already filled at this point.
@@ -1934,14 +1935,21 @@ static void mg_ip6_link(struct mg_tcpip_if *ifp, bool drv_up, bool l2_up) {
if (!l2_up && ifp->enable_slaac) ifp->ip6[0] = ifp->ip6[1] = 0;
ifp->state6 = !drv_up ? MG_TCPIP_STATE_DOWN
: !l2_up ? MG_TCPIP_STATE_LINK_UP
: ifp->enable_slaac || ifp->ip6[0] == 0 ? MG_TCPIP_STATE_UP
: MG_TCPIP_STATE_IP;
: ifp->ip6ll[0] == 0 || ifp->enable_slaac || ifp->ip6[0] == 0
? MG_TCPIP_STATE_UP
: MG_TCPIP_STATE_IP;
onstate6change(ifp);
} else if (!ifp->enable_slaac && ifp->state6 == MG_TCPIP_STATE_UP &&
ifp->ip6[0]) {
ifp->ip6ll[0] != 0 && ifp->ip6[0] != 0) {
ifp->state6 = MG_TCPIP_STATE_IP; // ifp->fn has set an IP
onstate6change(ifp);
}
if ((ifp->l2type == MG_TCPIP_L2_PPP || ifp->l2type == MG_TCPIP_L2_PPPoE) &&
ifp->state6 == MG_TCPIP_STATE_UP && ifp->ip6ll[0] == 0 &&
ifp->ip6ll[1] != 0) { // IPV6CP has got an IFCID, gen ll address
memcpy(ifp->ip6ll, px, 8); // RFC-5072 5
onstate6change(ifp);
} // just got our link local address if we didn't have one.
}
#else
#define mg_ip6_poll(x, y)