1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 12:14:26 +01:00

Implemented matches_response on several PDUs. Added some test cases.

This commit is contained in:
Matias Fontanini
2013-04-02 21:05:53 -03:00
parent 97049140af
commit f2a5f73337
16 changed files with 352 additions and 12 deletions

View File

@@ -133,7 +133,8 @@ bool EthernetII::matches_response(uint8_t *ptr, uint32_t total_sz) {
const size_t addr_sz = address_type::address_size;
const ethhdr *eth_ptr = (const ethhdr*)ptr;
if(std::equal(_eth.src_mac, _eth.src_mac + addr_sz, eth_ptr->dst_mac)) {
if(std::equal(_eth.src_mac, _eth.src_mac + addr_sz, eth_ptr->dst_mac) || dst_addr() == BROADCAST)
if(std::equal(_eth.src_mac, _eth.src_mac + addr_sz, eth_ptr->dst_mac) || dst_addr() == BROADCAST ||
(_eth.src_mac[0] == 0x33 && _eth.src_mac[1] == 0x33))
{
return (inner_pdu()) ? inner_pdu()->matches_response(ptr + sizeof(_eth), total_sz - sizeof(_eth)) : true;
}