diff --git a/scapy/packet.py b/scapy/packet.py index 612bf31c2..77f75c765 100644 --- a/scapy/packet.py +++ b/scapy/packet.py @@ -1463,9 +1463,10 @@ def fuzz(p, _inplace=0): print("fuzzing", repr(r)) fuzz(r, _inplace=1) elif f.default is not None: - rnd = f.randval() - if rnd is not None: - q.default_fields[f.name] = rnd + if not isinstance(f, ConditionalField) or f._evalcond(q): + rnd = f.randval() + if rnd is not None: + q.default_fields[f.name] = rnd q = q.payload return p diff --git a/test/regression.uts b/test/regression.uts index 067aabd89..d4357c7fe 100644 --- a/test/regression.uts +++ b/test/regression.uts @@ -403,7 +403,7 @@ bind_layers(IP, ICMP, frag=0, proto=1) = fuzz ~ not_pypy random.seed(0x2807) -str(fuzz(IP()/ICMP())) == '\xe5S\x00\x1c\x9dC \x007\x01(H\x7f\x00\x00\x01\x7f\x00\x00\x01*\xdb\xf7,9\x8e\xa4i' +str(fuzz(IP()/ICMP())) == 'u\x14\x00\x1c\xc2\xf6\x80\x00\xde\x01k\xd3\x7f\x00\x00\x01\x7f\x00\x00\x01y\xc9>\xa6\x84\xd8\xc2\xb7' = Building some packets ~ basic IP TCP UDP NTP LLC SNAP Dot11