summaryrefslogtreecommitdiff
path: root/zebra/kernel_socket.c
AgeCommit message (Collapse)Author
2019-05-06zebra: Be consistent in how we call rib_add( and rib_delete( with tableidDonald Sharp
The rib_add( and rib_delete( functions are there to allow kernel interactions with the creation of routes. Fixup the code to be consistent in the passup of the tableid. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-03lib, pbrd, zebra: Fix size_t type printf warnings on obscure platformsDonald Sharp
Use the correct printf formater for those obscure platforms that we build against. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-02zebra: conditionalize RTM_RESOLVE flagMark Stapp
RTM_RESOLVE may not be present; conditionalize zebra's reference to it. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-03-14*: remove trailing newlines from zlog messagesQuentin Young
Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-01-31zebra: Move the master thread handler to the zrouter structureDonald Sharp
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>
2019-01-25zebra: set connected route metric based on the devaddr metricAnuradha Karuppiah
MACVLAN devices are typically used for applications such as VRR/VRRP that require a second MAC address (virtual). These devices have a corresponding SVI/VLAN device - root@TORC11:~# ip addr show vlan1002 39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff inet6 2001:aa:1::2/64 scope global valid_lft forever preferred_lft forever root@TORC11:~# ip addr show vlan1002-v0 40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff inet6 2001:aa:1::a/64 metric 1024 scope global valid_lft forever preferred_lft forever root@TORC11:~# The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via the SVI. To acheive that functionality the macvlan network's metric is set to a higher value. Zebra currently ignores the devaddr metric sent by the kernel and hardcodes it to 0. This commit eliminates that hardcoding. If the devaddr metric is available (METRIC_MAX) it is used for setting up the connected route otherwise we fallback to the dev/interface metric. Setting the macvlan metric to a higher value ensures that zebra will always select the connected route on the SVI (and subsequently use it for next hop resolution etc.) - root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64" Routing entry for 2001:aa:1::/64 Known via "connected", distance 0, metric 1024, vrf vrf1 Last update 11:30:56 ago * directly connected, vlan1002-v0 Routing entry for 2001:aa:1::/64 Known via "connected", distance 0, metric 0, vrf vrf1, best Last update 11:30:56 ago * directly connected, vlan1002 root@TORC11:~# Ticket: CM-23511 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-01-22zebra: use rta_getattr for NETMASKRafael Zalamena
IPv6 uses AF_LINK to represent netmasks, this commit unbreaks `rtm_read_mesg` that was broke on the `rta_get*` refactory. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> (cherry picked from commit 7a163a7c59bd1a7e94da356ea033040ae17cef29)
2019-01-22zebra: fix routing socket AF_LINK handling on NETMASKRafael Zalamena
IPv6 netmasks use AF_LINK family type and puts the correct amount of set bits in the data structure. If we only copy the SDL header we won't get all IPv6 address length, we must copy the whole extension of the `sockaddr_in6` struct (which is provided in `destlen` parameter). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> (cherry picked from commit 691e903879bcf88c872d74f6317784bd2187f3ca)
2019-01-21zebra: make routing socket debug user friendlierRafael Zalamena
Implement a addrs RTA to string translator to provide more useful debug output. Example: ifam_read_mesg: ifindex 2, ifname em1, ifam_addrs NETMASK,IFP,IFA ifam_flags 0x4, addr 2001:db8:1::1/64 broad (unspec) dst (unspec) gateway (unspec) Instead of: ifam_read_mesg: ifindex 2, ifname em1, ifam_addrs 0x34 ifam_flags 0x4, addr 2001:db8:1::1/64 broad (unspec) dst (unspec) gateway (unspec) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-01-21zebra: fix debug messages in ifam_read_mesgRafael Zalamena
Use the proper address family to convert binary address to string. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-01-08zebra: fix another FreeBSD warning messageRafael Zalamena
When an empty netmask a wrong end size is calculated, lets handle this corner case to avoid spurious warning messages. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-01-08zebra: fix FreeBSD warning on fresh OS bootRafael Zalamena
Handle corner case where a warning log message is issued on interface address netmask handling with sockaddr type AF_LINK: it may come empty or with match all (all 0xFF). In the first case all lengths are zero and we only need to copy the first bytes, second case it comes with a zero index and all 0xFF bytes. In any case we only need to figure out a few of the first bytes instead of all data. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-01-08zebra: implement FreeBSD route attr handlingRafael Zalamena
When porting routing socket macro data handling to functions, the attribute function was forgotten. The only difference between the attribute and address handler is the family type check. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-12-21zebra: fix compilation on OpenBSDRafael Zalamena
OpenBSD doesn't define RTM_LOCK anymore: https://marc.info/?l=openbsd-tech&m=153018811429193&w=2 Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-12-13Merge pull request #3467 from donaldsharp/kernel_socket_cleanupRuss White
Kernel socket cleanup
2018-12-12lib, zebra: Remove ZEBRA_FLAG_STATICDonald Sharp
We never used this information and it was merely stored. Additionally this is not something that is a flag, it's a status. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12zebra: Make v4 and v6 code paths for rib_XXX calls in kernel_socket the sameDonald Sharp
Make the v4 and v6 code paths for rib_XXX calls in kernel_socket as similiar as we can possibly make them. There is no need for code duplication at this point in time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-12zebra: Remove rib_lookup_ipv4_routeDonald Sharp
The rib_lookup_ipv4_route function is only used in a debug path. Is only used for v4 and only checks to make sure that the rib and fib are in sync( which is not needed/used/supported on other platforms ). So let's just remove it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-05zebra: refactor route socket message handlingRafael Zalamena
Some address types were not being skipped triggering a warning log message, so lets refactor this code to properly handle known and unknown types. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-12-05zebra: always define ROUNDUP and ROUND_TYPERafael Zalamena
Move the declaration of ROUNDUP and ROUND_TYPE to outside of `ifdef SA_SIZE`. We'll use these definitions in the next commit. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2018-11-21zebra: add dataplane routing socketMark Stapp
To avoid conflicts between the zebra main pthread and the dataplane pthread, use a separate routing socket (on non-netlink platforms) for dataplane route updates to the OS. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2018-11-21zebra: separate netlink socket for dataplaneMark Stapp
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>
2018-10-31Merge pull request #2705 from opensourcerouting/northbound-yang-v2Donald Sharp
Northbound API
2018-10-28Merge pull request #2946 from mjstapp/dplane_2Donald Sharp
Zebra: async dataplane, phase 1
2018-10-27lib: retrofit interface commands to the new northbound modelRenato Westphal
The frr-interface YANG module models interfaces using a YANG list keyed by the interface name and the interface VRF. Interfaces can't be keyed only by their name since interface names might not be globally unique when the netns VRF backend is in use. When using the VRF-Lite backend, however, interface names *must* be globally unique. In this case, we need to validate the uniqueness of interface names inside the appropriate northbound callback since this constraint can't be expressed in the YANG language. We must also ensure that only inactive interfaces can be removed, among other things we need to validate in the northbound layer. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-25*: spelchekDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25zebra: update routing socket pathMark Stapp
Update route-socket path for route updates using the async dplane module. Signed-off-by: Mark Stapp <mjs@voltanet.io>
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-14*: use frr_elevate_privs() (2/2: manual)David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14zebra: add missing includeQuentin 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-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>