summaryrefslogtreecommitdiffstats
path: root/zebra/kernel_netlink.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: Convert to using frr_vtydir instead of DAEMON_VTY_DIRDonald Sharp2019-06-041-2/+1
| | | | | | | | In a variety of places we are using DAEMON_VTY_DIR, convert to use frr_vtydir. This will allow us in a future commit to have the -N namespace option be automatically used. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Fix extended ack error message parsingStephen Worley2019-03-261-20/+26
| | | | | | | | | | | | | Fix the macros for reading NLA attribute info from an extended error ack. We were processing the data using route attributes (rtattr) which is identical in size to nlattr but probably should not be used. Further, we were incorrectly calculating the length of the inner netlink message that cause the error. We have to read passed that in order to access all the nlattr's. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
* *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-1/+1
| | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: Move the master thread handler to the zrouter structureDonald Sharp2019-01-311-3/+4
| | | | | | | | The master thread handler is really part of the zrouter structure. So let's move it over to that. Eventually zserv.h will only be used for zapi messages. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Merge pull request #3508 from chiragshah6/evpn_dev2Russ White2019-01-231-1/+0
|\ | | | | zebra: EVPN remote entry delete check local entry presence
| * zebra: netlink_request consolidataionChirag Shah2018-12-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make netlink_request api generic where it can be used for dump or querying specific information request. nelink request nlm flags (NLM_F_ROOT | NLM_F_MATCH) are used to dump purpose, if client wants to query spcific MAC or IP using netlink_request does not require to set them. nlm struct is passed by the caller of netlink_request, it can also set the nlm request flags. Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
* | zebra: replace zlog_err with flog_errRafael Zalamena2018-12-291-1/+2
| | | | | | | | | | | | Change the logging mechanism for truncated netlink error messages. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* | zebra: remove duplicated codeRafael Zalamena2018-12-261-8/+0
|/ | | | | | Remove duplicated netlink error message length check. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* zebra: separate netlink socket for dataplaneMark Stapp2018-11-211-14/+51
| | | | | | | | | | Use a separate netlink socket for the dataplane's updates, to avoid races between the dataplane pthread and the zebra main pthread. Revise zebra shutdown so that the dataplane netlink socket is cleaned-up later, after all shutdown-time dataplane work has been done. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: rebase dataplane, align with masterMark Stapp2018-10-251-3/+1
| | | | | | | Rebase and pick up dataplane changes on master, including renamed structs and enums. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: netlink fuzzing path correctionMark Stapp2018-10-251-1/+7
| | | | | | | Correct use of netlink_parse_info() in the netlink fuzzing path. Also clarify a couple of comments about pthreads. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: resolve style issues in dplane commitMark Stapp2018-10-251-1/+1
| | | | | | | Resolve (most) style issues in the initial zebra dataplane commit branch. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* zebra: start dataplane layer workMark Stapp2018-10-251-10/+33
| | | | | | | | | | | | | | | | | | | 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>
* zebra: netlink socket check (Coverity 1472236)F. Aragon2018-10-031-1/+0
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* zebra: Start abstraction of zebra_dplane_info for context passingMark Stapp2018-09-201-7/+14
| | | | | | | | | 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>
* zebra: Print out netlink message type instead of numberDonald Sharp2018-09-141-2/+3
| | | | | | | | 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>
* *: style for EC replacementsQuentin Young2018-09-131-16/+14
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-9/+9
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: ZEBRA_[ERR|WARN] -> EC_ZEBRAQuentin Young2018-09-131-8/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: flog_warn conversionQuentin Young2018-09-061-6/+9
| | | | | | Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: Add support for static encap mpls labelsStephen Worley2018-08-251-0/+12
| | | | | | | | 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>
* zebra: fix warnings from frr_elevate_privs()David Lamparter2018-08-141-2/+2
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: use frr_elevate_privs() (2/2: manual)David Lamparter2018-08-141-42/+26
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: use frr_elevate_privs() (1/2: coccinelle)David Lamparter2018-08-141-14/+9
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: rename ferr_zlog -> flog_err_sysQuentin Young2018-08-141-24/+25
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-26/+26
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra, lib: error references for zebraQuentin Young2018-08-141-38/+56
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd, lib, zebra: Convert LIB_ERR_PRIVILEGESDonald Sharp2018-08-141-8/+11
| | | | | | | For all the places we zlog_err about raising/lowering privileges, use zlog_ferr. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: socket fd check (Coverity 1472236)F. Aragon2018-08-031-0/+1
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* Merge pull request #2696 from sworleys/Netlink-FuzzRuss White2018-07-291-0/+99
|\ | | | | zebra: Add code for fuzzing netlink
| * Style, don't initialize netlink_read flagStephen Worley2018-07-261-1/+1
| | | | | | | | Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * zebra: Make fuzzer code use default netlink socketStephen Worley2018-07-261-11/+4
| | | | | | | | | | | | | | 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>
| * Refactor code for new fuzzing netlink flagStephen Worley2018-07-241-19/+9
| | | | | | | | | | | | | | Changed the configure flag used by netlink fuzzing and refactored code accordingly. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * Style for Add code for fuzzing netlinkStephen Worley2018-07-231-1/+2
| | | | | | | | Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
| * zebra: Add code for fuzzing netlinkStephen Worley2018-07-211-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | zebra: Check for netlink message next faultStephen Worley2018-07-261-1/+1
|/ | | | | | | | | | | | | | | 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>
* zebra: Remove need for ACK for netlink messagesDonald Sharp2018-07-131-5/+6
| | | | | | | | | | | | | | | | | | 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>
* zebra: Listen to error codes from netlink_socketDonald Sharp2018-07-131-19/+24
| | | | | | | 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>
* zebra, libs: use const prefix ptrs in apisMark Stapp2018-07-111-4/+4
| | | | | | | Add 'const' to prefix args to several zebra route update, redistribution, and route owner notification apis. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* isisd zebra: dead code (Clang scan)F. Aragon2018-06-291-1/+0
| | | | | | | | | | | | | | | | | | 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>
* zebra: Log how we got to this failure.Donald Sharp2018-06-251-0/+1
| | | | | | | | | 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>
* zebra: Add extended Ack error parsing to FRRDonald Sharp2018-06-211-7/+110
| | | | | | | | | | | | | 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>
* Merge pull request #2283 from donaldsharp/ignore_some_moreRuss White2018-05-271-66/+129
|\ | | | | zebra: netlink cleanups
| * zebra: Fix RULE notification netlink messagesDonald Sharp2018-05-241-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * zebra: Remove unnecessary function parameterDonald Sharp2018-05-241-19/+15
| | | | | | | | | | | | | | 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>
| * zebra: Move where we check for non-kernel netlink messagesDonald Sharp2018-05-241-6/+11
| | | | | | | | | | | | | | | | | | 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>
| * zebra: Ignore most netlink notifications from ourselvesDonald Sharp2018-05-241-39/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | tools, zebra: Use different protocol value for our staticsDonald Sharp2018-05-261-0/+1
|/ | | | | | | | | | | 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>
* zebra: Increase recvmsg buffer size for picking up netlink messagesvivek2018-05-091-1/+1
| | | | | | | | | | 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>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-12/+13
| | | | | | | | | | | | | | | | | | | | | | 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>