summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-04-11Merge pull request #1989 from qlyoung/defpy-hiddenLou Berger
lib, python: DEFPY_ATTR, DEFPY_HIDDEN
2018-04-11Merge pull request #1903 from donaldsharp/PBRDRuss White
Pbrd
2018-04-10lib, python: DEFPY_ATTR, DEFPY_HIDDENQuentin Young
Add support for element attributes in DEFPY macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06lib: add graph_find_nodeQuentin Young
Allows finding a graph node by its data pointer. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06lib: dont break display of nexthop-groups themselvesQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06lib, pbrd: rm extra space when displaying nexthopQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06lib: Add hash and use const a bit more intelligentlyQuentin Young
This commit adds code to notify the compiler that we will not be changing the arguments to nexthop2str and we expect thre return to be treated the same. Additionally we add some code to allow nexthops to be hashed to be used in a hash. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06pbrd: Add PBR to FRRDonald Sharp
This is an implementation of PBR for FRR. This implemenation uses a combination of rules and tables to determine how packets will flow. PBR introduces a new concept of 'nexthop-groups' to specify a group of nexthops that will be used for ecmp. Nexthop-groups are specified on the cli via: nexthop-group DONNA nexthop 192.168.208.1 nexthop 192.168.209.1 nexthop 192.168.210.1 ! PBR sees the nexthop-group and installs these as a default route with these nexthops starting at table 10000 robot# show pbr nexthop-groups Nexthop-Group: DONNA Table: 10001 Valid: 1 Installed: 1 Valid: 1 nexthop 192.168.209.1 Valid: 1 nexthop 192.168.210.1 Valid: 1 nexthop 192.168.208.1 I have also introduced the ability to specify a table in a 'show ip route table XXX' to see the specified tables. robot# show ip route table 10001 Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF, I - IS-IS, B - BGP, P - PIM, E - EIGRP, N - NHRP, T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR, > - selected route, * - FIB route F>* 0.0.0.0/0 [0/0] via 192.168.208.1, enp0s8, 00:14:25 * via 192.168.209.1, enp0s9, 00:14:25 * via 192.168.210.1, enp0s10, 00:14:25 PBR tracks PBR-MAPS via the pbr-map command: ! pbr-map EVA seq 10 match src-ip 4.3.4.0/24 set nexthop-group DONNA ! pbr-map EVA seq 20 match dst-ip 4.3.5.0/24 set nexthop-group DONNA ! pbr-maps can have 'match src-ip <prefix>' and 'match dst-ip <prefix>' to affect decisions about incoming packets. Additionally if you only have one nexthop to use for a pbr-map you do not need to setup a nexthop-group and can specify 'set nexthop XXXX'. To apply the pbr-map to an incoming interface you do this: interface enp0s10 pbr-policy EVA ! When a pbr-map is applied to interfaces it can be installed into the kernel as a rule: [sharpd@robot frr1]$ ip rule show 0: from all lookup local 309: from 4.3.4.0/24 iif enp0s10 lookup 10001 319: from all to 4.3.5.0/24 iif enp0s10 lookup 10001 1000: from all lookup [l3mdev-table] 32766: from all lookup main 32767: from all lookup default [sharpd@robot frr1]$ ip route show table 10001 default proto pbr metric 20 nexthop via 192.168.208.1 dev enp0s8 weight 1 nexthop via 192.168.209.1 dev enp0s9 weight 1 nexthop via 192.168.210.1 dev enp0s10 weight 1 The linux kernel now will use the rules and tables to properly apply these policies. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Don Slice <dslice@cumulusnetworks.com> Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-04Merge pull request #2006 from qlyoung/remove-irdp-nodeRuss White
lib: remove IRDP_NODE
2018-04-04Merge pull request #2002 from qlyoung/remove-undebugRuss White
bgpd, pim: remove undebug
2018-04-04Merge pull request #1998 from qlyoung/fix-vrf-keyword-walkupRuss White
lib, vtysh: vrf walkup bugfix
2018-04-04Merge pull request #1979 from LabNConsulting/working/master/bgp-nht-labelsRuss White
bgpd: nexthop tracking with labels for vrf-vpn leaking
2018-04-04bgpd: nexthop tracking with labels for vrf-vpn leakingG. Paul Ziemba
Routes that have labels must be sent via a nexthop that also has labels. This change notes whether any path in a nexthop update from zebra contains labels. If so, then the nexthop is valid for routes that have labels. If a nexthop update has no labeled paths, then any labeled routes referencing the nexthop are marked not valid. Add a route flag BGP_INFO_ANNC_NH_SELF that means "advertise myself as nexthop when announcing" so that we can track our notion of the nexthop without revealing it to peers. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-04lib/prefix.[ch]: add family2str()G. Paul Ziemba
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-04-03*: Only test CONFDATE when VERSION_TYPE_DEV definedLou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-04-03Merge pull request #2010 from donaldsharp/ns_fixesPhilippe Guibert
lib: Namespaces should only complain about failure if we have it
2018-04-03lib: remove IRDP_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-02Merge pull request #2005 from qlyoung/remove-masc-nodeRafael Zalamena
lib: remove MASC_NODE
2018-04-02bgpd, pim: remove undebugQuentin Young
This 'undebug' syntax is only used in 5 commands and serves no apparent purpose. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-31lib: Namespaces should only complain about failure if we have itDonald Sharp
Do not complain about failure to create a namespace if we do not have any such thing going on. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-30lib: remove MASC_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30lib: remove SERVICE_NODEQuentin Young
Unused Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30lib, vtysh: vrf walkup bugfixQuentin Young
Static route commands are now installed inside the VRF nodes. This has quietly broken top-level static routes in certain scenarios due to walkup logic resolving a static route configuration command inside VRF_NODE first if the command is issued while in a CLI node lower than VRF_NODE. To fix this VRF_NODE needs a special exit command, as has been done for many other nodes with the same issue, to explicitly change the vrf context to the default VRF so that when walkup resolves against the VRF node it will configure against the default VRF as desired. Of course this is a hack on top of a hack and the CLI walkup implementation needs to be rewritten. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-30Merge pull request #1984 from donaldsharp/conf_date_masterRuss White
lib: Remove backwards compatiblity at 1 year
2018-03-30bgpd: add flowspec featurejaydom
This work is derived from a work done by China-Telecom. That initial work can be found in [0]. As the gap between frr and quagga is important, a reworks has been done in the meantime. The initial work consists of bringing the following: - Bringing the client side of flowspec. - the enhancement of address-family ipv4/ipv6 flowspec - partial data path handling at reception has been prepared - the support for ipv4 flowspec or ipv6 flowspec in BGP open messages, and the internals of BGP has been done. - the memory contexts necessary for flowspec has been provisioned In addition to this work, the following has been done: - the complement of adaptation for FS safi in bgp code - the code checkstyle has been reworked so as to match frr checkstyle - the processing of IPv6 FS NLRI is prevented - the processing of FS NLRI is stopped ( temporary) [0] https://github.com/chinatelecom-sdn-group/quagga_flowspec/ Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: jaydom <chinatelecom-sdn-group@github.com>
2018-03-30lib: prefix support for flowspecPhilippe Guibert
prefix structure is used to handle flowspec prefixes. A new AFI is introduced: AF_FLOWSPEC. A sub structure named flowspec_prefix is used in prefix to host the flowspec entry. Reason to introduce that new kind is that prefixlen from prefix structure is too short to all the flowspec needs, since NLRI can go over 0xff bytes. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-29bgpd: add API to allocate a range of table identifiersPhilippe Guibert
In BGP, doing policy-routing requires to use table identifiers. Flowspec protocol will need to have that. 1 API from bgp zebra has been done to get the table chunk. Internally, onec flowspec is enabled, the BGP engine will try to connect smoothly to the table manager. If zebra is not connected, it will try to connect 10 seconds later. If zebra is connected, and it is success, then a polling mechanism each 60 seconds is put in place. All the internal mechanism has no impact on the BGP process. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-29lib: add framework for allocating routing table identifier IDsPhilippe Guibert
The library changes add 3 new messages to exchange between daemons and ZEBRA. - ZEBRA_TABLE_MANAGER_CONNECT, - ZEBRA_GET_TABLE_CHUNK, - ZEBRA_RELEASE_TABLE_CHUNK, the need is that routing tables identifier are shared by various services. For the current case, policy routing enhancements are planned to be used in FRR. Poliy routing relies on routing tables identifiers from kernels. It will be mainly used by the future policy based routing daemon, but not only. In the flowspec case, the BGP will need also to inject policy routing information into specific routing tables. For that, the proposal is made to let zebra give the appropriate range that is needed for all daemons. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-28lib: Remove backwards compatiblity at 1 yearDonald Sharp
These macro's have existed for 1 year now and can be removed. 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-23zebra: handle the zebra netns delete notificationsPhilippe Guibert
Upon a 'ip netns del' event, the associated vrf with netns backend is looked for, then the internal contexts are first disabled, then suppressed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-20Merge pull request #1913 from LabNConsulting/working/master/bgp-vpn-leak-cliDonald Sharp
bgpd: new vpn-policy CLI
2018-03-19bgpd: new vpn-policy CLIG. Paul Ziemba
PR #1739 added code to leak routes between (default VRF) VPN safi and unicast RIBs in any VRF. That set of changes included temporary CLI including vpn-policy blocks to specify RD/RT/label/&c. After considerable discussion, we arrived at a consensus CLI shown below. The code of this PR implements the vpn-specific parts of this syntax: router bgp <as> [vrf <FOO>] address-family <afi> unicast rd (vpn|evpn) export (AS:NN | IP:nn) label (vpn|evpn) export (0..1048575) rt (vpn|evpn) (import|export|both) RTLIST... nexthop vpn (import|export) (A.B.C.D | X:X::X:X) route-map (vpn|evpn|vrf NAME) (import|export) MAP [no] import|export [vpn|evpn|evpn8] [no] import|export vrf NAME User documentation of the vpn-specific parts of the above syntax is in PR #1937 Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2018-03-16lib, zebra: Signal the existence of labels on a nexthop for nhtDonald Sharp
When we are signaling to a client from zebra that a nexthop has changed, include the labels on the nexthop as well. Upper level protocols need to know if the labels exist in order to make intelligent decisions about what to do. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14Merge branch 'master' into working/master/bgp-vpn-vrf-leakingpaulzlabn
2018-03-14Merge pull request #1863 from donaldsharp/more_nh_groupsPhilippe Guibert
More nh groups
2018-03-14lib: Fixup strlcat and strlcpy to be a bit more descriptiveDonald Sharp
When I use these functions and am programming on linux I always have to pull up a man page for these two functions since they exist in *BSD land only. Modify the name of the size variable to destsize on pass in to give me the small hint I need to know what to do. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Add the ability for other people to call a nexthop write lineDonald Sharp
Add code to allow nexthops to be written by people who are interested in writing their own nexthop line. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Expose nhgc_find commandDonald Sharp
Expose to the world the nhgc_find command so that interested parties can find a stored nexthop group. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14lib: Add nexthop-group cliDonald Sharp
Add a nexthop-group cli: nexthop-group NAME nexthop A nexthop B nexthop C ! This will allow interested parties to hook into the cli for nexthops. Users can add callback functions for add/delete of a nexthop group as well as add/delete of each individual nexthop. Future work( PBR and static routes ) will take advantage of this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-14Merge pull request #1880 from pguibert6WIND/enforce_vrf_netns_enableDonald Sharp
lib: enforce vrf netns if setns() returns ok
2018-03-13Merge pull request #1831 from qlyoung/frr-pthread-fixupsRenato Westphal
lib: some frr_pthread fixes
2018-03-13lib: privileges are granted to vty netns commandPhilippe Guibert
Vty commands that link netns context to a vrf is requiring some privileges. The change consists in retrieving the privileges at the vrf_cmd_init() called by the relevant daemon. Then use it. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-03-13Merge pull request #1806 from vivek-cumulus/evpn-ipv6-tenant-routingPhilippe Guibert
*: EVPN symmetric routing for IPv6 tenant routes
2018-03-12Merge pull request #1860 from qlyoung/debug-mt-safeRenato Westphal
lib: add convenience debugging macros
2018-03-12Merge pull request #1828 from qlyoung/zapi-cleanupRenato Westphal
zebra: giant zapi cleanup
2018-03-12tests: add unit test for zlogQuentin Young
Just tests zlog_hexdump right now Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12lib: fixup zlog_hexdumpQuentin Young
* Allocate correct amount of memory * Use snprintf() instead of sprintf() Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12lib, zebra: slight cleanup after rebaseQuentin Young
Rebased zapi-cleanup, needs a bit of poking. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-12lib, zebra: clean up zapi nitsQuentin Young
* Get correct data size when parsing VRF ids * Move some vars into smaller scope Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>