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

Natsyncd changes in sonic-swss submodule to support NAT feature. #1126

Merged
merged 3 commits into from
Jan 19, 2020

Conversation

AkhileshSamineni
Copy link
Contributor

@AkhileshSamineni AkhileshSamineni commented Nov 11, 2019

Added natsyncd and warmboot related changes.

Link to NAT HLD : https://github.com/Azure/SONiC/blob/master/doc/nat/nat_design_spec.md

Depends on:
sonic-swss : #1059 and #1125
sonic-swss-common : sonic-net/sonic-swss-common#304
sonic-linux-kernel : sonic-net/sonic-linux-kernel#100
sonic-sairedis : sonic-net/sonic-sairedis#519

{
m_AppRestartAssist = new AppRestartAssist(pipelineAppDB, "neighsyncd", "swss", DEFAULT_NEIGHSYNC_WARMSTART_TIMER);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can please elaborate why we need the changes in neighsyncd and warmrestartAssist ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arlakshm The AppRestartAssist class was handling the reconciliation logic only for a single app-db table. This class is enhanced to handle reconciliation logic for multiple app-db tables, if the user of this class is the producer for multiple app-db ables as in the case of NAT. Earlier neighsyncd is the producer for a single app-db table and passing the app-db table to AppRestartAssist. Since this class is enhanced now, neighsyncd code is modified to call the new APIs.

/* If a matching Static NAPT entry exists in the APP_DB,
* it has higher priority than the dynamic napt entry. */
SWSS_LOG_INFO("SNAPT %s: static entry exists, not processing the NAPT notification", opStr.c_str());
if (m_AppRestartAssist->isWarmStartInProgress())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition may not be hit ? on the top we are checking if (! m_AppRestartAssist->isWarmStartInProgress())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is dead code, will remove it.

}
else
{
if (m_AppRestartAssist->isWarmStartInProgress())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is dead code, will remove it.

* - If SNAPT and DNAPT conditions are met or if there is no static
* or dynamic Twice NAT entry, then it is a Twice NAPT entry.
*/
int NatSync::addNatEntry(struct nfnl_ct *ct, struct naptEntry &entry, bool addFlag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are lot of DB gets and checks being done in this function. Will there be a performance impact in-terms of Netlink message loss, when the scale is high ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per NAT entry, atmost 2 db gets are done and not seen netlink message loss with 600 pps traffic.
DB gets are done to avoid storing another copy of nat tables (apart from appl_db) within natsyncd.

nfnl.registerGroup(NFNLGRP_CONNTRACK_UPDATE);
nfnl.registerGroup(NFNLGRP_CONNTRACK_DESTROY);

cout << "Listens to conntrack messages..." << endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SWSSLOG

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{
/* If a matching Static Twice NAT entry exists in the APP_DB,
* it has higher priority than the dynamic twice nat entry. */
if ((fvField(iter) == "entry_type") && (fvValue(iter) == "static"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was it even trapped if a static entry exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For static snat entry, the packet can come up in case of h/w L3 destination lookup failure. To handle such cases, we need the SNAT rule for static entry in the iptables.

AkhileshSamineni added a commit to AkhileshSamineni/sonic-swss that referenced this pull request Dec 10, 2019
 - Added natsyncd and warmboot related changes.

Link to NAT HLD : https://github.com/Azure/SONiC/blob/master/doc/nat/nat_design_spec.md

Depends on:
sonic-swss :
sonic-swss-common : sonic-net/sonic-swss-common#304
sonic-linux-kernel : sonic-net/sonic-linux-kernel#100
sonic-sairedis : sonic-net/sonic-sairedis#519
Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
@AkhileshSamineni
Copy link
Contributor Author

Retest this please.

@arlakshm arlakshm self-requested a review December 20, 2019 19:03
@AkhileshSamineni
Copy link
Contributor Author

retest this please.

@AkhileshSamineni
Copy link
Contributor Author

Retest this please.

2 similar comments
@AkhileshSamineni
Copy link
Contributor Author

Retest this please.

@AkhileshSamineni
Copy link
Contributor Author

Retest this please.

@rlhui rlhui merged commit bbd77fc into sonic-net:master Jan 19, 2020
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
Add the missing import of `netaddr` for `show ip interfaces`.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
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.

6 participants