1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Fix serialization for QinQ (#316)

* Add QinQ Frame

* Fix serialization for QinQ
This commit is contained in:
Teodoro Vargas
2018-10-09 15:02:01 -06:00
committed by Matias Fontanini
parent c26e4943c2
commit 57ac099703
6 changed files with 27 additions and 10 deletions

View File

@@ -86,6 +86,12 @@ TEST_F(Dot1QTest, QinQ) {
EthernetII pkt = EthernetII() / Dot1Q(10) / Dot1Q(42) / IP("192.168.1.2") /
TCP(23, 45) / RawPDU("asdasdasd");
PDU::serialization_type buffer = pkt.serialize();
// First PID of the serialized packet should be Dot1AD = 0x88a8
EXPECT_EQ(buffer[12], 0x88);
EXPECT_EQ(buffer[13], 0xa8);
// Second PID of the serialized packet chouls be Dot1Q = 0x8100
EXPECT_EQ(buffer[16], 0x81);
EXPECT_EQ(buffer[17], 0x00);
EthernetII pkt2(&buffer[0], buffer.size());
const Dot1Q& q1 = pkt2.rfind_pdu<Dot1Q>();
ASSERT_TRUE(q1.inner_pdu() != NULL);