stp: Fix IPC layout and netlink handling between STPMGR and STP daemon - #97
stp: Fix IPC layout and netlink handling between STPMGR and STP daemon#97rdhegde wants to merge 7 commits into
Conversation
- Packed stp IPC structures - Added missing parameter `loop_guard` to align with swss(stpmgr) - Renamed parameters: `edge` and `max_hop` to align with swss(stpmgr) - Renamed MST_INST_CONFIG_MSG to STP_MST_INST_CONFIG_MSG for consistency Signed-off-by: Ram Hegde <rhegde@marvell.com>
- fix socket return handling - remove unused variable Signed-off-by: Ram Hegde <rhegde@marvell.com>
Signed-off-by: Ram Hegde <rhegde@marvell.com>
- uninitialized if_db.ifname is not handled before calling stp_netlink_cb() Signed-off-by: Ram Hegde <rhegde@marvell.com>
Signed-off-by: Ram Hegde <rhegde@marvell.com>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/easycla |
* In stpmgr_process_rx_bpdu(), when PVST BPDUs has no VLAN get the port's untagged VLAN * Fixed typos in code comments Signed-off-by: Ram Hegde <rhegde@marvell.com>
1aa8c23 to
334e762
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
PVST test report |
| } | ||
|
|
||
| // sanity checks | ||
| if (!IS_VALID_VLAN(vlan_id)) |
There was a problem hiding this comment.
Move if (!IS_VALID_VLAN(vlan_id)) inside else case
There was a problem hiding this comment.
Move if (!IS_VALID_VLAN(vlan_id)) inside else case
Updated as suggested
| { | ||
| // When BPDUs arrive without VLAN get the VLAN from port's untagged vlan | ||
| // configuration. | ||
| if ( vlan_id == 0 ) { |
There was a problem hiding this comment.
Remove this if case. vlan decision is made inside stpmgr_rx_stp_bpdu.
There was a problem hiding this comment.
Remove this if case. vlan decision is made inside stpmgr_rx_stp_bpdu.
Moved the vlan_id resolution code in stpmgr_rx_pvst_bpdu(). The current code accessed vlan_id even before it was populated.
| if_db.ifname, if_db.kif_index, if_db.oper_state, | ||
| if_db.is_bond, if_db.is_member, if_db.master_ifindex); | ||
|
|
||
| stp_netlink_cb( &if_db, |
There was a problem hiding this comment.
if rt_list[IFLA_IFNAME] is not set , how RTM_NEWLINK is handled ?
This portion of code changes are not required. I dnt see any issue with RTM_DELLINK when IFLA_IFNAME is not set. stp_netlink_cb is done outside of if(rt_list[IFLA_IFNAME] ) condition. please check.
There was a problem hiding this comment.
if rt_list[IFLA_IFNAME] is not set , how RTM_NEWLINK is handled ? This portion of code changes are not required. I dnt see any issue with RTM_DELLINK when IFLA_IFNAME is not set. stp_netlink_cb is done outside of if(rt_list[IFLA_IFNAME] ) condition. please check.
The current call to stp_netlink_cb() is outside nlmsg_type check which means it would be called for anything other than add and del also. I just re-arragned the code for correctness such that add is called only with valid if_name while del can be called without it.
| } PORT_ATTR; | ||
| // Add padding to align to 4 bytes | ||
| uint16_t padding; | ||
| } __attribute__((packed)) PORT_ATTR; |
There was a problem hiding this comment.
if there is a similar header file in swss repo, please change that also.
There was a problem hiding this comment.
I have removed the duplicate header definition from swss and made it use stp_ipc.h. Please look at the changes from sonic-net/sonic-swss#4790
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
e33347c to
d278f50
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: Ram Hegde <rhegde@marvell.com>
d278f50 to
ac07371
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Summary
single, packed definition with all required fields.
unexpected protocol modes.
stp_netlink_recv()passing an invalidif_db/ ifname intostp_netlink_cb().Motivation
PVST configuration fails when STPMGR and the STP daemon exchange
inconsistent or incomplete IPC data, or when netlink callbacks operate on
invalid interface state. This PR fixes the daemon-side IPC and netlink
handling required for PVST to work reliably.
Part of PVST fix series for #28624.
Changes
stp_intf_netlink_cb()stpmgr_process_ipc_msg()for unexpected protocol modesstp_netlink_recv()callingstp_netlink_cb()with invalidif_db/ ifnameRelated PRs
Verification
sonic-vs): config reached STP daemon,PVST converged
Notes for reviewers
with sonic-swss#4790