-
Notifications
You must be signed in to change notification settings - Fork 580
Adding vrrpsyncd module #3313
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
base: master
Are you sure you want to change the base?
Adding vrrpsyncd module #3313
Conversation
@philo-micas @madhupalu please help review |
@vvbrcm can you please confirm if you are planning to extend this PR only to accomodate vrrporch related changes too? |
@philo-micas vrrpsyncd needs to be spawned from the supervisord.conf of swss container. Thus, are you planning to add this in PR#18617 itself? |
vrrpsyncd/vrrpsync.cpp
Outdated
} | ||
else | ||
{ | ||
family = "ipv4"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable doesn't seem to be used while creating a key for VRRP_TABLE as per HLD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove the unused variable 'family'.
@vvbrcm I quickly tested this implementation but it seems something is still missing as the VRRP_TABLE is not getting created in the APPL_DB even though vrrpsyncd received the system MAC.
|
if (afi == AF_INET6) | ||
{ | ||
family = "ipv6"; | ||
len = "/128"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this len variable ? Shouldn't it represent IP interface subnet ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The primary interface on which VRRP is running will add the interface address with interface subnet. VRRP VIP on the macvlan interface will be an IP address with mask /32(IPv4) or /128 (IPv6).
vrrpsyncd/Makefile.am
Outdated
if DEBUG | ||
DBGFLAGS = -ggdb -DDEBUG | ||
else | ||
DBGFLAGS = -ggdb -DDEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be "DBGFLAGS = -g"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, changed it.
vrrpsyncd/vrrpsync.cpp
Outdated
} | ||
|
||
|
||
void VrrpSync::VrrpUpdateNetdevFlags(string &ifname, int afi, bool up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the third arg (up) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove it.
vrrpsyncd/vrrpsyncd.cpp
Outdated
Selectable *temps; | ||
int ret; | ||
|
||
using namespace std::chrono; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this?
vrrpsyncd/vrrpsync.cpp
Outdated
if ((nlmsg_type == RTM_DELLINK) || (nlmsg_type == RTM_DELADDR)) | ||
delete_key = true; | ||
|
||
delete_key = delete_key; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove it
vrrpsyncd/vrrpsync.cpp
Outdated
if (!ifname) | ||
return false; | ||
|
||
if (strncmp(ifname, "vrrp", 4)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must be "Vrrp" as the interface name will be
"Vrrp-<af>-<vrrp_instance_number>".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From FRR the macvlan interface name was thought to be of the format vrrp-afi-instance ex vrrp4-2-1.
@philo-micas, can you please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Macvlan device name starting with 'Vrrp4-' or 'Vrrp6-', ex Vrrp4-5 and Vrrp6-5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
vrrpsyncd/vrrpsync.cpp
Outdated
|
||
VrrpDbUpdate(ifname, key, m_vrrpinfo[key].parent_ifname, afi, vip, m_vrrpinfo[key].vmac, false); | ||
|
||
VrrpUpdateVipNbr(ifname, m_vrrpinfo[key].parent_ifname, afi, vip, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the indent here please, and there are also same issues below.
vrrpsyncd/vrrpsync.cpp
Outdated
} | ||
|
||
|
||
void VrrpSync::VrrpUpdateNetdevFlags(string &ifname, int afi, bool up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why it is implemented in vrrpsyncd instead of macvlanmgrd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for vrrp parent interface. Is this same logic present in macvlanmgrd? Is so, it could be removed.
vrrpsyncd/vrrpsync.h
Outdated
struct vrrpmacip | ||
{ | ||
unsigned int if_state; | ||
std::string ifname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please correct the alignments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
int ret; | ||
string afi_str = (afi == AF_INET6)? "-6": ""; | ||
|
||
cmd = "ip " + afi_str + " neigh flush " + vip + " dev " + ifname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it needs to be done only for op = "del".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, had written it generically to del/replace. Currently only del is used.
} | ||
|
||
|
||
void VrrpSync::VrrpUpdateNbr(string &ifname, int afi, string &vip, string &op) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the op parameter has not been used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, had written it generically to del/replace. Currently only del is used.
has done. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I left a comment and I hope it is useful and not out of context!
Regards,
m_cfgDeviceMetadataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME) | ||
{ | ||
m_nl_sock = nl_socket_alloc(); | ||
nl_connect(m_nl_sock, NETLINK_ROUTE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is required because vrrpsync
needs to directly handle the netlink socket and if somenthing is missing from swss-common
side my suggestion is to focus the effort in such library (netdispatcher
and friends).
Anyway, if my previous comment is not correct, I think we want to:
- Manage the case where
m_nl_sock
is NULL - Allocate a
rx
andtx
buffer or specify 0,0 to enforce the default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other matches into sonic-swss
repo:
cfgmgr/nbrmgr.cpp:54: m_nl_sock = nl_socket_alloc();
cfgmgr/nbrmgr.cpp:59: else if ((err = nl_connect(m_nl_sock, NETLINK_ROUTE)) < 0)
fpmsyncd/routesync.cpp:86: m_nl_sock = nl_socket_alloc();
fpmsyncd/routesync.cpp:87: nl_connect(m_nl_sock, NETLINK_ROUTE);
/azpw run Azure.sonic-buildimage |
/AzurePipelines run Azure.sonic-buildimage |
No pipelines are associated with this pull request. |
/azpw run |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
/azpw run Azure.sonic-swss |
/AzurePipelines run Azure.sonic-swss |
Azure Pipelines successfully started running 1 pipeline(s). |
What I did
Add module vrrpsyncd to program VRRP entities (VIP and VMAC) from kernel to APP_DB
Why I did it
Support VRRP component
How I verified it
UT
Details if related