mirror of
https://github.com/mfontanini/libtins
synced 2026-01-29 04:54:28 +01:00
Fix IP fragment reassemble when packet has flags DF+MF
This commit is contained in:
@@ -177,7 +177,7 @@ void IP::init_ip_fields() {
|
||||
}
|
||||
|
||||
bool IP::is_fragmented() const {
|
||||
return flags() == IP::MORE_FRAGMENTS || fragment_offset() != 0;
|
||||
return (flags() & IP::MORE_FRAGMENTS) != 0 || fragment_offset() != 0;
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
||||
@@ -55,7 +55,8 @@ void IPv4Stream::add_fragment(IP* ip) {
|
||||
}
|
||||
fragments_.insert(it, IPv4Fragment(ip->inner_pdu(), offset));
|
||||
received_size_ += ip->inner_pdu()->size();
|
||||
if (ip->flags() != IP::MORE_FRAGMENTS) {
|
||||
// If the MF flag is off
|
||||
if ((ip->flags() & IP::MORE_FRAGMENTS) == 0) {
|
||||
total_size_ = offset + ip->inner_pdu()->size();
|
||||
received_end_ = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user