summaryrefslogtreecommitdiff
path: root/zebra/kernel_netlink.c
AgeCommit message (Collapse)Author
2018-10-25zebra: resolve style issues in dplane commitMark Stapp
Resolve (most) style issues in the initial zebra dataplane commit branch. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-25zebra: start dataplane layer workMark Stapp
Reduce or eliminate use of global zebra_ns structs in a couple of netlink/kernel code paths, so that those paths can potentially be made asynch eventually. Slide netlink_talk_info into place to remove dependency on core zebra structs; add accessors for dplane context block Start init of route context from zebra core re and rn structs; start queueing and event handling for incoming route updates. Expose netlink apis that don't rely on zebra core structs; add parallel route-update code path using the dplane ctx; simplest possible event loop to process queued route' updates. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-10-03zebra: netlink socket check (Coverity 1472236)F. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-19zebra: Start abstraction of zebra_dplane_info for context passingMark Stapp
Reduce or eliminate use of global zebra_ns structs in a couple of netlink/kernel code paths, so that those paths can potentially be made asynch eventually. Signed-off-by: Mark Stapp <mjs@voltanet.io> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-14zebra: Print out netlink message type instead of numberDonald Sharp
When we are displaying data about a netlink message in debugs or errors, print out the message type as a string instead of a number. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-13*: style for EC replacementsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13*: LIB_[ERR|WARN] -> EC_LIBQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06zebra: flog_warn conversionQuentin Young
Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-25zebra: Add support for static encap mpls labelsStephen Worley
We were ignoring mpls labels encapped with static routes. Added support for single and multipath labels. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14zebra: fix warnings from frr_elevate_privs()David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14*: use frr_elevate_privs() (2/2: manual)David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14*: use frr_elevate_privs() (1/2: coccinelle)David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14*: rename ferr_zlog -> flog_err_sysQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14zebra, lib: error references for zebraQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14bgpd, lib, zebra: Convert LIB_ERR_PRIVILEGESDonald Sharp
For all the places we zlog_err about raising/lowering privileges, use zlog_ferr. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-03zebra: socket fd check (Coverity 1472236)F. Aragon
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-07-29Merge pull request #2696 from sworleys/Netlink-FuzzRuss White
zebra: Add code for fuzzing netlink
2018-07-26zebra: Check for netlink message next faultStephen Worley
NLMSG_NEXT decrements the buffer length (status) by the header msg length (nlmsg_len) everytime its called. If nlmsg_len isn't accurate and set to be larger than what it should represent, it will cause status to decrement passed 0. This makes NLMSG_NEXT return a pointer that references an inaccessible address. When that is passed to NLMSG_OK, it segfaults. Add a check to verify that there is still something to read before we try to. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-26Style, don't initialize netlink_read flagStephen Worley
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-26zebra: Make fuzzer code use default netlink socketStephen Worley
Change the fuzzing code so that it fakes data from the listening socket rather than using its own pseudo one. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-24Refactor code for new fuzzing netlink flagStephen Worley
Changed the configure flag used by netlink fuzzing and refactored code accordingly. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-23Style for Add code for fuzzing netlinkStephen Worley
Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-21zebra: Add code for fuzzing netlinkStephen Worley
This code allows you to fuzz the netlink listening socket in zebra by --enable-fuzzing and passing the -w [FILE] option when running zebra. File collection is stored in /var/run/frr/netlink_* where each number is just a counter to keep the files distinct. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2018-07-12zebra: Remove need for ACK for netlink messagesDonald Sharp
Kernel requests via netlink are synchronous. Therefore we do not need to specify a need for a ACK and we can make the netlink_cmd NONBLOCKING 1) If the netlink message is going to cause an error we will still get one. Since results from the kernel are synchronous we will get the error message on the netlink_cmd socket and handle it 2) If the netlink message is going to send more than one packet we will still get them all. Since the results from the kernel are synchronous we will receive all data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-12zebra: Listen to error codes from netlink_socketDonald Sharp
When creating a netlink_socket, listen to error codes and abandon ship if it crashes and burns. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-11zebra, libs: use const prefix ptrs in apisMark Stapp
Add 'const' to prefix args to several zebra route update, redistribution, and route owner notification apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-06-29isisd zebra: dead code (Clang scan)F. Aragon
This correction fixes two bugs detected by Clang scan: Bug Group: Dead store Bug Type: Dead assignment File: zebra/kernel_netlink.c Function: netlink_parse_extended_ack Line: 548 Bug Type: Dead increment File: isisd/isis_lsp.c Function: lsp_bits2string Line: 625 Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-25zebra: Log how we got to this failure.Donald Sharp
When a filter function fails to work correctly, we get an error message that something has gone wrong. Unfortunately we may not have any clues as to where the decode failure happened. Add a backtrace to give us a clue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-21zebra: Add extended Ack error parsing to FRRDonald Sharp
Add code to request and read in extended ack information to provide a bit more context of what went wrong when a failure is detected in the kernel. Example of a failed delete: Jun 20 21:19:25 robot zebra[11878]: Extended Error: Invalid prefix for given prefix length Jun 20 21:19:25 robot zebra[11878]: netlink-cmd (NS 0) error: Invalid argument, type=RTM_DELROUTE(25), seq=8, pid=4078403400 Jun 20 21:19:25 robot zebra[11878]: 0:4.3.2.0/24: Route Deletion failure Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-27Merge pull request #2283 from donaldsharp/ignore_some_moreRuss White
zebra: netlink cleanups
2018-05-26tools, zebra: Use different protocol value for our staticsDonald Sharp
The re-use of RTPROT_STATIC has caused too many collisions where other legitimate route sources are causing us to believe we are the originator of the route. Modify the code so that if another protocol inserts RTPROT_STATIC we will assume it's a Kernel Route. Fixes: #2293 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-24zebra: Fix RULE notification netlink messagesDonald Sharp
Fix the code so that we would actually start receiving RULE netlink notifications. The Kernel expects the long long to be a bit field value, while the newer netlink message types are an enum. So we need to convert the message type number to a bit position and set that value. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-24zebra: Remove unnecessary function parameterDonald Sharp
The snl variable is no longer needed to be passed around, so remove it from the calling path. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-24zebra: Move where we check for non-kernel netlink messagesDonald Sharp
Move where we check for non-kernel netlink messages to a slightly earlier spot. This will allow in subsuquent commits the removal of an extra parameter that needs to be passed around. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-24zebra: Ignore most netlink notifications from ourselvesDonald Sharp
The BPF filter was an exclusion list of netlink messages we did not want to receive from our self. The problem with this is that the exclusion list was and will be ever growing. So switch the test around to an inclusion list since it is shorter and not growing. Right now this is RTM_NEWADDR and RTM_DELADDR. Change some of the debug messages to error messages so that when something slips through and it is unexpected during development we will see the problem. Also try to improve the documentation about what the filter is doing and leave some breadcrumbs for future developers to know where to change code when new functionality is added. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08zebra: Increase recvmsg buffer size for picking up netlink messagesvivek
Netlink messages from the kernel need to be received in a buffer larger than 8K in order to handle some types of info - for example, the VLAN information. Define a separate size for receive and set it to 32K, which is the value used by other netlink receivers like iproute2. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-27*: use C99 standard fixed-width integer typesQuentin Young
The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-09*: PBR - netlink interaction and basic definitionsvivek
Implement netlink interactions for Policy Based Routing. This includes APIs to install and uninstall rules and handle notifications from the kernel related to rule addition or deletion. Various definitions are added to facilitate this. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-27zebra: socket operations stick to namespace if necessaryPhilippe Guibert
Upon following calls: interface poll, address poll, route poll, and ICMPv6 handling, each new Namespace is being parsed. For that, the socket operations need to switch from one NS to one other, to get the necessary information. As of now, there is a crash when dumping interfaces, through show running-config. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2017-12-13zebra: Make zserv.h the true api for zapi northboundDonald Sharp
zserv.c had a grab bag of function declarations that did not belong in it. Move those to where they better belong. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-10-02zebra: Fix valgrind report of unintialized dataDonald Sharp
When calling the kernel we are not properly initializing iov and msg on function startup. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-04zebra: hide netlink warning messageJorge Boncompte
Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
2017-07-31build: zebra: remove *_method Makefile hacksDavid Lamparter
replace with preprocessor checks in source files. Much simpler... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22Revert "*: reindent pt. 2"David Lamparter
This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindent pt. 2whitespace / reindent
w/ clang 5 * reflow comments * struct members go 1 per line * binpack algo was adjusted
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-12zebra: MAC and Neighbor (ARP/ND) handlingvivek
Implement handling of MACs and Neighbors (ARP/ND entries) in zebra: - MAC and Neighbor database handlers - Read MACs and Neighbors from the kernel, when needed and create entries in zebra's MAC and Neighbor databases. - Handle add/update/delete notifications from the kernel for MACs and Neighbors and update zebra's database appropriately - Inform locally learnt MACs and Neighbors to client - Handle MACIP add/delete from client and install appriporiate entries into the kernel - Since Neighbor entries will be installed on an SVI, implement the needed mappings NOTE: kernel interface is only implemented for Linux/netlink Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-10Merge commit '3d22338f04d9554fa' into evpn-prepDavid Lamparter
Conflicts: lib/Makefile.am Signed-off-by: David Lamparter <equinox@opensourcerouting.org>