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

[linksync] Netdev oper status determination using IFF_RUNNING #1568

Merged
merged 1 commit into from
Mar 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)

unsigned int flags = rtnl_link_get_flags(link);
bool admin = flags & IFF_UP;
bool oper = flags & IFF_LOWER_UP;
bool oper = flags & IFF_RUNNING;
Copy link
Collaborator

Choose a reason for hiding this comment

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

For e.g, this interface has LOWER_UP but state is UNKNOWN. Will it have IFF_RUNNING set?

58: Loopback0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 96:a7:77:d1:73:34 brd ff:ff:ff:ff:ff:ff

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. Linux command "ip link show" does not show it here. The bgp "show interface" will show this flag. Here is an example of interface info got by linux command and bgp command.

admin@Linecard2:~$
admin@Linecard2:~$ ip link show | grep -A1 Loopback0
10: Loopback0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether f6:55:7a:eb:85:eb brd ff:ff:ff:ff:ff:ff
admin@Linecard2:~$
admin@Linecard2:~$ docker exec bgp vtysh -c "show interface" | grep -A12 Loopback0
Interface Loopback0 is up, line protocol is up
Link ups: 1 last: 2019/03/02 21:32:48.16
Link downs: 0 last: (never)
vrf: default
index 10 metric 0 mtu 65536 speed 0
flags: <UP,BROADCAST,RUNNING,NOARP>
Type: Unknown
HWaddr: f6:55:7a:eb:85:eb
inet 10.1.0.1/32 unnumbered
inet6 fe80::f455:7aff:feeb:85eb/64
inet6 fc00:10::1/128
Interface Type Other
Interface Slave Type None
admin@Linecard2:~$


char addrStr[MAX_ADDR_SIZE+1] = {0};
nl_addr2str(rtnl_link_get_addr(link), addrStr, MAX_ADDR_SIZE);
Expand Down