mirror of
https://github.com/mfontanini/libtins
synced 2026-01-30 21:44:26 +01:00
Several classes now use PDUOption::length_field instead of data_size.
This commit is contained in:
@@ -417,3 +417,20 @@ TEST_F(ICMPv6Test, DNSSearchList) {
|
||||
EXPECT_EQ(output.lifetime, data.lifetime);
|
||||
EXPECT_EQ(data.domains, output.domains);
|
||||
}
|
||||
|
||||
TEST_F(ICMPv6Test, SpoofedOptions) {
|
||||
ICMPv6 pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
EXPECT_EQ(pdu.serialize().size(), pdu.size());
|
||||
}
|
||||
|
||||
@@ -253,3 +253,20 @@ TEST_F(IPTest, StackedProtocols) {
|
||||
buffer = ip.serialize();
|
||||
EXPECT_TRUE(IP(&buffer[0], buffer.size()).find_pdu<ICMP>());
|
||||
}
|
||||
|
||||
TEST_F(IPTest, SpoofedOptions) {
|
||||
IP pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
EXPECT_EQ(pdu.serialize().size(), pdu.size());
|
||||
}
|
||||
|
||||
@@ -173,4 +173,5 @@ TEST_F(PPPoETest, SpoofedOptions) {
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.tags().size());
|
||||
EXPECT_EQ(pdu.serialize().size(), pdu.size());
|
||||
}
|
||||
|
||||
@@ -210,3 +210,20 @@ TEST_F(TCPTest, Serialize) {
|
||||
ASSERT_EQ(buffer.size(), sizeof(expected_packet));
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
TEST_F(TCPTest, SpoofedOptions) {
|
||||
TCP pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
EXPECT_EQ(pdu.serialize().size(), pdu.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user