mirror of
https://github.com/mfontanini/libtins
synced 2026-01-27 20:24:26 +01:00
committed by
Matias Fontanini
parent
d5cba00ce0
commit
9051197603
@@ -24,7 +24,8 @@ using namespace Tins;
|
||||
class IPv6Test : public testing::Test {
|
||||
public:
|
||||
static const uint8_t expected_packet1[], expected_packet2[],
|
||||
hop_by_hop_options[], broken1[];
|
||||
hop_by_hop_options[], broken1[],
|
||||
fcs_suffix[];
|
||||
|
||||
void test_equals(IPv6& ip1, IPv6& ip2);
|
||||
};
|
||||
@@ -61,6 +62,15 @@ const uint8_t IPv6Test::broken1[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 251, 17, 0, 11, 80, 53, 98, 2, 81, 72, 50, 10
|
||||
};
|
||||
|
||||
const uint8_t IPv6Test::fcs_suffix[] = {
|
||||
0x33, 0x33, 0xff, 0x01, 0x31, 0x3e, 0x64, 0x3f, 0x5f, 0x01, 0x31, 0x3e, 0x86, 0xdd, 0x60, 0x00,
|
||||
0x00, 0x00, 0x00, 0x18, 0x3a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0xff, 0x01, 0x31, 0x3e, 0x87, 0x00, 0x55, 0x69, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x80,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3f, 0x5f, 0xff, 0xfe, 0x01, 0x31, 0x3e, 0x23, 0x0c,
|
||||
0x57, 0xb7
|
||||
};
|
||||
|
||||
void IPv6Test::test_equals(IPv6& ip1, IPv6& ip2) {
|
||||
EXPECT_EQ(ip1.version(), ip2.version());
|
||||
EXPECT_EQ(ip1.traffic_class(), ip2.traffic_class());
|
||||
@@ -175,6 +185,16 @@ TEST_F(IPv6Test, Broken1) {
|
||||
);
|
||||
}
|
||||
|
||||
TEST_F(IPv6Test, FCSSuffix) {
|
||||
EthernetII pkt(fcs_suffix, sizeof(fcs_suffix));
|
||||
EXPECT_EQ(pkt.rfind_pdu<IPv6>().payload_length(), 24u);
|
||||
EXPECT_EQ(pkt.rfind_pdu<ICMPv6>().size(), 24u);
|
||||
EXPECT_EQ(
|
||||
PDU::serialization_type(fcs_suffix, fcs_suffix + pkt.size()),
|
||||
pkt.serialize()
|
||||
);
|
||||
}
|
||||
|
||||
TEST_F(IPv6Test, Version) {
|
||||
IPv6 ipv6;
|
||||
ipv6.version(3);
|
||||
|
||||
Reference in New Issue
Block a user