mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-29 12:41:03 +00:00
add tests for L2
This commit is contained in:
1 parent
fdcefb087e
commit
e5e13ff156
8 files changed
+779
-27
No files matched your search
+2
-2
@@ -109,7 +109,7 @@ bool mg_l2_eth_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||
} else { // We do, check 802.1Q tag
|
||||
struct qtag *qtag = (struct qtag *) ð->type;
|
||||
if (qtag->tpid != mg_htons(0x8100)) return false; // Untagged frame
|
||||
if (mg_ntohs(VLAN_ID(qtag->tci)) != VLAN_ID(d->vlan_id))
|
||||
if (VLAN_ID(mg_ntohs(qtag->tci)) != VLAN_ID(d->vlan_id))
|
||||
return false; // Not our VLAN
|
||||
type = MG_LOAD_BE16(qtag + 1);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ bool mg_l2_eth_rx(struct mg_tcpip_if *ifp, enum mg_l2proto *proto,
|
||||
for (i = 0; i < sizeof(eth_types) / sizeof(uint16_t); i++) {
|
||||
if (type == eth_types[i]) break;
|
||||
}
|
||||
if (i == sizeof(eth_types)) {
|
||||
if (i == sizeof(eth_types) / sizeof(eth_types[0])) {
|
||||
MG_DEBUG(("Unknown eth type %x", type));
|
||||
if (mg_log_level >= MG_LL_VERBOSE)
|
||||
mg_hexdump(raw->buf, raw->len >= 32 ? 32 : raw->len);
|
||||
|
||||
Reference in new issue
Block a user