summaryrefslogtreecommitdiffstats
path: root/zebra/zapi_msg.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zebra: set NHG/backup NHG pointers on success zapi readStephen Worley2020-09-281-6/+11
| | | | | | | | Only set the NHG/backup NHG pointers of the caller if the read of the nexthops was successfull. Otherwise, we might free when not neccessary or double free. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib,zebra,sharpd: add code for backup proto-NHs but disabledStephen Worley2020-09-281-53/+99
| | | | | | | | | | | | Add the zapi code for encoding/decoding of backup nexthops for when we are ready for it, but disable it for now so that we revert to the old way with them. When zebra gets a proto-NHG with a backup in it, we early fail and tell the upper level proto. In this case sharpd. Sharpd then reverts to the old way of installation with the route. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: add type to nhg_prot_del API for sanity checkStephen Worley2020-09-281-1/+1
| | | | | | | | Add type to the nhg_proto_del API params for sanity checking that the types of the route sent by the proto matches the type found with the ID. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra,sharpd: checkpatch fixesStephen Worley2020-09-281-2/+2
| | | | | | Check patches fixes for NHG API pathes. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib,zebra,sharpd: clang formatStephen Worley2020-09-281-29/+30
| | | | | | Clang format for NHG API and sharpd patches. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: clean up the NHG proto zapi code a bitStephen Worley2020-09-281-8/+4
| | | | | | | Clean up the function names and remove some TODOs that are no longer needed/hacks we used for testing. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: multipath number checks with NHG protoStephen Worley2020-09-281-10/+9
| | | | | | | | | | Get the multipath number checks working with proto-based NHG message decoding in zapi_msg.c Modify the function that checks this for routes to work without being passed a prefix as is the case with NHG creates. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib,zebra: fixup NHG notify zapi messagingStephen Worley2020-09-281-2/+2
| | | | | | | Make the message parameters align better with other zapi notifications and change the ID to correctly be a uint32. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: fix refcnt/rib issues in NHG replace/deleteStephen Worley2020-09-281-2/+0
| | | | | | | | | | | | | | | Fix some reference counting issues seen when replacing a NHG and deleting one. For replacement, we should end with the same refcnt on the new one. For delete, its the caller's job to decrement its ref after its done with it. Further, update routes in the rib with the new pointer after replace. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: warn if zapi NHG add has no nexthopsStephen Worley2020-09-281-0/+6
| | | | | | | Log a warning and return if we receive a NHG add via zapi that has no nexthops. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: inc/dec refcount on add/del NHG protoStephen Worley2020-09-281-1/+3
| | | | | | | | | | When we add a proto NHG, increment the refcount, when we del a proto NHG, decrement the refcount rather than deleting it explicitly. If the upper level proto is handling it properly, it should get decremented to zero when we receive a NHG del. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: fix route validity check with NHG IDStephen Worley2020-09-281-7/+7
| | | | | | | | | | Fix check in zread where we determine validity of a route based on reading in nexthops/checking ID is present. We had a bad conditional that was determining a route is bad if its not NHG ID based. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: use the passed proto from zapiStephen Worley2020-09-281-1/+1
| | | | | | | | We were hard coding proto bgp for use with the NHG creation. Use the actual passed one from zapi now that it exists. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: handle zapi routes with NHG ID setStephen Worley2020-09-281-15/+16
| | | | | | | | | | Add code to properly handle routes sent with NHG ID rather than a nexthop_group. For now, we separate this from backup nexthop handling since that should probably be added to the nhg_proto_add calls. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* zebra: implement protocol NHG Add/DelStephen Worley2020-09-281-6/+32
| | | | | | | | | | | | | | | | | | | Implement the underlying zebra functionality to Add/Del an internal zebra and kernel NHG. These NHGs are managed by the upperlevel protocols that send them down via zapi messaging. They are not put into the overall zebra NHG hash table and only put into to the ID table. Therefore, different protos cannot and will not share NHGs. The proto is also set appropriately when sent to the kernel. Expand the separation of Zebra hashed/shared/created NHGs and proto created and mangaged NHGs. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* lib, zebra: Add ability to send down a nhgid over route installDonald Sharp2020-09-281-5/+17
| | | | | | | Modify the send down of a route to use the nexthop group id if we have one associated with the route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Add ZAPI_NHG_ADD|DELETEDonald Sharp2020-09-281-26/+135
| | | | | | | | | | | | | | | | | | | Add the ability to send a NHG from an upper level protocol down to zebra. ZAPI_NHG_ADD encompasses both the addition and replace semantics ( If the id passed down does not exist yet, it's Add, else it's a replace ). Effectively zebra will take this nhg passed down save the nhg in the id hash for nhg's and then create the appropriate nhg's and finally install them into the linux kernel. Notification will be the ZAPI_NHG_NOTIFY_OWNER zapi message for normal success/failure messaging to the installing protocol. This work is being done to allow us to work with EVPN MH which needs the ability to modify NHG's that BGP will own and operate on. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Refactor nexthop reading from zapi messagesDonald Sharp2020-09-281-152/+127
| | | | | | | | Take the zebra code that reads nexthops and combine it into one function so that when we add zapi messages to send/receive nexthops we can take advantage of this function. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Convert zserv_nexthop_num_warn to return boolDonald Sharp2020-09-281-2/+4
| | | | | | Allow us to key of the warning if we have one. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* bgpd, lib, pbrd, zebra: Pass by ifnameDonald Sharp2020-09-121-15/+5
| | | | | | | | | | | | | | | | | | When installing rules pass by the interface name across zapi. This is being changed because we have a situation where if you quickly create/destroy ephermeal interfaces under linux the upper level protocol may be trying to add a rule for a interface that does not quite exist at the moment. Since ip rules actually want the interface name ( to handle just this sort of situation ) convert over to passing the interface name and storing it and using it in zebra. Ticket: CM-31042 Signed-off-by: Stephen Worley <sworley@nvidia.com> Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* Merge pull request #6974 from liron-ze/high-cpu-usageRenato Westphal2020-09-111-0/+14
|\ | | | | zebra: Solve the problem of high CPU and memory usage when creating t…
| * zebra: Solve the problem of high CPU and memory usage when creating ↵liuze2020-08-261-0/+14
| | | | | | | | | | | | thousands of vrf Signed-off-by: liuze <liuze@asterfusion.com>
* | zebra: When shutting down an interface immediately notify about rnhDonald Sharp2020-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Imagine a situation where a interface is bouncing up/down. The interface comes up and daemons like pbr will get a nht tracking callback for a connected interface up and will install the routes down to zebra. At this same time the interface can go down. But since zebra is busy handling route changes ( from pbr ) it has not read the netlink message and can get into a situation where the route resolves properly and then we attempt to install it into the kernel( which is rejected ). If the interface bounces back up fast at this point, the down then up netlink message will be read and create two route entries off the connected route node. Zebra will then enqueue both route entries for future processing. After this processing happens the down/up is collapsed into an up and nexthop tracking sees no changes and does not inform any upper level protocol( in this case pbr ) that nexthop tracking has changed. So pbr still believes the nexthops are good but the routes are not installed since pbr has taken no action. Fix this by immediately running rnh when we signal a connected route entry is scheduled for removal. This should cause upper level protocols to get a rnh notification for the small amount of time that the connected route was bouncing around like a madman. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge pull request #6989 from xThaid/remove_fuzzingQuentin Young2020-08-271-27/+0
|\ \ | | | | | | zebra: remove fuzzing stuff
| * | zebra: remove fuzzing stuffJakub Urbańczyk2020-08-251-27/+0
| |/ | | | | | | | | | | | | | | | | The fuzzing code that is in the master branch is outdated and unused, so it is worth to remove it to improve readablity of the code. All the code related to the fuzzing is in the `fuzz` branch. Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
* / bgp, zebra: add family attribute to ipset and iptable contextPhilippe Guibert2020-08-211-0/+3
|/ | | | | | | | in order to create appropriate policy route, family attribute is stored in ipset and iptable zapi contexts. This commit also adds the flow label attribute in iptables, for further usage. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* Merge pull request #6951 from donaldsharp/zebra_tableRafael Zalamena2020-08-201-3/+13
|\ | | | | zebra: Add table id to debug output
| * zebra: Add table id to debug outputDonald Sharp2020-08-191-3/+13
| | | | | | | | | | | | | | | | | | There are a bunch of places where the table id is not being outputed in debug messages for routing changes. Add in the table id we are operating on. This is especially useful for the case where pbr is working. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: Limit packet dumps for received data to `detail` levelDonald Sharp2020-08-201-1/+2
|/ | | | | | | When turning on `debug zebra packet detail` or `debug zebra packet recv detail` only display the detailed packet dump when `detail` is added. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: add support for sending ARP requestsJakub Urbańczyk2020-08-121-2/+37
| | | | | | | | | | We can make the Linux kernel send an ARP/NDP request by adding a neighbour with the 'NUD_INCOMPLETE' state and the 'NTF_USE' flag. This commit adds new dataplane operation as well as new zapi message to allow other daemons send ARP/NDP requests. Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
* zebra: Only note time of first nht registrationDonald Sharp2020-08-111-1/+2
| | | | | | | | We were noticing registration time of the last nht time. Let's just store the original time, although I am a bit dubious about the usefulness of this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #6783 from opensourcerouting/feature/sr-teRuss White2020-08-101-0/+114
|\ | | | | lib, zebra: Add SR-TE policy infrastructure to zebra
| * lib, zebra: Add SR-TE policy infrastructure to zebraSebastien Merle2020-08-071-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the sake of Segment Routing (SR) and Traffic Engineering (TE) Policies there's a need for additional infrastructure within zebra. The infrastructure in this PR is supposed to manage such policies in terms of installing binding SIDs and LSPs. Also it is capable of managing MPLS labels using the label manager, keeping track of nexthops (for resolving labels) and notifying interested parties about changes of a policy/LSP state. Further it enables a route map mechanism for BGP and SR-TE colors such that learned BGP routes can be mapped onto SR-TE Policies. This PR does not introduce any usable features by now, it is just infrastructure for other upcoming PRs which will introduce 'pathd', a new SR-TE daemon. Co-authored-by: Renato Westphal <renato@opensourcerouting.org> Co-authored-by: GalaxyGorilla <sascha@netdef.org> Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* | Merge pull request #6483 from sylane/router-id-v6Donald Sharp2020-08-101-9/+38
|\ \ | |/ |/| zebra: add IPv6 router-id
| * zebra: add IPv6 router-idSebastien Merle2020-07-171-9/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add a vrf sub-command `[no] ipv6 router-id X:X::X:X`. * add command `[no] ipv6 router-id X:X::X:X [vrf NAME]` for backward compatibility. * add a vrf sub-command `[no] ip router-id A.B.C.D` and make the old one without `ip` an alias for it. * add a command `[no] ip router-id A.B.C.D [vrf NAME]` for backward comptibility and make the old one without `ip` an alias for it. * add command `show ip router-id [vrf NAME]` and make the old one without `ip` an alias for it. * add command `show ipv6 router-id [vrf NAME]`. * add ZAPI commands `ZEBRA_ROUTER_ID_V6_ADD`, `ZEBRA_ROUTER_ID_V6_DELETE` and `ZEBRA_ROUTER_ID_V6_UPDATE` for deamons to get notified of the IPv6 router-id. * update zebra documentation. Signed-off-by: Sebastien Merle <sebastien@netdef.org>
* | zebra: Ethernet segment management and support for MAC-ECMPAnuradha Karuppiah2020-08-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Local ethernet segments are configured in zebra by attaching a local-es-id and sys-mac to a access interface - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ! interface hostbond1 evpn mh es-id 1 evpn mh es-sys-mac 00:00:00:00:01:11 ! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> This info is then sent to BGP and used for the generation of EAD-per-ES routes. 2. Access VLANs associated with an (ES) access port are translated into ES-EVI objects and sent to BGP. This is used by BGP for the generation of EAD-EVI routes. 3. Remote ESs are imported by BGP and sent to zebra. A list of VTEPs is maintained per-remote ES in zebra. This list is used for the creation of the L2-NHG that is used for forwarding traffic. 4. MAC entries with a non-zero ESI destination use the L2-NHG associated with the ESI for forwarding traffic over the VxLAN overlay. Please see zebra_evpn_mh.h for the datastruct organization details. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
* | zebra: When debugging route notifications use string instead of numberDonald Sharp2020-08-041-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | Current behavior: eva# show mem 2020/08/04 18:07:38 ZEBRA: Not Notifying Owner: 2 about prefix 3.3.3.3/32(254) 2 vrf: 0 Fix it to show: 2020/08/04 18:07:38 ZEBRA: Not Notifying Owner: connected about prefix 3.3.3.3/32(254) 2 vrf: 0 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge pull request #6765 from mjstapp/backup_nhg_netlinkRenato Westphal2020-07-271-9/+87
|\ \ | | | | | | lib,zebra: support multiple backup nexthops
| * | zebra: add validate function for zapi_labels messageMark Stapp2020-07-211-0/+58
| | | | | | | | | | | | | | | | | | | | | Add a simple validation function for zapi_labels messages; it checks for and validates backup nexthop indexes currently. Signed-off-by: Mark Stapp <mjs@voltanet.io>
| * | lib,sharpd,zebra: initial support for multiple backup nexthopsMark Stapp2020-07-171-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial changes to support a nexthop with multiple backups. Lib changes to hold a small array in each primary, zapi message changes to support sending multiple backups, and daemon changes to show commands to support multiple backups. The config input for multiple backup indices is not present here. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* | | Merge pull request #6730 from wesleycoakley/pbrd-dscp-ecnRuss White2020-07-231-0/+4
|\ \ \ | |_|/ |/| | DSCP / ECN-based PBR Matching
| * | pbrd, zebra, lib: DSCP / ECN-based PBR MatchingWesley Coakley2020-07-151-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend PBR maps to discriminate by Differentiated Services Code Point and / or Explicit Congestion Notification fields. These fields are used in the IP header for classifying network traffic. 0 1 2 3 4 5 6 7 +-----+-----+-----+-----+-----+-----+-----+-----+ | DS FIELD, DSCP | ECN FIELD | +-----+-----+-----+-----+-----+-----+-----+-----+ DSCP: differentiated services codepoint ECN: Explicit Congestion Notification Signed-off-by: Wesley Coakley <wcoakley@nvidia.com> Signed-off-by: Saurav Kumar Paul <saurav@cumulusnetworks.com>
* | Merge pull request #6706 from donaldsharp/router_id_bullshitRenato Westphal2020-07-161-1/+1
|\ \ | | | | | | Router id vrf subnode configuration
| * | zebra: Allow router-id to be part of the vrf sub nodeDonald Sharp2020-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Modify zebra to accept router-id's as part of the vrf subnode. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | *: remove PRI[udx](8|16|32)David Lamparter2020-07-141-8/+4
| |/ |/| | | | | | | | | | | | | | | | | | | These are completely pointless and break coccinelle string replacements. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --pri8-16-32 `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
* | zebra: collapse some duplicate LSP nhlfe apisMark Stapp2020-07-071-1/+1
|/ | | | | | | | | Collapse some apis where primary and backup nhlfe code was very similar, generally using a single common api and using a bool to distinguish between primary and backup. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: convert ip rule installation to use dplane threadJakub Urbańczyk2020-06-101-7/+8
| | | | | | | | | * Implement new dataplane operations * Convert existing code to use dataplane context object * Modify function preparing netlink message to use dataplane context object Signed-off-by: Jakub Urbańczyk <xthaid@gmail.com>
* zebra: call zapi message handler with a batchMark Stapp2020-06-021-29/+62
| | | | | | | | | | | The zapi code processes a batch of incoming messages, using a fifo. Hand the entire batch into the main zebra handling code, and let it loop through the individual messages. Divert the special OPAQUE messages from the normal processing flow, and offer them to the new zebra_opaque module instead. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* Merge pull request #6266 from mjstapp/backup_nhgsRenato Westphal2020-06-021-44/+17
|\ | | | | zebra: backup nexthops/nhlfes for LSPs
| * zebra: backup LSP zapi processingMark Stapp2020-06-011-82/+17
| | | | | | | | | | | | | | | | Move some processing of zapi label messages so they can be handled more efficiently. Handle zapi delete and replace messages. Signed-off-by: Mark Stapp <mjs@voltanet.io>