summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
AgeCommit message (Collapse)Author
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-07-29lib, zebra: Allow protocols to use Distance as part of RR semanticsDonald Sharp
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>
2018-05-12Merge pull request #2124 from donaldsharp/missedRuss White
bgpd, zebra: Handle EVPN router MAC per next hop
2018-05-01zebra: Fix crash on *BSDDonald Sharp
The zns->ns pointer is not created until we get a callback from the kernel that a ns exists. This should potentially fix a crash in the *BSD code path. Fixes: #2152 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-26bgpd, zebra: Handle EVPN router MAC per next hopvivek
Ensure that when EVPN routes are installed into zebra, the router MAC is passed per next hop and appropriately handled. This is required for proper multipath operation. Ticket: CM-18999 Reviewed By: Testing Done: Verified failed scenario, other manual tests Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2018-04-15zebra: Fix crash with certain types of tunnelsDonald Sharp
Zebra did not have a handler for tunnels in v6 for some reason. Add code to handle the broadcast address for both addition and deletion. This appears to fix the crash. There might still need to be some work to make the code `work` properly for this type of tunnel. Fixes: #2063 Signed-off-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-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
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>
2018-02-08*: Make code use a consisten definition of labelsDonald Sharp
Turns out we had 3 different ways to define labels all of them overlapping with the same meanings. Consolidate to 1. This one choosen is consistent naming wise with what the *bsd and linux kernels use. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-08*: Track vrfs per nexthop not per route entryDonald Sharp
Track the vfrs on a per nexthop basis instead of on a per route entry basis. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-02lib: fix more warnings on *BSDRenato Westphal
* zebra/kernel_socket.c: include "rt.h" to provide the prototypes of kernel_init() and kernel_terminate(); * lib/prefix.h: remove the deprecation warning whenever ETHER_ADDR_LEN is used. isisd uses the ETHER_HDR_LEN constant which is defined in terms of ETHER_ADDR_LEN in the *BSD system headers. So, when building FRR on *BSD, we were getting several warnings because we were using ETHER_ADDR_LEN indirectly; * lib/command_lex.l, lib/defun_lex.l: ignore other harmless warnings; * lib/spf_backoff.c: cast 'tv->tv_usec' to 'long int' before printing. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-01-12zebra: Add nh_vrf_id to rib_addDonald Sharp
Add to the rib_add function the ability to pass in the nexthops vrf. Additionally when we decode the netlink message from the linux kernel, properly figure out the nexthops vrf_id. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-11Merge branch 'master' into evpn-symmetric-routingMitesh Kanjariya
2017-12-14zebra: proper refcounting for rmac/nh entriesmitesh
Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.comy>
2017-12-14zebra: Add ability to support tags -> realms in linuxKaloyan Kovachev
Linux has the ability to support a concept of 'realms'. This concept allows you to mark routes with a realm id value of 1-255. If you have marked the realm of a route then you can use the tc program to apply policy to the routes. This commit adds the ability of FRR to interpret a tag from (1-255) as a realm when installing into the kernel. Please note that at this point in time there is no way to set policy from within FRR. This must be done outside of it. The normal methodology for setting tags is valid here via a route-map. Finally this is only applied if the --enable-realms configure option is applied. Signed-off-by: Kaloyan Kovachev <kkovachev@varna.net>
2017-10-10*: introduce new rb-tree to optimize interface lookup by ifindexRenato Westphal
Performance tests showed that, when running on a system with a large number of interfaces, some daemons would spend a considerable amount of time in the if_lookup_by_index() function. Introduce a new rb-tree to solve this problem. With this change, we need to use the if_set_index() function whenever we want to change the ifindex of an interface. This is necessary to ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The return value of all insert/remove operations in the interface rb-trees is checked to ensure that an error is logged if a corruption is detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-10-10lib: nuke the if_*_by_name_len() functionsRenato Westphal
Make use of strnlen() and strlcpy() so we can get rid of these convoluted if_*_by_name_len() functions. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-25zebra: Do not allow delete of route from kernel in non-startup caseDonald Sharp
This is a continuation of 915902cb82cfd. Basically the netlink read of messages up from the kernel is now noticing the proper owner of the route. As such when rib_delete was being called as part of the upcall from the kernel we were not noticing that we were the originator and not diss-allowing the rib_delete from happening. This restores this behavior that we were getting pre-915902cb82cfd Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-30*: fix styleQuentin Young
Fixes style nits introduced by recent pull requests. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-08-29Merge pull request #1059 from opensourcerouting/oldbits-1Donald Sharp
zebra: PtP address configuration support
2017-08-28zebra: kernel_socket: read extra attributesDavid Lamparter
This is just to silence the "didn't read all data" warning. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28zebra: drop IPv6 "broadcast" and "peer" addr codeDavid Lamparter
There is no such thing as an IPv6 "broadcast" or "peer" address. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28zebra: cleanup blackhole supportDavid Lamparter
blackhole support was horribly broken. cleanup by removing blackhole stuff from ZEBRA_FLAG_* introduces support for "prohibit" routes (Linux/netlink only) also clean up blackhole options on "ip route" vty commands. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-28zebra: rib: use nexthop ptr in rib_add/deleteDavid Lamparter
This simplifies the API for the following blackhole rework. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-26zebra: remove RT_ROUNDUP warningDavid Lamparter
This warning is at odds with how the world works. Also, the code is correct on all platforms we care about. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-09zebra: Pay attention to metric from kernelDonald Sharp
When the linux kernel adds/deletes routes, the metric is important, but our routing protocols add/delete in a slightly different manner, so allow kernel metrics to match so that our rib matches the kernel's fib. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-09zebra: fetch interface speed on *BSDRenato Westphal
Fixes #407 for FreeBSD and NetBSD. OpenBSD uses ioctl to fetch interface information on startup and the SIOCGIFMEDIA command is just too cumbersome to use. The best way to fix the problem for OpenBSD is probably to stop treating it differently from the other BSDs for no apparent reason. There should be nothing preventing us to make OpenBSD use the routing socket to fetch interface information on startup (we already do it to detect runtime changes). This is something that should be done in a separate commit after a careful analysis. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
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-06-21*: simplify log message lookupQuentin Young
log.c provides functionality for associating a constant (typically a protocol constant) with a string and finding the string given the constant. However this is highly delicate code that is extremely prone to stack overflows and off-by-one's due to requiring the developer to always remember to update the array size constant and to do so correctly which, as shown by example, is never a good idea.b The original goal of this code was to try to implement lookups in O(1) time without a linear search through the message array. Since this code is used 99% of the time for debugs, it's worth the 5-6 additional cmp's worst case if it means we avoid explitable bugs due to oversights... Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-05-15*: make consistent & update GPLv2 file headersDavid Lamparter
The FSF's address changed, and we had a mixture of comment styles for the GPL file header. (The style with * at the beginning won out with 580 to 141 in existing files.) Note: I've intentionally left intact other "variations" of the copyright header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-09*: remove THREAD_ON macros, add nullity checkQuentin Young
The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-03-15lib: Refactor if_get_by_name_len to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Refactor if_lookup_by_name to be VRF awareDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15lib, ospfd, pimd: Convert to using VRF based interface creationDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15*: Remove non-vrf based ifindex lookupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-08*: get rid of zlog(*, LOG_LEVEL, ...)David Lamparter
Result of running the following Coccinelle patch + fixups: <<EOF /* long-forms: zlog(NULL, <level>, ...) * => zlog_level(...) */ @@ expression list args; @@ - zlog(NULL, LOG_DEBUG, args) + zlog_debug(args) @@ expression list args; @@ - zlog(NULL, LOG_NOTICE, args) + zlog_notice(args) @@ expression list args; @@ - zlog(NULL, LOG_INFO, args) + zlog_info(args) @@ expression list args; @@ - zlog(NULL, LOG_WARNING, args) + zlog_warn(args) @@ expression list args; @@ - zlog(NULL, LOG_ERR, args) + zlog_err(args) /* long-forms: zlog(base->log, <level>, ...) * => zlog_level(...) */ @@ expression base; expression list args; @@ - zlog(base->log, LOG_DEBUG, args) + zlog_debug(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_NOTICE, args) + zlog_notice(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_INFO, args) + zlog_info(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_WARNING, args) + zlog_warn(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_ERR, args) + zlog_err(args) EOF Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-30zebra: receive ZAPI IPv6 source prefixDavid Lamparter
Check and read the IPv6 source prefix on ZAPI messages, and pass it down to the RIB functions (which do nothing with it yet.) Since the RIB functions now all have a new extra argument, this also updates the kernel route read functions to supply NULL. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-01-18zebra: Fix compile warnings under freebsdDonald Sharp
Compiling under clang we see compiler warnings Fix them. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13frr: Remove HAVE_IPV6 from code baseDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-15lib: replace strlcpy & strlcat with glibc versionsDavid Lamparter
It seems these two were at some point copied in from rsync; replace with more recent versions that will hopefully become available in glibc as well. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-18zebra: kernel interface simplificationTimo Teräs
[DL: picked out from: "atomic FIB updates"] This simplifies the OS-specific route update API into a single entry point, kernel_route_rib(), which dispatches the various operations internally. Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2016-09-23zebra: check at startup if the kernel supports MPLSRenato Westphal
Replace all HAVE_MPLS #ifdef's by a run-time check if MPLS is supported by the kernel or not. This way we don't need to create multiple packages for each OS distribution. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-23mpls: add support to the OpenBSD kernelRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-09-19*: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter
This is a rather large mechanical commit that splits up the memory types defined in lib/memtypes.c and distributes them into *_memory.[ch] files in the individual daemons. The zebra change is slightly annoying because there is no nice place to put the #include "zebra_memory.h" statement. bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the library for its own use. This is bad practice and would break when the memtype are made static. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: rebased for cmaster-next] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-03lib, zebra: unify link layer type and hardware address handlingTimo Teräs
This removes the BSD specific usage of struct sockaddr_dl hardware address. This unifies to use explict hw_addr member for the address, and zebra specific enumeration for the link layer type. Additionally the zapi is updated to never send platform specific structures over the wire, but the ll_type along with hw_addr_len and hw_addr are now sent for all platforms. Based on initial work by Paul Jakma. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> # Please enter the commit message for your changes. Lines starting # with '#' will be kept; you may remove them yourself if you want to. # An empty message aborts the commit. # # Author: Timo Teräs <timo.teras@iki.fi> # # rebase in progress; onto 9c2f85d # You are currently editing a commit while rebasing branch 'renato' on '9c2f85d'. # # Changes to be committed: # modified: isisd/isis_circuit.c # modified: lib/if.c # modified: lib/if.h # modified: lib/zclient.c # modified: zebra/interface.c # modified: zebra/interface.h # modified: zebra/kernel_socket.c # modified: zebra/rt_netlink.c # modified: zebra/rtadv.c # modified: zebra/zserv.c # # Untracked files: # "\033\033OA\033OB\033" # 0001-bgpd-fix-build-on-Solaris.patch # ldpd/ # redhat/ldpd.init # redhat/ldpd.service # tags #