You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bfd: fix ConditionalField condition for optional_auth always being True (#4937) (#4965)
The condition `pkt.flags.names[2] == "A"` always evaluated to True because
FlagValue.names returns the flag definition string "MDACFP", not the set of
currently active flags. Replace with `pkt.flags.A` to properly check the
Authentication Present bit.
= BFD without Auth flag - dissection should not inject phantom optional_auth (Issue #4937)
50
+
51
+
a = UDP(sport=3784, dport=3784)/BFD()
52
+
p = UDP(raw(a))
53
+
assert p[BFD].optional_auth is None
54
+
assert not p[BFD].flags.A
55
+
56
+
= BFD with non-Auth flags set - optional_auth should still be None
57
+
58
+
a = UDP(sport=3784, dport=3784)/BFD(flags="DF")
59
+
p = UDP(raw(a))
60
+
assert p[BFD].flags.D
61
+
assert p[BFD].flags.F
62
+
assert not p[BFD].flags.A
63
+
assert p[BFD].optional_auth is None
64
+
65
+
= BFD round-trip without auth preserves raw bytes
66
+
67
+
a = UDP(sport=3784, dport=3784)/BFD()
68
+
raw1 = raw(a)
69
+
raw2 = raw(UDP(raw1))
70
+
assert raw1 == raw2
71
+
72
+
= BFD with Auth flag set - optional_auth should be present
73
+
74
+
p = UDP(b'\x04\x00\x0e\xc8\x00\x29\x72\x31\x20\x44\x05\x21\x00\x00\x00\x01\x00\x00\x00\x00\x00\x0f\x42\x40\x00\x0f\x42\x40\x00\x00\x00\x00\x01\x09\x02\x73\x65\x63\x72\x65\x74\x4e\x0a\x90\x40')
0 commit comments