Add STP loop guard support#88
Conversation
Signed-off-by: Salah Adel <salah-adel2011@hotmail.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Hello, @divyachandralekha @wajahatrazi @lihuay Could you please review and merge this PR? It adds STP loop guard support and is a dependency for sonic-swss#4517 [already merged] and sonic-utilities#4495 [under review], Thanks |
|
@salahadell Hi, thanks for mentioning, will review and reply. Thanks |
Hi @wajahatrazi, just following up on your earlier message, happy to hear any feedback or address questions whenever you get a chance. Let me know if there's anything I can do to help move this along. Thanks again! |
@wajahatrazi Hello, hope you are good, any updates? |
| if (pmsg->enabled) | ||
| { | ||
| stpmgr_config_root_protect(port_id, pmsg->root_guard); | ||
| stpmgr_config_loop_protect(port_id, pmsg->loop_guard); |
There was a problem hiding this comment.
This PR currently implements only PVST. Could we consider implementing MSTP support as well?
| stp_port_class = GET_STP_PORT_CLASS(stp_class, port_number); | ||
| stp_port_class->self_loop = false; | ||
|
|
||
| /* Loop Guard: if configured on a non-designated port, enter loop-inconsistent |
There was a problem hiding this comment.
What if a port has both loop_guard_active AND root_protect_timer active simultaneously? How does that being handled?
| return; | ||
| } | ||
|
|
||
| // Loop Guard: if port is in loop-inconsistent state and receives a BPDU, recover |
There was a problem hiding this comment.
What BPDU qualifies for recovery? Any BPDU?
Summary
Add STP Loop Guard support to
sonic-stpand wire it through manager, runtime state handling, and APP_DB sync.Motivation
When expected BPDUs are lost on non-designated ports, the port should not transition unsafely toward forwarding, potentially creating Layer-2 loops, and broadcast storms.
Loop Guard keeps the port in loop-inconsistent state until recovery conditions are met.
Changes
Behavior
LOOP-INC.LOOP-INCclears stale state and triggers immediate STP state re-evaluation.Files Updated
include/stp.hinclude/stp_ipc.hinclude/stp_dbsync.hstp/stp.cstp/stp_mgr.cstp/stp_util.cstp/stp_data.cstp/stp_debug.cstpsync/stp_sync.cppValidation
LOOP-INCwhen BPDUs stopped.Related PRs