diff --git a/src/internals.cpp b/src/internals.cpp index 11673da..99eb1a8 100644 --- a/src/internals.cpp +++ b/src/internals.cpp @@ -227,6 +227,9 @@ Constants::Ethernet::e pdu_flag_to_ether_type(PDU::PDUType flag) { return Constants::Ethernet::VLAN; case PDU::PPPOE: return Constants::Ethernet::PPPOED; + case PDU::RSNEAPOL: + case PDU::RC4EAPOL: + return Constants::Ethernet::EAPOL; default: if(Internals::pdu_type_registered(flag)) return static_cast( diff --git a/tests/src/rsn_eapol.cpp b/tests/src/rsn_eapol.cpp index 7015252..dbe543d 100644 --- a/tests/src/rsn_eapol.cpp +++ b/tests/src/rsn_eapol.cpp @@ -3,6 +3,7 @@ #include #include #include "eapol.h" +#include "snap.h" #include "utils.h" #include "rsn_information.h" @@ -12,6 +13,7 @@ using namespace Tins; class RSNEAPOLTest : public testing::Test { public: static const uint8_t expected_packet[]; + static const uint8_t eapol_over_snap[]; void test_equals(const RSNEAPOL &eapol1, const RSNEAPOL &eapol2); }; @@ -53,6 +55,16 @@ const uint8_t RSNEAPOLTest::expected_packet[] = { 255, 139, 147, 211, 46 }; +const uint8_t RSNEAPOLTest::eapol_over_snap[] = { + 170, 170, 3, 0, 0, 0, 136, 142, 2, 3, 0, 95, 2, 0, 138, 0, 16, 0, + 0, 0, 0, 0, 0, 0, 1, 82, 43, 37, 89, 147, 67, 237, 161, 188, 102 + , 113, 206, 250, 93, 102, 154, 119, 17, 84, 225, 191, 146, 83, + 238, 40, 0, 226, 176, 19, 64, 109, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0 + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 216, + 123, 212, 159 +}; + void RSNEAPOLTest::test_equals(const RSNEAPOL &eapol1, const RSNEAPOL &eapol2) { EXPECT_EQ(eapol1.version(), eapol2.version()); EXPECT_EQ(eapol1.packet_type(), eapol2.packet_type()); @@ -89,6 +101,11 @@ TEST_F(RSNEAPOLTest, DefaultConstructor) { EXPECT_EQ(RSNEAPOL::key_type(), eapol.key()); } +TEST_F(RSNEAPOLTest, EAPOLOverSnap) { + SNAP snap(eapol_over_snap, sizeof(eapol_over_snap)); + EXPECT_TRUE(snap.find_pdu()); +} + TEST_F(RSNEAPOLTest, ConstructorFromBuffer) { RSNEAPOL eapol(expected_packet, sizeof(expected_packet)); EXPECT_EQ(1, eapol.version());