summaryrefslogtreecommitdiffstats
path: root/lib (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Don Slice2016-02-103-2/+139
|\ | | | | | | into cmaster
| * lib: Add library code to interact with systemdDonald Sharp2016-02-103-2/+139
| | | | | | | | | | | | | | | | | | | | Modify the lib/ code to include the ability to interact with systemd. Provide the ability to interact with systemd's watchdog timer as well. There is no code here that actually uses this change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | zebra: fix interface lookup for vrf configurationDon Slice2016-02-103-9/+46
|/ | | | | | | | | | | | Ticket:CM-9073 Reviewed By: sharpd Testing Done:Manual, see ticket Changed logic when "interface swpxx <vrf foo>" entered so that: 1. it matches when the command is entered without a vrf but the interface already exists in a vrf. 2. If the command is entered with a vrf name that is different than is defined by the kernel, the command is rejected. 3. If the call is made from other than the vty session, believe the new information and update the vrf accordingly.
* lib, vtysh, zebra: Better VRF debug handlingDonald Sharp2016-02-034-12/+100
| | | | | | | | | | | | Fixup the debug handling of vrf's to be a bit more explicit how we create a vrf internally. Add code to turn on/off debugging of vrf's. Ticket: CM-9063 Testing: Manual Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Add callbacks for vrf changes into protocol sideDonald Sharp2016-02-012-0/+38
| | | | | | | Allow protocols to get callbacks associated with vrf's Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: The Bulk of the conversion over to NS and VRFDonald Sharp2016-02-011-1/+3
| | | | | | | Convert the rest of zebra over to use a Namespae and VRF. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Allow vrf under the cliDonald Sharp2016-02-014-3/+93
| | | | | | | Add the infrastructure to allow the vrf keyword. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, zebra: Abstract vrf.c to handle both vrf_id_t and char *nameDonald Sharp2016-02-012-67/+333
| | | | | | | | Abstract vrf.c code to allow pass in a vrf name as well as to start the coding of how namespaces and vrf's will interact. Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: Allow zclient do-over of connect on initial attemptDonald Sharp2016-01-221-1/+15
| | | | | | | | | | | | | When a protocol is attempting to connect to the zebra daemon through it's socket. If the inital attempt fails, give it a few more attempts before giving up and leaving the daemon in a bizarre state. This problem was found by Ashley Penney, and Ashley was of immense help in debugging and testing the fix for this issue. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Tested-by: Ashley Penney <apenney@ntoggle.com>
* lib:removed onmatch next and onmatch goto from route-map denyDon Slice2016-01-131-2/+18
| | | | | | | | | | Ticket: CM-7566 Reviewed By: Daniel Walton, Donald Sharp Testing Done: Manual testing - see bug Since on a route-map deny clause, the route-map will end on match, the on-match next and on-match goto statements are meaningless and confusing. Removed them. Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
* lib: Add CMD_RANGE_STR macro to command.hDonald Sharp2015-12-081-0/+11
| | | | | | | | | | Allow the auto-generation of a "<X-Y>" string for cli handline. Where X or Y can be a #define. CMD_RANGE_STR(LOW, HIGH) translates to: "<4-99>" Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ZEBRA: Remove NEXTHOP_TYPE_XXX_IFNAMEDonald Sharp2015-12-043-21/+6
| | | | | | | 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>
* Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Donald Sharp2015-11-273-19/+108
|\ | | | | | | into cmaster
| * Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Donald Sharp2015-11-274-42/+25
| |\ | | | | | | | | | into cmaster
| | * Should be able to "no" the full text of any config lineDaniel Walton2015-11-231-4/+24
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-5816
| * | Quagga: Nexthop refactoringDonald Sharp2015-11-272-15/+84
| | | | | | | | | | | | | | | | | | Upstream wanted some nexthop code to be refactored. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | Quagga: prefix2str fixupDonald Sharp2015-11-233-4/+13
| | | | | | | | | | | | | | | | | | | | | During CR for nexthop upstream it was noticed that usage of prefix2str was not consistent. This fixes this problem Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | Quagga: Fixup some compile warningsDonald Sharp2015-11-231-3/+3
| | | | | | | | | | | | | | | | | | Fixup compile warnings for when you turn on --enable-gcc-ultra-verbose=yes Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | lib: Fixup of NULL calls to XSTRDUPDonald Sharp2015-11-232-7/+14
| |/ |/| | | | | | | | | | | | | | | | | | | There are a few situations where XSTRDUP can be called with a NULL This fix makes this impossible to happen Ticket: CM-8039 Reviewed-by: CCR-3849 Testing: Rip no longer crashes Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Donald Sharp2015-11-201-1/+1
|\ \ | | | | | | | | | into cmaster
| * | lib: Fixup a compiler warning on netbsdDonald Sharp2015-11-201-1/+1
| |/ | | | | | | | | | | This code has a compiler warning on some oddball platforms Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* / Quagga: Fixup decision about what an unnumbered interface isDonald Sharp2015-11-202-37/+0
|/ | | | | | | | | | | | This Change modifies what zebra thinks is an unnumbered interface. If the interface is not a loopback and the prefixlength for the interface is 32 than consider this an unnumbered interface. Ticket: CM-8016 Reviewed by: CCR-3827 Testing: Full Regression Suites Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga: Fixup cli and json keywordDonald Sharp2015-11-192-0/+19
| | | | | | | | | | | | | | | | | | | | The json keyword was being read incorrectly. Basically some commands read a variable # of arguments and in ospf the command values were being placed into argc and argv. With a variable # of arguments their existed a possibility that less arguments would be read from the cli than were being tested for in the command function handler. This caused core dumps in some situations. All code to read to decide to use the json keyword has been centralized through a function and all code converted to use it, irrelevant if it exhibited the bug Ticket: CM-8278 Reviewed by: CCR-3830 Testing: OSPF no longer crashes and all other test suites still run Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Zebra: Remove reliance on NEXTHOP_TYPE_IPV4_ONLINKDonald Sharp2015-11-162-18/+1
| | | | | | | | | | | | | | | | | Zebra already knows if an interface is unnumbered or not. This is communicated to OSPF. OSPF would only send a NEXTHOP_TYPE_IPV4_ONLINK *if* the path was unnumbered, which it learns from Zebra. As such, Have OSPF use the normal NEXTHOP_TYPE_IPV4_IFINDEX type for unnumbered paths. In Zebra, if the ifindex recieved is unnumbered then assume that the link is NEXTHOP_FLAG_ONLINK. Ticket: CM-8145 Reviewed-by: CCR-3771 Testing: See bug Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Quagga crash in prefix_list_applyDaniel Walton2015-11-061-1/+2
| | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-8130
* BGP: support for addpath TXDaniel Walton2015-11-052-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Vivek Venkataraman <vivek@cumulusnetworks.com Ticket: CM-8014 This implements addpath TX with the first feature to use it being "neighbor x.x.x.x addpath-tx-all-paths". One change to show output is 'show ip bgp x.x.x.x'. If no addpath-tx features are configured for any peers then everything looks the same as it is today in that "Advertised to" is at the top and refers to which peers the bestpath was advertise to. root@superm-redxp-05[quagga-stash5]# vtysh -c 'show ip bgp 1.1.1.1' BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Advertised to non peer-group peers: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Last update: Fri Oct 30 18:26:44 2015 [snip] but once you enable an addpath feature we must display "Advertised to" on a path-by-path basis: superm-redxp-05# show ip bgp 1.1.1.1/32 BGP routing table entry for 1.1.1.1/32 Paths: (6 available, best #6, table Default-IP-Routing-Table) Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r2(10.0.0.2) (10.0.0.2) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 8 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:44 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r3(10.0.0.3) (10.0.0.3) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 7 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r6(10.0.0.6) (10.0.0.6) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 6 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 56.56.56.56 (metric 20) from r5(10.0.0.5) (10.0.0.5) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 5 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 34.34.34.34 (metric 20) from r4(10.0.0.4) (10.0.0.4) Origin IGP, metric 0, localpref 100, valid, internal AddPath ID: RX 0, TX 4 Advertised to: r8(10.0.0.8) Last update: Fri Oct 30 18:26:39 2015 Local, (Received from a RR-client) 12.12.12.12 (metric 20) from r1(10.0.0.1) (10.0.0.1) Origin IGP, metric 0, localpref 100, valid, internal, best AddPath ID: RX 0, TX 3 Advertised to: r1(10.0.0.1) r2(10.0.0.2) r3(10.0.0.3) r4(10.0.0.4) r5(10.0.0.5) r6(10.0.0.6) r8(10.0.0.8) Last update: Fri Oct 30 18:26:34 2015 superm-redxp-05#
* Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Vipin Kumar2015-11-045-164/+379
|\ | | | | | | into cmaster
| * lib: Fix missing plist_int.hDonald Sharp2015-11-031-0/+78
| | | | | | | | Signed-off-by: Donald Sharpd <sharpd@cumulusnetworks.com>
| * lib: optimise prefix list setupDavid Lamparter2015-11-031-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | - duplicate prefix check can use the trie structure - appending with a seq# beyond the end of the list can shortcut Configuration load is now bottlenecked by cmd_element_match() and strcmp(). For a real-world routeserver prefix list configuration (38668 lines of config for multiple prefix lists): before: 4.73s after: 1.92s x 2.46 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lib: use trie structure for prefix list matchingDavid Lamparter2015-11-032-15/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefix lists were implemented with a simple linear list that is scanned sequentially. This is, of course, extremely inefficient as it scales by O(n). This patch adds a trie-ish data structure that allows quickly descending based on the prefix. Note that the trie structure used here is designed for real-world use, hence it uses a relatively crude fixed-size bytewise table instead of some fancy balancing scheme. It is quite cacheline efficient. Using real-world routeserver prefix lists, matching against a fulltable dump: entries before after factor 9103 63.8s .0124s 5142x 772 4.52s .0101s 445.3x 86 .445s .0098s 45.51x 7 .0379s .0099s 3.834x 2 .0136s .0095s 1.440x 1 .0084s .0095s .879x This buys CPU with memory. Memory usage on an IXP setup with 100k prefix list entries is an additional 4 MB on top of the 9.5 MB that it was before.
| * lib: straighten out ORF prefix list supportDavid Lamparter2015-11-032-101/+53
| | | | | | | | | | | | | | | | BGP ORF prefix lists are in a separate namespace; this was previously hooked up with a special-purpose AFI value. This is a little kludgy for extension, hence this splits it off. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * lib: hide internal prefix list structuresDavid Lamparter2015-11-033-43/+11
| | | | | | | | | | | | | | These are about to be touched and there's no point in other code touching into prefix list's internas. Add some isolation. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: add VRF ID in the API message headerFeng Lu2015-11-048-160/+343
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API messages are used by zebra to exchange the interfaces, addresses, routes and router-id information with its clients. To distinguish which VRF the information belongs to, a new field "VRF ID" is added in the message header. And hence the message version is increased to 3. * The new field "VRF ID" in the message header: Length (2 bytes) Marker (1 byte) Version (1 byte) VRF ID (2 bytes, newly added) Command (2 bytes) - Client side: - zclient_create_header() adds the VRF ID in the message header. - zclient_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the callback functions registered to the API messages. - All relative functions are appended with a new parameter "vrf_id", including all the callback functions. - "vrf_id" is also added to "struct zapi_ipv4" and "struct zapi_ipv6". Clients need to correctly set the VRF ID when using the API functions zapi_ipv4_route() and zapi_ipv6_route(). - Till now all messages sent from a client have the default VRF ID "0" in the header. - The HELLO message is special, which is used as the heart-beat of a client, and has no relation with VRF. The VRF ID in the HELLO message header will always be 0 and ignored by zebra. - Zebra side: - zserv_create_header() adds the VRF ID in the message header. - zebra_client_read() extracts and validates the VRF ID from the header, and passes the VRF ID to the functions which process the received messages. - All relative functions are appended with a new parameter "vrf_id". * Suppress the messages in a VRF which a client does not care: Some clients may not care about the information in the VRF X, and zebra should not send the messages in the VRF X to those clients. Extra flags are used to indicate which VRF is registered by a client, and a new message ZEBRA_VRF_UNREGISTER is introduced to let a client can unregister a VRF when it does not need any information in that VRF. A client sends any message other than ZEBRA_VRF_UNREGISTER in a VRF will automatically register to that VRF. - lib/vrf: A new utility "VRF bit-map" is provided to manage the flags for VRFs, one bit per VRF ID. - Use vrf_bitmap_init()/vrf_bitmap_free() to initialize/free a bit-map; - Use vrf_bitmap_set()/vrf_bitmap_unset() to set/unset a flag in the given bit-map, corresponding to the given VRF ID; - Use vrf_bitmap_check() to test whether the flag, in the given bit-map and for the given VRF ID, is set. - Client side: - In "struct zclient", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] default_information These flags are extended for each VRF, and controlled by the clients themselves (or with the help of zclient_redistribute() and zclient_redistribute_default()). - Zebra side: - In "struct zserv", the following flags are changed from "u_char" to "vrf_bitmap_t": redist[ZEBRA_ROUTE_MAX] redist_default ifinfo ridinfo These flags are extended for each VRF, as the VRF registration flags. They are maintained on receiving a ZEBRA_XXX_ADD or ZEBRA_XXX_DELETE message. When sending an interface/address/route/router-id message in a VRF to a client, if the corresponding VRF registration flag is not set, this message will not be dropped by zebra. - A new function zread_vrf_unregister() is introduced to process the new command ZEBRA_VRF_UNREGISTER. All the VRF registration flags are cleared for the requested VRF. Those clients, who support only the default VRF, will never receive a message in a non-default VRF, thanks to the filter in zebra. * New callback for the event of successful connection to zebra: - zclient_start() is splitted, keeping only the code of connecting to zebra. - Now zclient_init()=>zclient_connect()=>zclient_start() operations are purely dealing with the connection to zbera. - Once zebra is successfully connected, at the end of zclient_start(), a new callback is used to inform the client about connection. - Till now, in the callback of connect-to-zebra event, all clients send messages to zebra to request the router-id/interface/routes information in the default VRF. Of corse in future the client can do anything it wants in this callback. For example, it may send requests for both default VRF and some non-default VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> Conflicts: lib/zclient.h lib/zebra.h zebra/zserv.c zebra/zserv.h Conflicts: bgpd/bgp_nexthop.c bgpd/bgp_nht.c bgpd/bgp_zebra.c isisd/isis_zebra.c lib/zclient.c lib/zclient.h lib/zebra.h nhrpd/nhrp_interface.c nhrpd/nhrp_route.c nhrpd/nhrpd.h ospf6d/ospf6_zebra.c ospf6d/ospf6_zebra.h ospfd/ospf_vty.c ospfd/ospf_zebra.c pimd/pim_zebra.c pimd/pim_zlookup.c ripd/rip_zebra.c ripngd/ripng_zebra.c zebra/redistribute.c zebra/rt_netlink.c zebra/zebra_rnh.c zebra/zebra_rnh.h zebra/zserv.c zebra/zserv.h
* Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Donald Sharp2015-10-3011-110/+864
|\ | | | | | | | | | | | | | | | | into cmaster Conflicts: zebra/rib.h zebra/zebra_rib.c zebra/zebra_vty.c
| * zebra, lib/memtypes.c: the netlink sockets work per VRFFeng Lu2015-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch lets the netlink sockets work per VRF. * The definition of "struct nlsock" is moved into zebra/rib.h. * The previous global variables "netlink" and "netlink_cmd" now become the members of "struct zebra_vrf", and are initialized in zebra_vrf_alloc(). * All relative functions now work for a specific VRF, by adding a new parameter which specifies the working VRF, except those functions in which the VRF ID can be obtained from the interface. * kernel_init(), interface_list() and route_read() are now also working per VRF, and moved from main() to zebra_vrf_enable(). * A new function kernel_terminate() is added to release the netlink sockets. It is called from zebra_vrf_disable(). * Correct VRF ID, instead of the previous VRF_DEFAULT, are now passed to the functions of processing interfaces or route entries. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> Conflicts: lib/memtypes.c zebra/rib.h zebra/rt_netlink.c Conflicts: zebra/if_netlink.c zebra/if_sysctl.c zebra/kernel_null.c zebra/rib.h zebra/rt_netlink.c zebra/rt_netlink.h
| * lib/vrf: enable / disable a VRFFeng Lu2015-10-302-1/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new API vrf_is_enabled() is defined to check whether a VRF is ready to use, that is, to allocate resources in that VRF. Currently there's only one type of resource: socket. Two new hooks VRF_ENABLE_HOOK/VRF_DISABLE_HOOK are introduced to tell the user when a VRF gets ready or to be unavailable. The VRF_ENABLE_HOOK callback is called in the new function vrf_enable(), which is used to let the VRF be ready to use. Till now, only the default VRF can be enabled, and we need do nothing to enable the default, except calling the hook. The VRF_DISABLE_HOOK callback is called in the new function vrf_disable(), which is used to let the VRF be unusable. Till now, it is called only when the VRF is to be deleted. A new utility vrf_socket() is defined to provide a socket in a given VRF to the user. Till now before introducing a way of VRF realization, only the default VRF is enabled since its birth, and vrf_socket() creates socket for only the default VRF. This patch defines the framework of the VRF APIs. The way they serve the users is: - vrf_is_enabled() is used to tell the user whether a VRF is usable; - users are informed by the VRF_ENABLE_HOOK that a VRF gets usable; they can allocate resources after that; - users are informed by the VRF_DISABLE_HOOK that a VRF is to be unavailable, and they must release the resources instantly; - vrf_socket() is used to provide a socket in a given VRF. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * zebra: let FIB stand for its respective VRFFeng Lu2015-10-302-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new member "vrf_id" is added to "struct rib", reflecting the VRF which it belongs to. A new parameter "vrf_id" is added to the relative functions where need, except those: - which already have the parameter "vrf_id"; or - which have a parameter in type of "struct rib"; or - which have a parameter in type of "struct interface". All incoming routes are set to default VRF. In fact, all routes in FIB are kept in default VRF. And the logic is not changed. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> [DL: conflicts fixed + compile warning fix] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: zebra/connected.c zebra/kernel_socket.c zebra/rib.h zebra/rt_netlink.c zebra/zebra_rib.c zebra/zserv.c Conflicts: zebra/connected.c zebra/interface.c zebra/kernel_socket.c zebra/rib.h zebra/rt_netlink.c zebra/rtread_getmsg.c zebra/zebra_rib.c zebra/zebra_vty.c zebra/zserv.c
| * lib, zebra, vtysh: configure an interface in non-default VRFFeng Lu2015-10-302-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new command "interface IFNAME vrf N" to configure an interface in the non-default VRF. Till now, only zebra uses this command. Other daemons will install the command when they support multiple VRFs. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: zebra/interface.c
| * lib: move the interface list into "struct vrf"Feng Lu2015-10-304-58/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An interface belongs to a specific VRF. So move the interface list into the "struct vrf". * vrf.c/vrf.h: - add a new member "struct list *iflist" to the the "struct vrf"; - call if_init() in vrf_new(); - call if_terminate() in vrf_delete(); - add utilities to access the interface list and VRF ID in the specified VRF. * if.c/if.h: - the global "iflist" now only exists for the default VRF; - the global "if_master" is initialized on the definition; - in if_create(), the interface is added into the list in the specified VRF; if the VRF does not exist, create one; - add parameters to if_init()/if_terminate() so that the interface list in the VRF can be initialized/destroyed; - in if_dump_all() scan the interfaces in all the VRFs; - add a command "show address vrf N" to show addresses in a specified VRF; - add a command "show address vrf all" to show addresses in all VRFs; - new APIs ifxxx_vrf() are added to access an interface in a specified VRF. The old interface APIs (the global variable "iflist" and the API functions) are not changed to keep the backward compatibility. The new APIs are used in the daemons which support multiple VRFs (till now only zebra). Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: lib/if.c
| * *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()Feng Lu2015-10-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Later, an interface will belong to a specific VRF, and the interface initialization will be a part of the VRF initialization. So now call if_init() from vrf_init(), and if_terminate() from vrf_terminate(). Daemons have the according changes: - if if_init() was called or "iflist" was initialized, now call vrf_init() instead; - if if_terminate() was called or "iflist" was destroyed, now call vrf_terminate() instead. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: bgpd/bgp_main.c pimd/pim_iface.c pimd/pim_iface.h pimd/pim_main.c pimd/pimd.c
| * lib, zebra: add "vrf_id" into the "struct interface"Feng Lu2015-10-302-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Later, an interface will belong to a specific VRF. Now we add a property "vrf_id" to the "struct interface", and keep it as the default value 0. This property is shown when displaying interfaces information. It is also added in some logs. This is just the preparation to move the interace list into the "struct vrf". The main logic is not changed. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: lib/if.c zebra/interface.c
| * lib, zebra: move "struct vrf" to be a lib moduleFeng Lu2015-10-305-4/+372
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously "struct vrf" is defined locally in zebra. Now it is moved to be a lib module. This is the first step to support multi-VRF in quagga. The implementation is splitted into small patches for the purpose of easy review. * lib: "struct vrf" with basic members is defined in vrf.c. The member "void *info" is for user data. Some basic functions are defined in vrf.c for adding/deleting/ looking up a VRF, scanning the VRF table and initializing the VRF module. The type "vrf_id_t" is defined specificly for VRF ID. * zebra: The previous "struct vrf" is re-defined as "struct zebra_vrf"; and previous "vrf" variables are renamed to "zvrf". The previous "struct vrf" related functions are removed from zbera_rib.c. New functions are defined to maintain the new "struct zebra_vrf". The names vrf_xxx are reserved for the functions in VRF module. So: - the previous vrf_table() are renamed to zebra_vrf_table(); - the previous vrf_static_table() are renamed to zebra_vrf_static_table(). The main logic is not changed. BTW: Add a statement to zebra_snmp.c telling that the SNMP is running only for the MIBs in the default VRF. Signed-off-by: Feng Lu <lu.feng@6wind.com> Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Conflicts: lib/Makefile.am zebra/zebra_rib.c zebra/zebra_vty.c Conflicts: lib/Makefile.am lib/memtypes.c zebra/rib.h zebra/zebra_rib.c zebra/zebra_rnh.c zebra/zebra_rnh.h zebra/zebra_vty.c
| * lib: Memory reporting fails over 2GBDonald Sharp2015-10-291-28/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ticket: CM-8015 Reviewed by: CCR-3717 Testing: See bug The old style mallinfo() function uses an 'int' to report memory usage data to the program. Unfortunately modern architectures can chew through 2gb of memory like a buzz saw hitting some warm butter, especially in the case of a memory leak or memory fragmentation. When a daemon uses more than 2gb of memory, just indicate it's gotten large and we don't know anymore. Pre-change behavior: Robot-1# show memory System allocator statistics: Total heap allocated: 16777216 TiB Holding block headers: 1288 KiB Used small blocks: 0 bytes Used ordinary blocks: 535 MiB Free small blocks: 768 bytes Free ordinary blocks: 16777216 TiB Ordinary blocks: 266107 Small blocks: 24 Holding blocks: 2 Post-change behavior: Robot-1# show memory System allocator statistics: Total heap allocated: 1572 KiB Holding block headers: > 2GB Used small blocks: 0 bytes Used ordinary blocks: 1443 KiB Free small blocks: 32 bytes Free ordinary blocks: 129 KiB Ordinary blocks: 2 Small blocks: 1 Holding blocks: 2 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * BGP: route-map scaleDaniel Walton2015-10-281-16/+73
| | | | | | | | | | | | | | | | | | | | - use a hash to store the route-maps - reduce the number of route_map_lookup_by_name() calls in BGP Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-7407
* | Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga ↵Donald Sharp2015-10-243-30/+49
|\| | | | | | | into cmaster
| * lib: zlog_hexdump actually output printable ascii charactersDonald Sharp2015-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are getting this output from zlog_hexdump: 0x00007fffdd1f9648: 45 00 00 94 ee 63 40 00 45....6340. 0x00007fffdd1f9650: 03 00 ff 0a 14 00 0f fd ........ 0x00007fffdd1f9658: e8 01 01 01 45 00 00 80 ....45... 0x00007fffdd1f9660: ee 63 40 00 0a 11 75 0a .6340...75. 0x00007fffdd1f9668: 14 00 0f fd e8 01 01 01 ........ 0x00007fffdd1f9670: 10 e1 10 e1 00 6c d0 54 .....6c.54 0x00007fffdd1f9678: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f9680: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f9688: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f9690: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f9698: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96a0: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96a8: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96b0: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96b8: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96c0: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96c8: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96d0: 00 00 00 00 00 00 00 00 ........ 0x00007fffdd1f96d8: 00 00 00 00 .... As you can see the ascii dump on the right is wrong and not lined up correctly. This commit fixes this issue: 0x00007ffcf046f228: 45 00 00 58 c6 36 40 00 E..X.6@. 0x00007ffcf046f230: 03 00 ff 73 14 00 0f fd ...s.... 0x00007ffcf046f238: e8 01 01 01 45 00 00 44 ....E..D 0x00007ffcf046f240: c6 36 40 00 0a 11 9d 73 .6@....s 0x00007ffcf046f248: 14 00 0f fd e8 01 01 01 ........ 0x00007ffcf046f250: 10 e1 10 e1 00 30 d0 cc .....0.. 0x00007ffcf046f258: 00 00 00 00 00 00 00 00 ........ 0x00007ffcf046f260: 00 00 00 00 00 00 00 00 ........ 0x00007ffcf046f268: 00 00 00 00 00 00 00 00 ........ 0x00007ffcf046f270: 00 00 00 00 00 00 00 00 ........ 0x00007ffcf046f278: 00 00 00 00 00 00 00 00 ........ Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * Quagga needs better debugs in lib/sockunion.cDaniel Walton2015-10-231-23/+27
| | | | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh G Dutt <ddutt@cumulusnetworks.com> Ticket: CM-7233
| * Use a hash to store BGP peer structuresDaniel Walton2015-10-232-0/+7
| | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-5370
| * Addition of missing zebra command descriptionsradhika2015-10-221-6/+14
| | | | | | | | | | | | | | | | | | | | Ticket: CM-7456 Reviewed By: CCR-3528 Testing Done: Unit Porting of the patch zebra-fix-cmd-type-desc-log.patch from 2.5 branch Last few Zebra message command types defined were not added to the command type description table used for getting logging strings. This was causing the logs to display "unknown command type" instead of the actual command type. So, added all the missing zebra commands to the command type description table. Also, changed the order of the description table to match with the actual command type definition order.
* | zebra: Remove HAVE_IPV6 from rib.h and zebra_rib.cDonald Sharp2015-10-231-2/+0
| | | | | | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>