aboutsummaryrefslogtreecommitdiffstats
path: root/test/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/util.py b/test/util.py
index d27b3fb25e6..96d3c6068ef 100644
--- a/test/util.py
+++ b/test/util.py
@@ -386,14 +386,19 @@ def fragment_rfc8200(packet, identification, fragsize, _logger=None):
fragment_ext_hdr = IPv6ExtHdrFragment()
logger.debug(ppp("Fragment header:", fragment_ext_hdr))
+ len_ext_and_upper_layer_payload = len(ext_and_upper_layer.payload)
+ if not len_ext_and_upper_layer_payload and \
+ hasattr(ext_and_upper_layer, "data"):
+ len_ext_and_upper_layer_payload = len(ext_and_upper_layer.data)
+
if len(per_fragment_headers) + len(fragment_ext_hdr) +\
- len(ext_and_upper_layer) - len(ext_and_upper_layer.payload)\
+ len(ext_and_upper_layer) - len_ext_and_upper_layer_payload\
> fragsize:
raise Exception("Cannot fragment this packet - MTU too small "
"(%s, %s, %s, %s, %s)" % (
len(per_fragment_headers), len(fragment_ext_hdr),
len(ext_and_upper_layer),
- len(ext_and_upper_layer.payload), fragsize))
+ len_ext_and_upper_layer_payload, fragsize))
orig_nh = packet[IPv6].nh
p = per_fragment_headers