-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Create Staticd #2122
Create Staticd #2122
Conversation
I pushed this up so that I could easily get an idea of what would fail on redhat and to get an idea of what might fail in our topotests. I know I need to write some documentation and work on some basic static route testing. |
Assigned to myself to verify the ANVL failures and fix the ANVL scripts to work with the new staticd |
Hello, |
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.
While trying to adopt topotests, I found the following issue:
If the user is still using per-daemon config files and upgrades to this version, then all static routes get lost (as they are stored in zebra.conf
and not in staticd.conf
)
One possibility to work around this is if there is no staticd.conf and non-integrated configs are used, then staticd could parse (and read the statics) from zebra.conf.
Or maybe there are better choices?
(Topotests has this issue as well as it uses per-daemon configs and not the integrated config)
@donaldsharp ANVL (Protocol Compliance) Tests are updated to support staticd |
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.
Thanks for doing this work! Moving static routes to a separate daemon is certainly the right thing to do. I love how we were able to remove a considerable amount of complexity from zebra, especially in the NHT code. staticd itself looks great but I think we can simplify it even further later (please check #1819 (comment)). For now I think this's already a huge step forward.
I found s few small problems so please check my inline comments.
staticd/static_main.c
Outdated
bool mpls_enabled; | ||
|
||
zebra_capabilities_t _caps_p[] = { | ||
ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, |
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 believe staticd doesn't need any of these capabilities.
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 believe you are right. removed.
staticd/static_nht.c
Outdated
if (!stable) | ||
return; | ||
|
||
zlog_debug("Nexthop num: %d", nh_num); |
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.
Unguarded debug.
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.
staticd/static_nht.c
Outdated
si->nh_valid = !!nh_num; | ||
|
||
if (orig != si->nh_valid) { | ||
zlog_debug("Install the matching si"); |
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.
Unguarded debug.
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
staticd/static_zebra.c
Outdated
struct zapi_route nhr; | ||
afi_t afi = AFI_IP; | ||
|
||
zapi_nexthop_update_decode(zclient->ibuf, &nhr); |
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.
Need to check the return value.
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
staticd/static_zebra.c
Outdated
case STATIC_IPV4_GATEWAY_IFNAME: | ||
case STATIC_IFNAME: | ||
case STATIC_BLACKHOLE: | ||
case STATIC_IPV6_GATEWAY_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 think fully specified static routes (STATIC_IPV4_GATEWAY_IFNAME
and STATIC_IPV6_GATEWAY_IFNAME
) should also register their nexthops to zebra. Any reason for not doing so?
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 disagree, we were not registering NEXTHOP_TYPE_IPV4_IFNAME and NEXTHOP_TYPE_IPV6_IFNAME before. They can have no recursion since we are fully specifying the gateway and ifindex.
staticd/static_zebra.c
Outdated
memset(&api, 0, sizeof(api)); | ||
api.vrf_id = vrf_id; | ||
api.type = ZEBRA_ROUTE_STATIC; | ||
api.safi = SAFI_UNICAST; |
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.
Question: shouldn't this be SAFI_MULTICAST
for routes configured with ip mroute
?
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.
yep fixed.
api_nh->gate = si->addr; | ||
break; | ||
case STATIC_IPV4_GATEWAY_IFNAME: | ||
if (si->ifindex == IFINDEX_INTERNAL) |
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 think we need to check if si->nh_valid
is true here too (this is related to my other comment about fully-specified static routes).
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 disagree, NEXTHOP_TYPE_IPV4_IFINDEX cannot be not valid. They are by definition valid.
zebra/zebra_static.c
Outdated
@@ -21,812 +21,3 @@ | |||
*/ | |||
#include <zebra.h> | |||
|
|||
#include <lib/nexthop.h> |
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.
Any reason for not removing this file?
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.
Yeah I can remove.
uint32_t table_id; | ||
char buf[PREFIX_STRLEN]; | ||
|
||
prefix2str(&p, buf, sizeof(buf)); |
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 think CS will complain because this buffer and other things in this function are being set but not 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.
correct, this was the start of some code I needed to finish up. Finished up.
staticd/static_routes.c
Outdated
static_zebra_nht_register(si, true); | ||
|
||
si = rn->info; | ||
static_zebra_route_add(rn, si->vrf_id, 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.
On my tests staticd segfaults in this line (si
is NULL
) if I do this:
debian(config)# ip route 50.0.0.0/8 10.0.1.2
debian(config)# ip route 60.0.0.0/8 50.0.0.1
debian(config)#
root@debian:~#
root@debian:~# ip link add vrf-red type vrf table 10
root@debian:~# ip link set dev vrf-red up
root@debian:~# ip link set dev rt1-eth0 master vrf-red
Could you check what's the problem here?
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
@pguibert6WIND I will add some documentation to this PR. I thought I had done so. apparently not. |
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.
Mostly just source file license headers need to be changed.
staticd/static_main.c
Outdated
* Copyright (C) 2018 Cumulus Networks, Inc. | ||
* Donald Sharp | ||
* | ||
* FRR is free software; you can redistribute it and/or modify it |
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 use the header given in the dev docs.
http://frrouting.readthedocs.io/projects/dev-guide/en/latest/workflow.html#source-file-header
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.
staticd/static_memory.c
Outdated
* Copyright (C) 2018 Cumulus Networks, Inc. | ||
* Donald Sharp | ||
* | ||
* FRR is free software; you can redistribute it and/or modify it |
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.
license header
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
staticd/static_nht.c
Outdated
* Copyright (C) 2018 Cumulus Networks, Inc. | ||
* Donald Sharp | ||
* | ||
* FRR is free software; you can redistribute it and/or modify it |
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.
License header
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 all headers
staticd/static_routes.h
Outdated
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2, or (at your option) any | ||
* later version. | ||
* | ||
* Quagga is distributed in the hope that it will be useful, but |
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.
Since we're changing this, wanna replace the whole header?
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 just removed the files, instead
staticd/static_vrf.c
Outdated
* Copyright (C) 2018 Cumulus Networks, Inc. | ||
* Donald Sharp | ||
* | ||
* FRR is free software; you can redistribute it and/or modify it |
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.
license header
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.
staticd/static_vty.c
Outdated
"%% Malformed source address\n"); | ||
else | ||
zlog_warn( | ||
"%s: Malformed Source address: %s", |
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.
Source
vs source
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
There will be two changes to think of.
|
I've already started the work for this communication via the ZEBRA_CAPABILITIES message. Feel free to start adding to it. |
I've updated to latest and brought in the changes in zebra that were moved. Have I missed anything? |
7046d38
to
4e4a742
Compare
As part of moving the static route handling to it's own daemon allow zebra to accept static route types from upper level protocols. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This is the start of separating out the static handling code from zebra -> staticd. This will help simplify the zebra code and isolate static route handling to it's own code base. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Add code to allow FRR to properly build and handle the staticd for some of the more common packaging. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
When the user is not using the integrated config and has upgraded to a version of FRR with staticd, that probably means that static routes are stored in zebra.conf. Take advantage of the backup backup config option and read those in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
These are no longer needed so remove. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Existing NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX routes allow recursion, but were broken when the route happened to recursively resolve and the resolution nexthop changed. This commit fixes this issue. Please note that this issue was in pre-move of static route handling to it's own daemon as well. This was some easy low-hanging fruit, so to speak. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Remove the ip route specific sections from zebra documenation and create a specific one for the new staticd. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
1) Conform staticd to proper gnu gpl file format. 2) Fix a spelling mistake found. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Allow protocols to specify to zebra that they would like zebra to use the distance passed down as part of determine sameness for Route Replace semantics. This will be used by the static daemon to allow it to have backup static routes with greater distances. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Modify staticd to allow it to have backup static routes with higher admin distance. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Move the call to the static_install_route to inside of the loop, since we have changed the behavior of how we send down routes to zebra a bit. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
When we read in a backup file, we should save the original host.config so that we can put it back to the correct original location after we read in the backup config. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
CI found a couple of warnings that needed to be cleaned up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@louberger when I remove that space the script generates a different error. Known issue with it there. I'm consistent with other places in the code for that structure |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
any chance you can fix the script as part of the PR? If not I guess
need to create a PR and assign to ql...
…On 7/29/2018 1:09 PM, Donald Sharp wrote:
@louberger <https://github.com/louberger> when I remove that space the
script generates a different error. Known issue with it there. I'm
consistent with other places in the code for that structure
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2122 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGRWyAuiVBey0UqHBnq3iSN1eerf5hO9ks5uLewsgaJpZM4TkXPH>.
|
|
||
static int static_vrf_disable(struct vrf *vrf) | ||
{ | ||
return 0; |
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 happens when a VRF is disabled and the ID is reused for another VRF? We're not clearing out the VRF ID that was set in static_vrf_enable()
, is it possible to get conflicts here or is it OK to keep the IDs cached?
(Also, the answer to this question should be a code comment here because it'll be hard to understand when someone else looks at this in a year...)
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.
well it will never be reused( at least most likely will never be reused as that it's a uint32_t number that is increased monotomically per new interface ), I think your point stands though.
What the vrf code does, as I recall, if we shutdown the vrf we disable routes and when it is turned back on we scan the code base and fixup the nhop vrf id's.( at least that is what I recall programming for static routes 4-5 months back ). All daemons that are vrf aware are probably going to have to be aware of this though.
@louberger I'm not currently interested in fixing that script. We can file an issue and get it addressed though. I'm not sure what the answer is because I think it's valid code either way. |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-4663/ This is a comment from an EXPERIMENTAL automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings:
CLANG Static Analyzer Summary
Fixed warnings:
Static Analysis warning summary compared to base:
4 Static Analyzer issues remaining.See details at |
If it's valid either way the script needs to be fixed to allow for it. Just
open an issue, note it in this PR, and let's move on. I'm not the style
police, but we do have a tools based process that needs to work in order
for it to be of value.
…----------
On July 30, 2018 8:21:45 AM Donald Sharp ***@***.***> wrote:
@louberger I'm not currently interested in fixing that script. We can file
an issue and get it addressed though. I'm not sure what the answer is
because I think it's valid code either way.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#2122 (comment)
|
The fix (and correct thing to do here) is to make it
The rationale for this is, both for the In general, writing lists and struct initializers with a trailing comma and a newline before the closing Other than that: LGTM, please add the linebreak and merge ASAP :) |
Just add a linebreak. Signed-off-by: David Lamparter <equinox@diac24.net>
Actually went and pushed the fix on your repo (you had "allow maintainers to push changes" ticked :D), let's see if the script still spits an error :) |
💚 Basic BGPD CI results: SUCCESS, 0 tests failedResults table
For details, please contact louberger |
Continuous Integration Result: SUCCESSFULCongratulations, this patch passed basic tests Tested-by: NetDEF / OpenSourceRouting.org CI System CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-4766/ This is a comment from an EXPERIMENTAL automated CI system. Warnings Generated during build:Checkout code: Successful with additional warnings:
CLANG Static Analyzer Summary
Fixed warnings:
Static Analysis warning summary compared to base:
4 Static Analyzer issues remaining.See details at |
Prepare for timing changes seen in FRRouting#2122
Remove the handling of static routes from zebra into it's own daemon