mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-03 13:28:44 +00:00
Fix some neats, add IPv6 basic testing in LAN
This commit is contained in:
1 parent
6b589b6900
commit
2006f8302a
11 files changed
+157
-89
No files matched your search
+9
-5
@@ -848,7 +848,7 @@ static void rx_ndp_na(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
uint8_t len = *opts++; // check valid hwaddr and get it
|
||||
if (!mg_l2_ip6get(ifp->l2type, s->mac, opts, len)) return;
|
||||
MG_DEBUG(("%lu NDP resolved %M -> %M", c->id, mg_print_ip6,
|
||||
&c->rem.addr.ip6, mg_print_mac, ifp->l2type, s->mac));
|
||||
&c->rem.addr.ip6, mg_print_l2addr, ifp->l2type, s->mac));
|
||||
c->is_arplooking = 0;
|
||||
l2addr_resolved(c);
|
||||
}
|
||||
@@ -983,12 +983,12 @@ static void rx_ndp_ra(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
gotl2addr = true;
|
||||
} else if (type == 5 && length >= 8) {
|
||||
// process MTU if available
|
||||
mtu = mg_ntohl(*(uint32_t *) (opts + 4));
|
||||
mtu = MG_LOAD_BE32(opts + 4);
|
||||
} else if (type == 3 && length >= 32) {
|
||||
// process prefix, 4.6.2
|
||||
uint8_t pfx_flags = opts[3]; // L=0x80, A=0x40
|
||||
uint32_t valid = mg_ntohl(*(uint32_t *) (opts + 4));
|
||||
uint32_t pref_lifetime = mg_ntohl(*(uint32_t *) (opts + 8));
|
||||
uint32_t valid = MG_LOAD_BE32(opts + 4);
|
||||
uint32_t pref_lifetime = MG_LOAD_BE32(opts + 8);
|
||||
prefix_len = opts[2];
|
||||
prefix = opts + 16;
|
||||
|
||||
@@ -2119,7 +2119,11 @@ void mg_connect_resolved(struct mg_connection *c) {
|
||||
c->loc.port = mg_htons(ifp->eport++);
|
||||
#if MG_ENABLE_IPV6
|
||||
if (c->rem.is_ip6) {
|
||||
c->loc.addr.ip6[0] = ifp->ip6[0], c->loc.addr.ip6[1] = ifp->ip6[1],
|
||||
if(c->rem.addr.ip6[0] == ifp->ip6ll[0]) { // same local LAN, use ll
|
||||
c->loc.addr.ip6[0] = ifp->ip6ll[0], c->loc.addr.ip6[1] = ifp->ip6ll[1];
|
||||
} else { // use global address
|
||||
c->loc.addr.ip6[0] = ifp->ip6[0], c->loc.addr.ip6[1] = ifp->ip6[1];
|
||||
}
|
||||
c->loc.is_ip6 = true;
|
||||
} else
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user