summaryrefslogtreecommitdiffstats
path: root/ripngd/ripng_interface.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * | ripngd: add VRF supportRenato Westphal2019-01-181-37/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Turn the "instance" YANG presence-container into a YANG list keyed by the new "vrf" leaf. This is a backward incompatible change but this should be ok for now. * RIPng VRF instances can be configured even when the corresponding VRF doesn't exist. And a RIPng VRF instance isn't deleted when the corresponding VRF is deleted. For this to work, implement the ripng_instance_enable() and ripng_instance_disable() functions that are called to enable/disable RIPng routing instances when necessary. A RIPng routing instance can be enabled only when the corresponding VRF is enabled (this information comes from zebra and depends on the underlying VRF backend). Routing instances are stored in the new ripng_instances rb-tree (global variable). * Add a vrf pointer to the ripng structure instead of storing vrf_id only. This is much more convenient than using vrf_lookup_by_id() every time we need to get the vrf pointer from the VRF ID. The ripng->vrf pointer is updated whenever the VRF enable/disable hooks are called. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ripngd: remove the ripng global variableRenato Westphal2019-01-181-56/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the last step to make ripngd ready for multi-instance support. Remove the ripng global variable and add a "ripng" parameter to all functions that need to know the RIPng instance they are working on. On some functions, retrieve the RIPng instance from the interface variable when it exists (this assumes interfaces can pertain to one RIPng instance at most, which is ok for VRF support). In preparation for the next commits (VRF support), add a "vrd_id" member to the ripng structure, and use ripng->vrf_id instead of VRF_DEFAULT wherever possible. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ripngd: move "Vripng_passive_interface" to the ripng structureRenato Westphal2019-01-181-14/+11
| | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ripngd: move "ripng_enable_network" to the ripng structureRenato Westphal2019-01-181-16/+16
| | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * | ripngd: move "ripng_enable_if" to the ripng structureRenato Westphal2019-01-181-19/+14
| | | | | | | | | | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | | *: remove trailing newlines from zlog messagesQuentin Young2019-03-141-2/+2
| |/ |/| | | | | | | | | Zlog puts its own newlines on, and doing this makes logs look nasty. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | Treewide: use ANSI function definitionsRuben Kerkhof2019-01-241-2/+2
|/ | | | Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
* ripngd: fix SIGHUP handlingRenato Westphal2018-12-031-31/+0
| | | | | | | | | Now that all ripngd commands were converted to the new northbound model, the ripngd SIGHUP handler is capable of doing a full configuration reload just by calling the vty_read_config() function. Nothing else should be done in the SIGHUP handler. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ripngd: retrofit the 'split-horizon' command to the new northbound modelRenato Westphal2018-12-031-91/+14
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ripngd: retrofit the 'passive-interface' command to the new northbound modelRenato Westphal2018-12-031-42/+9
| | | | | | Trivial conversion. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* ripngd: retrofit the 'network' command to the new northbound modelRenato Westphal2018-12-031-71/+13
| | | | | | | | | | The frr-ripngd YANG module models the ripngd "network" command using two separate leaf-lists for simplicity: one leaf-list for interfaces and another leaf-list for actual networks. In the 'cli_show' callbacks, display the "network" command for entries of both leaf-lists. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* bgpd, ripngd: Convert to using new agg_table/routeDonald Sharp2018-08-301-26/+28
| | | | | | | | Switch bgp and ripngd to use the new aggregate table and route data structures. This was mainly a search and replace operation. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use frr_elevate_privs() (1/2: coccinelle)David Lamparter2018-08-141-11/+6
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: rename ferr_zlog -> flog_err_sysQuentin Young2018-08-141-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ripngd: Convert over to using LIB_ERR_XXXX for zlog_ferrDonald Sharp2018-08-141-4/+10
| | | | | | | Convert over those zlog_err functions to zlog_ferr that are appropriate for the LIB_ERR_XXX. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ripngd: variable scope overlap fix (PVS-Studio)F. Aragon2018-07-021-5/+5
| | | | Signed-off-by: F. Aragon <paco@voltanet.io>
* ripngd: Make 'struct zebra_privs_t' availableDonald Sharp2017-10-241-2/+0
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: use the FOR_ALL_INTERFACES abstraction from babeldRenato Westphal2017-10-101-5/+5
| | | | | | | | | | This improves code readability and also future-proofs our codebase against new changes in the data structure used to store interfaces. The FOR_ALL_INTERFACES_ADDRESSES macro was also moved to lib/ but for now only babeld is using it. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: introduce new rb-tree to optimize interface lookup by ifindexRenato Westphal2017-10-101-1/+1
| | | | | | | | | | | | | | | | Performance tests showed that, when running on a system with a large number of interfaces, some daemons would spend a considerable amount of time in the if_lookup_by_index() function. Introduce a new rb-tree to solve this problem. With this change, we need to use the if_set_index() function whenever we want to change the ifindex of an interface. This is necessary to ensure that the 'ifaces_by_index' rb-tree is updated accordingly. The return value of all insert/remove operations in the interface rb-trees is checked to ensure that an error is logged if a corruption is detected. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: eliminate IFINDEX_DELETED in favor of IFINDEX_INTERNALRenato Westphal2017-10-101-1/+1
| | | | | | | | | IFINDEX_DELETED is not necessary anymore as we moved from a global list of interfaces to a list of interfaces per VRF. This reverts commit 84361d615. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: use rb-trees to store interfaces instead of sorted linked-listsRenato Westphal2017-10-101-10/+10
| | | | | | | | | | | This is an important optimization for users running FRR on systems with a large number of interfaces (e.g. thousands of tunnels). Red-black trees scale much better than sorted linked-lists and also store the elements in an ordered way (contrary to hash tables). This is a big patch but the interesting bits are all in lib/if.[ch]. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: remove empty "interface XYZ" config blocksDavid Lamparter2017-08-291-2/+2
| | | | | | | | Using the previously-added vty_frame() support, this gets rid of all the pointless empty "interface XYZ" blocks that get added for any interface that shows up in the system (e.g. dummys, tunnels, etc.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib: replace if_add_hook with hook_* logicDavid Lamparter2017-08-151-2/+2
| | | | | | | This allows modules to register their own additional hooks on interface creation/deletion. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-816/+776
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'frr/master' into newline-reduxDavid Lamparter2017-07-141-4/+4
|\ | | | | | | | | | | Lots of conflicts from CMD_WARNING_CONFIG_FAILED... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * vtysh: return non-zero for configuration failuresDaniel Walton2017-07-131-4/+4
| | | | | | | | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> This allows frr-reload.py (or anything else that scripts via vtysh) to know if the vtysh command worked or hit an error.
* | *: ditch vty_outln(), part 1 of 2David Lamparter2017-07-131-11/+11
|/ | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: use vty_outlnQuentin Young2017-06-291-20/+14
| | | | | | Saves 400 lines Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* ripngd: Let ripng announce interface turned on for usage.Donald Sharp2017-05-281-8/+5
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* ripngd: Fix missing newlines at end of help stringsDonald Sharp2017-05-281-2/+2
| | | | | | Found by visual inspection and some squinting 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>
* *: remove THREAD_ON macros, add nullity checkQuentin Young2017-05-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way thread.c is written, a caller who wishes to be able to cancel a thread or avoid scheduling it twice must keep a reference to the thread. Typically this is done with a long lived pointer whose value is checked for null in order to know if the thread is currently scheduled. The check-and-schedule idiom is so common that several wrapper macros in thread.h existed solely to provide it. This patch removes those macros and adds a new parameter to all thread_add_* functions which is a pointer to the struct thread * to store the result of a scheduling call. If the value passed is non-null, the thread will only be scheduled if the value is null. This helps with consistency. A Coccinelle spatch has been used to transform code of the form: if (t == NULL) t = thread_add_* (...) to the form thread_add_* (..., &t) The THREAD_ON macros have also been transformed to the underlying thread.c calls. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: coccinelle-replace vty->indexDavid Lamparter2016-12-091-6/+3
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge branch 'queue/osr/vtysh-generic'David Lamparter2016-12-051-7/+1
|\ | | | | | | | | | | | | | | WARNING: Merge contains nontrivial fixups in vrf_cmd handling. Conflicts: lib/if.c zebra/interface.c
| * *: make DEFUN installations file-localDavid Lamparter2016-12-011-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves all install_element calls into the file where the DEFUNs are located. This fixes several small related bugs: - ospf6d wasn't installing a "no interface FOO" command - zebra had a useless copy of "interface FOO" - pimd's copy of "interface FOO" was not setting qobj_index, which means "description LINE" commands would fail with an error The next commit will do the actual act of making "foo_cmd" static. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | Merge branch 'stable/2.0'David Lamparter2016-12-051-2/+2
|\ \ | |/ |/| | | | | | | | | | | | | Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
| * ripngd: fix drop of multicast membership when the interface is downRenato Westphal2016-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When an interface is shut down, ripng_multicast_leave() is called after ifp->flags is updated in ripng_interface_down(). So we shouldn't check if the interface is up in order to proceed with the membership drop. For consistency's sake, don't check for if_is_up() in ripng_multicast_join() as well. In this case, this function is only called when the interface is up, so the check was unnecessary. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* | Merge branch 'cmaster-next' into vtysh-grammarQuentin Young2016-10-181-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
| * ripngd: add support for route tagsChristian Franke2016-10-081-3/+3
| | | | | | | | Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* | ripngd: dispose of some CHECK ME's for ripngQuentin Young2016-09-271-13/+3
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ripngd: add 'int idx_foo' argv index variablesDaniel Walton2016-09-231-8/+12
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebraDaniel Walton2016-09-231-9/+10
| | | | | | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* | ripngd: argv updateDaniel Walton2016-09-231-8/+8
|/ | | | Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
* ripngd: add ECMP supportFeng Lu2016-06-081-30/+7
| | | | | | | | | | | | | | | | | | | | | | | | * Each node in the routing table is changed into a list, holding the multiple equal-cost paths. * If one of the multiple entries gets less-preferred (greater metric or greater distance), it will be directly deleted instead of starting a garbage-collection timer for it. The garbage-collection timer is started only when the last entry in the list gets INFINITY. * Some new functions are used to maintain the ECMP list. And hence ripng_route_process(), ripng_redistribute_add() and ripng_timeout() are significantly simplified. * ripng_zebra_ipv6_add() and ripng_zebra_ipv6_delete() now can share the common code. The common part is moved to ripng_zebra_ipv6_send(). 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>
* quagga: Remove iflist global variableDonald Sharp2016-04-081-5/+5
| | | | | | | | | | | | | | | The file if.c has a iflist that had the list of interfaces in the default vrf. Remove this variable and replace with a vrf_iflist lookup on the default vrf where it was used. Additionally, modify ptm code to iterate over all vrf's when enabling ptm. Ticket: CM-10338 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
* quagga: delete interface from default table when moved to vrfDon Slice2016-03-181-1/+1
| | | | | | | | | | All daemons changed to flag an interface that has been moved to a vrf as DELETED instead of INTERNAL. When they were flagged as IFINDEX_INTERNAL, ospf, rip, and isis would re-install them in the default assuming that they were being "pre-defined" before the kernel definitions. Ticket: CM-9265 Signed-off-by: Don Slice Reviewed-by: Donald Sharp
* *: add VRF ID in the API message headerFeng Lu2015-11-041-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()Feng Lu2015-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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