summaryrefslogtreecommitdiff
path: root/zebra/zebra_router.c
AgeCommit message (Collapse)Author
2019-05-06doc, zebra: Remove "table X" commandDonald Sharp
This command is broken and has been broken since the introduction of vrf's. Since no-one has complained it is safe to assume that there is no call for this specialized linux command. Remove from the system with extreme prejudice. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-04-09zebra: avoid removing node twice from rb_treeChirag Shah
In zebra terminate path, the node was attempted to remove twice from the RB_TREE table. This lead to a crash during zebra shutdown zebra_router_free_table already calls RB_REMOVE to remove a node from rb tree table. siginfo=0x7fffd9134a30, context=<optimized out>) at lib/sigevent.c:249 rbt=<optimized out>, t=<optimized out>) at lib/openbsd-tree.c:226 t=0x56296965ff50 <zebra_router_table_head_RB_INFO>) at lib/openbsd-tree.c:383 rbt=rbt@entry=0x562969669bd0 <zrouter+16>, elm=elm@entry=0x56296afcf810) at lib/openbsd-tree.c:393 (elm=0x56296afcf810, head=0x562969669bd0 <zrouter+16>) at zebra/zebra_router.h:46 Singned-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2019-03-27zebra: zebra_router.c does not own the data plane shutdown of tablesDonald Sharp
When shutting down, the individual vrf's own the shutdown of the table and subsuquent removal from the routes from the kernel. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-03-01zebra: Upon vrf deletion, actually release this data.Donald Sharp
When a vrf is deleted we need to tell the zebra_router that we have finished using the tables we are keeping track of. This will allow us to properly cleanup the data structures associated with them. This fixes this valgrind error found: ==8579== Invalid read of size 8 ==8579== at 0x430034: zvrf_id (zebra_vrf.h:167) ==8579== by 0x432366: rib_process (zebra_rib.c:1580) ==8579== by 0x432366: process_subq (zebra_rib.c:2092) ==8579== by 0x432366: meta_queue_process (zebra_rib.c:2188) ==8579== by 0x48C99FE: work_queue_run (workqueue.c:291) ==8579== by 0x48C3788: thread_call (thread.c:1607) ==8579== by 0x48A2E9E: frr_run (libfrr.c:1011) ==8579== by 0x41316A: main (main.c:473) ==8579== Address 0x5aeb750 is 0 bytes inside a block of size 4,424 free'd ==8579== at 0x4839A0C: free (vg_replace_malloc.c:540) ==8579== by 0x438914: zebra_vrf_delete (zebra_vrf.c:279) ==8579== by 0x48C4225: vrf_delete (vrf.c:243) ==8579== by 0x48C4225: vrf_delete (vrf.c:217) ==8579== by 0x4151CE: netlink_vrf_change (if_netlink.c:364) ==8579== by 0x416810: netlink_link_change (if_netlink.c:1189) ==8579== by 0x41C1FC: netlink_parse_info (kernel_netlink.c:904) ==8579== by 0x41C2D3: kernel_read (kernel_netlink.c:389) ==8579== by 0x48C3788: thread_call (thread.c:1607) ==8579== by 0x48A2E9E: frr_run (libfrr.c:1011) ==8579== by 0x41316A: main (main.c:473) ==8579== Block was alloc'd at ==8579== at 0x483AB1A: calloc (vg_replace_malloc.c:762) ==8579== by 0x48A6030: qcalloc (memory.c:110) ==8579== by 0x4389EF: zebra_vrf_alloc (zebra_vrf.c:382) ==8579== by 0x438A42: zebra_vrf_new (zebra_vrf.c:93) ==8579== by 0x48C40AD: vrf_get (vrf.c:209) ==8579== by 0x415144: netlink_vrf_change (if_netlink.c:319) ==8579== by 0x415E90: netlink_interface (if_netlink.c:653) ==8579== by 0x41C1FC: netlink_parse_info (kernel_netlink.c:904) ==8579== by 0x4163E8: interface_lookup_netlink (if_netlink.c:760) ==8579== by 0x42BB37: zebra_ns_enable (zebra_ns.c:130) ==8579== by 0x42BC5E: zebra_ns_init (zebra_ns.c:208) ==8579== by 0x4130F4: main (main.c:401) This can be found by: `ip link del <VRF DEVICE NAME>` then `ip link add <NAME> type vrf table X` again and then attempting to use the vrf. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31zebra: Move packets_to_process to zrouterDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31zebra: Move the mq data structure to zrouterDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31zebra: Move ribq from zebrad to zrouterDonald Sharp
The zrouter should own this data structure and it should not be defined in zserv.h Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-31zebra: Move rtm_table_default to zrouterDonald Sharp
The zrouter should own this particular piece of data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-24zebra: Add code to track sequence number from zebra_routerDonald Sharp
The sequence number used should be unique and increase by 1 for netlink commands. This will allow the code to match up batched commands to actual requests, so that we can signal the failure correctly back. So start the movement and tracking of sequence numbers as an atomic uint32_t in zebra_router. Modify the dataplane code to start tracking contexts from this value. In future commits we will move more of the sequencing data into using this value. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-14Merge pull request #3567 from donaldsharp/cleanup_route_table_creationRenato Westphal
Route Table Handling and shows
2019-01-04zebra: Add some small infrastructure to get the mlag code in zebra startedDonald Sharp
Add a zebra_mlag.h and a zebra_mlag.c startup/shutdown code to zebra. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04zebra: Add a dump table information command to zebraDonald Sharp
Allow zebra to dump the table information it has from a router perspective. This table looks like this: donna.cumulusnetworks.com# show zebra router table summary VRF NS ID VRF ID AFI SAFI Table Count --------------------------------------------------------------------------- default 0 0 IPv4 unicast 49 1 default 0 0 IPv4 unicast 254 7 default 0 0 IPv4 multicast 254 9 default 0 0 IPv6 unicast 254 1 default 0 0 IPv6 multicast 254 1 BLUE 0 31 IPv4 unicast 1005 0 BLUE 0 31 IPv4 multicast 1005 0 BLUE 0 31 IPv6 unicast 1005 0 BLUE 0 31 IPv6 multicast 1005 0 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-01-04zebra: Store actual safi in info pointer and don't free then remallocDonald Sharp
When we call zebra_vrf_table_create, we've already created the info pointer in zebra_router_get_table, so properly set the info->safi and just store the zvrf->table[afi][safi] value. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-12-17zebra: avoid initialising more than one the l3vni hash structurePhilippe Guibert
the l3vni structure is allocated only once, since that structure is only used for default netns. For that, move the initialisation part is moved to a proper place, where there is no risk of attempting to initialise it more than once, even when vrf backend is netns. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-10-28zebra: fix zebra router memleaksQuentin Young
* Correctly set safi to prevent duplicate allocations * Free previously allocated table->info before overwriting it Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-10-24zebra: Move ipset_hash, ipset_entry_hash and iptable_hash into zrouterDonald Sharp
These three data structures belong in the `zebra_router` structure as that they do not belong in `struct zebra_ns`. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24zebra: Move rules_hash to zrouterDonald Sharp
Move the rules_hash to the zrouter data structure and provide the additional bit of work needed to lookup the rule based upon the namespace id as well. Make the callers of functions not care about what namespace id we are in. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-24zebra: Start breakup of zns into zrouter and znsDonald Sharp
The `struct zebra_ns` data structure is being used for both router information as well as support for the vrf backend( as appropriate ). This is a confusing state. Start the movement of `struct zebra_ns` into 2 things `struct zebra_router` and `struct zebra_ns`. In this new regime `struct zebra_router` is purely for handling data about the router. It has no knowledge of the underlying representation of the Data Plane. `struct zebra_ns` becomes a linux specific bit of code that allows us to handle the vrf backend and is allowed to have knowledge about underlying data plane constructs. When someone implements a *bsd backend the zebra_vrf data structure will need to be abstracted to take advantage of this instead of relying on zebra_ns. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>