Add L2 PPP and PPPoE

This commit is contained in:
Sergio R. Caprile committed 2026-04-01 14:50:00 -03:00
1 parent b491b7c624
commit ba47e29c28
4 files changed
+71

No files matched your search

+12
View File
@@ -82,6 +82,7 @@ struct pppoe { // RFC-2516, "A Method for Transmitting PPP Over Ethernet
#define MG_PPPoE_PADS 0x65
#define MG_PPPoE_PADT 0xa7
<<<<<<< HEAD
#define MG_PPPoE_ST_DISC 0 // Discovery phase, see what servers are out there
#define MG_PPPoE_ST_REQ 1 // Chose a server, request a session and wait
#define MG_PPPoE_ST_SESS 2 // Session established, PPP traffic is exchanged
@@ -90,6 +91,12 @@ struct pppoe { // RFC-2516, "A Method for Transmitting PPP Over Ethernet
static bool s_link = false; // *******************************************
static uint8_t s_state = MG_PPPoE_ST_DISC;
=======
#define PDIFF(a, b) ((size_t) (((char *) (b)) - ((char *) (a))))
static bool s_link = false; // *******************************************
static uint8_t s_state = 0;
>>>>>>> 668f10fc (Add L2 PPP and PPPoE)
static uint16_t s_id;
void mg_l2_ppp_init(struct mg_tcpip_if *ifp) {
@@ -106,7 +113,12 @@ void mg_l2_pppoe_init(struct mg_tcpip_if *ifp) {
}
bool mg_l2_ppp_poll(struct mg_tcpip_if *ifp, bool expired_1000ms) {
<<<<<<< HEAD
if (expired_1000ms && ifp->state == MG_TCPIP_STATE_DOWN) s_link = false;
=======
(void) ifp;
(void) expired_1000ms;
>>>>>>> 668f10fc (Add L2 PPP and PPPoE)
return s_link;
}
+1
View File
@@ -88,6 +88,7 @@ struct mg_tcpip_if {
#define MG_TCPIP_STATE_IP 4 // Interface is up and has an IP assigned
#define MG_TCPIP_STATE_READY 5 // Interface has fully come up, ready to work
bool gw_ready; // We've got a hw address for the router
bool driver_up; // Driver reports link state is up
#if MG_ENABLE_IPV6
uint8_t gw6mac[sizeof(struct mg_l2addr)]; // IPV6 Router's hw address
uint8_t state6; // Current IPv6 state