summaryrefslogtreecommitdiffstats
path: root/zebra/rt_socket.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zebra: Modify southbound interface to pass `struct route_node`Donald Sharp2018-01-241-4/+5
| | | | | | | | | The route_node that we are working on is going to be interesting to the kernel_route_rib_pass_fail. So I am setting up the code to allow me to pass it. This will be done in a subsuquent commit. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Rename and place appropriately the label stackDonald Sharp2018-01-221-1/+1
| | | | | | Fix and rename the label stack to be better named. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Add one-shot thread to recheck speedDonald Sharp2018-01-111-0/+5
| | | | | | | | | | | | | | | | | | There are certain interfaces that when brought up and we receive the netlink notification about it, the speed of the interface is not set correctly. This creates a one-shot thread that will wait 15 seconds and then requery the speed and if it is different it will renotify the running daemons. The kernel should notify us on speed changes, unfortunately this is not done currently via a netlink message as you would think. As I understand it there is some in-fighting about the proper way to approach this issue and due to the way the kernel release cycle works we are a ways off from getting this fixed. This is a `hack` to make us work correctly while we wait for the true answer. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Fix lsp add/del from kernel using SETFLAGDonald Sharp2017-11-291-2/+2
| | | | | | | Setup a interface such that the add/del of lsp's from the kernel can have a callback for success/failure. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Implement call back for route install/delete success/failDonald Sharp2017-11-291-3/+13
| | | | | | | | | | | | | | | | | When a route is installed or deleted into the kernel allow a callback mechanism to handle the success/failure of the kernel call. This separation is to allow us to do these things: 1) In the future create a true pthread to handle route install/deletes. This way we can schedule these events in a smarter fashion 2) Allow us to use a common southbound api for route install and deletion. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: rt_socket.c should not use SET_FLAGDonald Sharp2017-11-161-20/+1
| | | | | | | | | | | | | | | The SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB) is already taken care of in zebra_rib.c. There is no need for this to be handled by rt_socket.c. rt_netlink.c does not do a SET_FLAG(nexthop->flags, NEXTHOP_FLAG_FIB) for route installation. Please note it does do it for a mpls labeled route installation, which will be fixed in a future commit. Remove some dead code from 2002 as well. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: deduplicate nexthopsDavid Lamparter2017-09-121-2/+2
| | | | | | | | | | | | | | | There exists situations where it is possible to have duplicate nexthops passed from a higher level protocol into zebra. This code notices this duplication of nexthops and marks the duplicates as DUPLICATE so we don't attempt to install it into the kernel. This is important on *BSD as I understand it because passing duplicate nexthops will cause the route to be rejected. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: fix styleQuentin Young2017-08-301-5/+5
| | | | | | Fixes style nits introduced by recent pull requests. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: cleanup blackhole supportDavid Lamparter2017-08-281-7/+8
| | | | | | | | | | 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>
* zebra: increase maximum label stack depthRenato Westphal2017-08-221-10/+38
| | | | | | | | | | | | | | * Bump MPLS_MAX_LABELS from 2 to 16; * Adjust the static_nh_label structure and the mpls_label2str() function; * On OpenBSD, print an error message when trying to push more than one label at once (kernel limitation). While here, add support for MPLSv6 FTNs in OpenBSD. This is not the full package. We still can't pop multiple labels at once, or do things like swap a label and push other ones. We'll address that in the future. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* Merge branch 'master' into PIM_VRFDonald Sharp2017-08-021-0/+5
|\
| * build: zebra: remove *_method Makefile hacksDavid Lamparter2017-07-311-0/+5
| | | | | | | | | | | | replace with preprocessor checks in source files. Much simpler... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | lib, pimd, zebra: Allow pim to set pimregX into appropriate vrfDonald Sharp2017-07-241-0/+6
| | | | | | | | | | | | | | | | | | The pimregX devices when created by the kernel are put into the default vrf. When pim gets the callback that the device exists, check to see if it is a pimregX device and if so move it into the appropriate vrf. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: Allow S,G lookup to use RTNL_FAMILY_IPMRDonald Sharp2017-07-241-1/+1
|/ | | | | | | | | This current implementation unfortunately must ask the kernel for all mroutes because vrf's do not have the ability to request a single mroute at this time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-311/+289
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attrDonald Sharp2017-07-141-7/+5
|\
| * Rename ALL_NEXTHOPS_RO to ALL_NEXTHOPSßingen2017-07-101-3/+3
| |
| * Allow for more than 1 NH recursion levelßingen2017-06-281-6/+4
| | | | | | | | | | | | Before, only one level of recursive resolution was supported. Signed-off-by: ßingen <bingen@voltanet.io>
* | bgpd, zebra: Support for sticky MACsvivek2017-07-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement support for sticky (static) MACs. This includes the following: - Recognize MAC is static (using NUD_NOARP flag) and inform BGP - Construct MAC mobility extended community for sticky MACs as per RFC 7432 section 15.2 - Inform to zebra that remote MAC is sticky, where appropriate - Install sticky MACs into the kernel with the right flag - Appropriate handling in route selection Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: MAC and Neighbor (ARP/ND) handlingvivek2017-07-121-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | zebra: VNI and VTEP handlingvivek2017-07-121-0/+13
|/ | | | | | | | | | | | | Implement fundamental handling for VNIs and VTEPs: - Handle EVPN enable/disable by client (advertise-all-vni) - Create/update/delete VNIs based on VxLAN interface events and inform client - Handle VTEP add/delete from client and install into kernel - New debug command for VxLAN/EVPN - kernel interface (Linux/netlink only) Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: simplify log message lookupQuentin Young2017-06-211-2/+2
| | | | | | | | | | | | | | | | 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>
* zebra: Refactor 'struct rib' to be 'struct route_entry'Donald Sharp2017-06-011-16/+16
| | | | | | | | | | The 'struct rib' data structure is missnamed. It really is a 'struct route_entry' as part of the 'struct route_node'. We have 1 'struct route_entry' per route src. As such 1 route node can have multiple route entries if multiple protocols attempt to install the same route. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-151-4/+3
| | | | | | | | | | | 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>
* *: get rid of zlog(*, LOG_LEVEL, ...)David Lamparter2017-03-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* zebra: add srcdest support to ribChristian Franke2017-01-301-2/+9
| | | | | | | Add srcdest support to the zebra rib and to the kernel and redistribution interfaces. Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* zebra: Fix kernel_get_ipmr_sg_stats to return an valueDonald Sharp2017-01-181-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Fix wrong return typeDonald Sharp2017-01-181-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* zebra: Allow the collection of sg stats on more platforms.Donald Sharp2017-01-181-0/+6
| | | | | | | | The code to collect the sg stats was written for linux. Abstract the call to allow it to work on all platforms. I have not implemented the call for non-linux systems. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: replace strlcpy & strlcat with glibc versionsDavid Lamparter2016-11-151-1/+0
| | | | | | | | 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>
* zebra: Fix route deletion on *BSDTimo Teräs2016-10-181-22/+21
| | | | | | | | | Fix for not handling RTM_CHANGE correctly. This patch change it to delete/add instead. Using RTM_CHANGE on kernels where it works is better, but is left as an exercise for developer who has access and will to fix it on *BSD. [ed note: collaboration with Martin Winter]
* zebra: kernel interface simplificationTimo Teräs2016-10-181-64/+24
| | | | | | | | | | [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>
* zebra: check at startup if the kernel supports MPLSRenato Westphal2016-09-231-3/+3
| | | | | | | | 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>
* mpls: add support to the OpenBSD kernelRenato Westphal2016-09-231-1/+24
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: use an ifindex_t type, defined in lib/if.h, for ifindex valuesPaul Jakma2016-08-181-2/+2
| | | | (cherry picked from commit 9099f9b2a66e86f8a90d7fe18f61bd2bb1bc6744)
* zebra: create an abstraction layer for netlink_neigh_update()Renato Westphal2016-08-081-0/+7
| | | | | | | | | | | We shouldn't have platform-agnostic code (e.g. zebra/interface.c) calling platform-specific functions (e.g. netlink_neigh_update). This commit introduces the kernel_neigh_update() function, which then has to be implemented by all supported platforms. Currently only Linux implements this function, which is only used by the RTADV code. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: use prefix2str for logging where possibleTimo Teräs2016-06-091-11/+9
| | | | | | | | This makes code more robust, consice and readable. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit be6335d682c5ee1b6930345193eda875705fbab2)
* zebra: remove unused netlink_route()/kernel_rtm_ipv6()David Lamparter2016-06-071-61/+0
| | | | | | | | | kernel_delete_ipv6_old(), removed in 51bdeba a little while ago, was the last user of netlink_route() and kernel_rtm_ipv6(). Everything else uses the _multipath variants of these functions. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 872b0dc0537b62503d98bafd3075553795c847cb)
* build: remove INRIA, NRL and MUSICA IPv6 quirksDavid Lamparter2016-06-031-5/+0
| | | | | | | | | Valar dohaeris. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org>
* zebra/rt_socket: Fix warningsDavid Lamparter2016-05-261-0/+6
| | | | | | | Fix warning about unused sin_masklen / sin6_masklen Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit 8fa1d027f23115dcb1c38b09c6e46edf5b8f7238)
* zebra: remove kernel_delete_ipv6_old()David Lamparter2016-05-261-16/+0
| | | | | | | | | | | The only user of this was rib_bogus_ipv6(), which was removed in the previous commit. Good riddance. Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Acked-by: Greg Troxel <gdt@ir.bbn.com> Acked-by: Feng Lu <lu.feng@6wind.com> Acked-by: Paul Jakma <paul@jakma.org> (cherry picked from commit 51bdebad99fe813d1b7104543b352f0e39b1c8dc)
* ZEBRA: Remove NEXTHOP_TYPE_XXX_IFNAMEDonald Sharp2015-12-041-4/+0
| | | | | | | The NEXTHOP_TYPE_XXX_IFNAME types were never being used. Remove them and the code associated with them. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Zebra: Implement route replace for IPv6vivek2015-11-191-0/+7
| | | | | | | | | | | | | | | | | | Zebra currently performs a delete followed by add when a route needs to be modified. Change this to use the replace semantics of netlink so that the operation can possibly be atomic. Note: This patch handles IPv6 routes, IPv4 already performs a replace. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Ticket: CM-5597 Reviewed By: CCR-3407 Testing Done: Manual testing of various scearnios (Vivek, Satish) Note: This is an import of patch zebra-ipv6-route-replace.patch from 2.5-br.
* Zebra: Implement route replace semantics.Donald Sharp2015-06-111-0/+7
| | | | | | | | Zebra currently performs a delete followed by add when a route needs to be modified. Change this to use the replace semantics of netlink so that the operation can possibly be atomic. Note: Only implemented for IPv4 currently.
* zebra: apply syntactic sugar to rib_dump()David Lamparter2014-04-011-1/+1
| | | | | | | strip the explicit __func__ present on all calls and make the prefix argument a transparent union. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: rework recursive route resolutionChristian Franke2013-09-191-62/+36
| | | | | | | | | | | | | | | Change the datastructure for recursive routes. This brings the following benefits: By using struct nexthop also to store nexthops obtained by recursive resolution, we can get rid of quite a bit of code duplication in the fib management. (rt_netlink, rt_socket, ...) With the new datastructure we can make use of all available paths when recursive routes are resolved with multipath routes. Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Switch from LOOKUP() to lookup() for rtm_type (see bug #401 for details).Denis Ovsienko2007-09-141-2/+2
|
* * rt_socket.c: (kernel_rtm_ipv4) prefix_buf could be passedDenis Ovsienko2007-09-121-0/+3
| | | | to zlog_err() uninitialized with debug disabled. Fixed.
* Merged own patch for the bug #391 (debugging and comments mostly).Denis Ovsienko2007-08-131-23/+60
|
* Add comment questioning part of previous change (Denis?).Greg Troxel2007-08-021-26/+31
| | | | Fix indentation to match accumulated changes.