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

zebra: Modify how we display/store os description #4220

Merged
merged 1 commit into from
May 1, 2019

Conversation

donaldsharp
Copy link
Member

@donaldsharp donaldsharp commented Apr 28, 2019

The alias/description of an interface in linux was being
used to override the internal description. As such let's
fix the display to keep track of both if we have it.

Config in FRR:

!
interface docker0
 description another combination
!
interface enp3s0
 description BAMBOOZLE ME WILL YOU
!

Config in linux:

sharpd@robot ~/f/zebra> ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    alias This is the loopback you cabbage
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 74:d0:2b:9c:16:eb brd ff:ff:ff:ff:ff:ff
    alias HI HI HI

Now the 'show int descr' command:

robot# show int description
Interface       Status  Protocol  Description
docker0         up      down      another combination
enp3s0          up      up        BAMBOOZLE ME WILL YOU
                                  HI HI HI
lo              up      up        This is the loopback you cabbage

Fixes: #4191
Signed-off-by: Donald Sharp sharpd@cumulusnetworks.com

The alias/description of an interface in linux was being
used to override the internal description.  As such let's
fix the display to keep track of both if we have it.

Config in FRR:
!
interface docker0
 description another combination
!
interface enp3s0
 description BAMBOOZLE ME WILL YOU
!

Config in linux:
sharpd@robot ~/f/zebra> ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    alias This is the loopback you cabbage
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 74:d0:2b:9c:16:eb brd ff:ff:ff:ff:ff:ff
    alias HI HI HI

Now the 'show int descr' command:
robot# show int description
Interface       Status  Protocol  Description
docker0         up      down      another combination
enp3s0          up      up        BAMBOOZLE ME WILL YOU
                                  HI HI HI
lo              up      up        This is the loopback you cabbage

Fixes: FRRouting#4191
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@donaldsharp donaldsharp force-pushed the fix_linux_alias branch 2 times, most recently from e8df4f5 to c74147d Compare April 28, 2019 18:35
@qlyoung qlyoung added the bugfix label Apr 28, 2019
@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 28, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4220 c74147d
Date 04/28/2019
Start 14:40:20
Finish 15:04:08
Run-Time 23:48
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-28-14:40:20.txt
Log autoscript-2019-04-28-14:41:06.log.bz2
Memory 440 443 374

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7397/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 4220, comparing to Git base SHA 9f9e9ef

No Changes in Static Analysis warnings compared to base

12 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7397/artifact/shared/static_analysis/index.html

@FRRouting FRRouting deleted a comment from NetDEF-CI Apr 28, 2019
@FRRouting FRRouting deleted a comment from LabN-CI Apr 28, 2019
@FRRouting FRRouting deleted a comment from NetDEF-CI Apr 28, 2019
@FRRouting FRRouting deleted a comment from LabN-CI Apr 28, 2019
Copy link
Member

@qlyoung qlyoung left a comment

Choose a reason for hiding this comment

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

Some nits, particularly the null checks before free aren't necessary

@@ -707,6 +704,12 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
zif = (struct zebra_if *)ifp->info;
zif->link_ifindex = link_ifindex;

if (desc) {
if (zif->desc)
XFREE(MTYPE_TMP, zif->desc);
Copy link
Member

Choose a reason for hiding this comment

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

No need for the null check here.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

zif = ifp->info;
if (zif) {
if (zif->desc)
XFREE(MTYPE_TMP, zif->desc);
Copy link
Member

Choose a reason for hiding this comment

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

Same thing

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -181,6 +181,8 @@ static int if_zebra_delete_hook(struct interface *ifp)
list_delete(&rtadv->AdvDNSSLList);
#endif /* HAVE_RTADV */

if (zebra_if->desc)
XFREE(MTYPE_TMP, zebra_if->desc);
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

struct zebra_if *zif;
bool intf_desc;

intf_desc = false;
Copy link
Member

Choose a reason for hiding this comment

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

bool intf_desc = false ?

Copy link
Member Author

Choose a reason for hiding this comment

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

intf_desc was being set to false once with the bool intf_desc = false why? I am not sure as that was a bit surprising too me. So I just moved it down one line to ensure it was reset at the top of the loop every time.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Apr 30, 2019

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/4220 ba5165e
Date 04/29/2019
Start 20:40:22
Finish 21:04:08
Run-Time 23:46
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2019-04-29-20:40:22.txt
Log autoscript-2019-04-29-20:41:08.log.bz2
Memory 449 442 374

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7406/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 4220, comparing to Git base SHA e07daf5

No Changes in Static Analysis warnings compared to base

12 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-7406/artifact/shared/static_analysis/index.html

@donaldsharp donaldsharp deleted the fix_linux_alias branch April 30, 2019 12:17
@donaldsharp donaldsharp restored the fix_linux_alias branch April 30, 2019 12:18
@donaldsharp donaldsharp reopened this Apr 30, 2019
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

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

looks like everything is fixed on this one, and the code is fine

@riw777 riw777 merged commit e5f4e84 into FRRouting:master May 1, 2019
@donaldsharp donaldsharp deleted the fix_linux_alias branch December 9, 2019 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants