mirror of
https://github.com/mfontanini/libtins
synced 2026-01-29 13:04:28 +01:00
Fixed issue related with EthernetII protocol.
The Ethernet II protocol forces a minimum length of 60 bytes. It is necessary to add a trailer for padding of null-bytes when the inner_pdu's size does not meet the requirement. Also EthernetII packets received were being incorrectly parsed due to the existance of this padding. The issue has been solved and several tests were added. All tests successfully pass.
This commit is contained in:
@@ -46,6 +46,20 @@ TEST_F(PPPoETest, StackedOnEthernet) {
|
||||
ASSERT_TRUE(eth2.find_pdu<PPPoE>());
|
||||
}
|
||||
|
||||
TEST_F(PPPoETest, StackedOnEthernetSerializationWithTags) {
|
||||
PPPoE pdu(expected_packet, sizeof(expected_packet));
|
||||
EthernetII eth = EthernetII() / pdu;
|
||||
PDU::serialization_type buffer = eth.serialize();
|
||||
EthernetII eth2(&buffer[0], buffer.size());
|
||||
PPPoE* unserialized = eth2.find_pdu<PPPoE>();
|
||||
ASSERT_TRUE(unserialized);
|
||||
EXPECT_EQ(
|
||||
PPPoE::serialization_type(expected_packet, expected_packet + sizeof(expected_packet)),
|
||||
unserialized->serialize()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(PPPoETest, Serialize) {
|
||||
PPPoE pdu(expected_packet, sizeof(expected_packet));
|
||||
PPPoE::serialization_type buffer = pdu.serialize();
|
||||
|
||||
Reference in New Issue
Block a user