UDLD is a Layer 2 protocol that enables devices connected through fiber-optic or twisted-pair Ethernet cables to monitor the physical configuration of the cables and detect when a unidirectional link exists. All connected devices must support UDLD for the protocol to successfully identify and disable unidirectional links. When UDLD detects a unidirectional link, it disables the affected port and alerts you. Unidirectional links can cause a variety of problems, including spanning-tree topology loops.
UDLD uses it’s own keepalives and not STP BPDU keepalives. Cisco propriaity.
Normal mode does not prevent STP loops and is informational only
Aggressive mode prevents STP loops by putting the port into errdisabled state.
For best protection (interface wiring and STP software) use both UDLD and LoopGuard together.
UDLD works great on fiber optic interfaces because of the separate TX and RX. On copper base-T FLP signals track interface status.