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

Build layer 5 as RawPDU if IPv6 has fragment header

This commit is contained in:
Matias Fontanini
2016-02-22 20:37:48 -08:00
parent e5282f8a3c
commit bf70a94921
2 changed files with 40 additions and 15 deletions

View File

@@ -24,7 +24,7 @@ using namespace Tins;
class IPv6Test : public testing::Test {
public:
static const uint8_t expected_packet1[], expected_packet2[],
hop_by_hop_options[];
hop_by_hop_options[], broken1[];
void test_equals(IPv6& ip1, IPv6& ip2);
};
@@ -55,6 +55,12 @@ const uint8_t IPv6Test::hop_by_hop_options[] = {
222, 173, 190, 239, 190, 173, 254, 237
};
const uint8_t IPv6Test::broken1[] = {
51, 51, 0, 0, 0, 251, 96, 3, 8, 165, 51, 186, 134, 221, 96, 14, 233, 9, 0, 11, 44, 255,
254, 128, 0, 0, 0, 0, 0, 0, 98, 3, 8, 255, 254, 165, 51, 186, 255, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 251, 17, 0, 11, 80, 53, 98, 2, 81, 72, 50, 10
};
void IPv6Test::test_equals(IPv6& ip1, IPv6& ip2) {
EXPECT_EQ(ip1.version(), ip2.version());
EXPECT_EQ(ip1.traffic_class(), ip2.traffic_class());
@@ -161,6 +167,14 @@ TEST_F(IPv6Test, Serialize) {
test_equals(ip1, ip2);
}
TEST_F(IPv6Test, Broken1) {
EthernetII pkt(broken1, sizeof(broken1));
EXPECT_EQ(
PDU::serialization_type(broken1, broken1 + sizeof(broken1)),
pkt.serialize()
);
}
TEST_F(IPv6Test, Version) {
IPv6 ipv6;
ipv6.version(3);