Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[orchagent] Fix issue: ip prefix shall be inited even if VRF/VNET is not ready #2461

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

Junchao-Mellanox
Copy link
Collaborator

What I did

Fix issue: ip prefix of a route flow pattern shall be initialized even if VRF/VNET is not ready

Why I did it

The issue cause a crash:

Sep 15 13:44:39.986661 sonic INFO swss#supervisord: orchagent terminate called after throwing an instance of 'std::logic_error'
Sep 15 13:44:39.986661 sonic INFO swss#supervisord: orchagent   what():  basic_string::_M_construct null not valid

How I verified it

Manual test and added new unit test.

Details if related

The flow in which IpPrefix had an uninitialized member, consists of:

  1. FlowCounterRouteOrch::addRoutePattern() with 'Vnet1|100.1.1.1/32'

  2. Vnet1 does not exist yet, but the logic of addRoutePattern ignores that, assuming default vrf was meant and due to the way parseRouteKeyForRoutePattern works IpPrefix is left unitialized

  3. Vnet1 is created

  4. Flow counters are enabled, generateRouteFlowStats() -> createRouteFlowCounterByPattern() -> createRouteFlowCounterFromVnetRoutes() is called

  5. Because we inserted a route pattern with defalt vrf id and unititliazed IpPrefix it leads to a crash

@liat-grozovik
Copy link
Collaborator

@Junchao-Mellanox is it required for 202205 as well? if so, need to set label

@Junchao-Mellanox
Copy link
Collaborator Author

Hi @prsunny , could you please help review?

@prsunny prsunny merged commit b9ade5d into sonic-net:master Sep 23, 2022
@Junchao-Mellanox Junchao-Mellanox deleted the fix-orch-crash branch September 24, 2022 00:53
@Junchao-Mellanox
Copy link
Collaborator Author

Hi @yxieca , could you please help cherry-pick to 202205? Thanks

yxieca pushed a commit that referenced this pull request Sep 26, 2022
…not ready (#2461)

*Flexcounter - Fix issue: ip prefix of a route flow pattern shall be initialized even if VRF/VNET is not ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants