ipv6 reassembly: fix detecting holes in reassembled packets

Added unit test for reassembly.

See bug #64767
This commit is contained in:
Simon Goldschmidt
2023-10-07 22:44:52 +02:00
parent 16e8ef3145
commit c8f42025ce
3 changed files with 108 additions and 2 deletions

View File

@@ -447,6 +447,19 @@ ip6_reass(struct pbuf *p)
}
}
#endif /* IP_REASS_CHECK_OVERLAP */
/* Check if the fragments received so far have no gaps. */
if (iprh_prev != NULL) {
if (iprh_prev->end != start) {
/* There is a fragment missing between the current
* and the previous fragment */
valid = 0;
}
}
if (end != iprh_tmp->start) {
/* There is a fragment missing between the current
* and the following fragment */
valid = 0;
}
/* the new pbuf should be inserted before this */
next_pbuf = q;
if (iprh_prev != NULL) {
@@ -658,6 +671,7 @@ ip6_reass(struct pbuf *p)
}
/* Return the pbuf chain */
MIB2_STATS_INC(mib2.ip6reasmoks);
return p;
}
/* the datagram is not (yet?) reassembled completely */

View File

@@ -122,7 +122,7 @@ struct stats_sys {
/** SNMP MIB2 stats */
struct stats_mib2 {
/* IP */
/* IPv4 */
u32_t ipinhdrerrors;
u32_t ipinaddrerrors;
u32_t ipinunknownprotos;
@@ -140,6 +140,9 @@ struct stats_mib2 {
u32_t ipforwdatagrams;
u32_t ipinreceives;
/* IPv6 */
u32_t ip6reasmoks;
/* TCP */
u32_t tcpactiveopens;
u32_t tcppassiveopens;