summaryrefslogtreecommitdiffstats
path: root/ripd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #537 from donaldsharp/vrf_stuffDavid Lamparter2017-05-171-1/+1
|\ | | | | Vrf stuff
| * *: Consolidate vrf_hooks into vrf_initDonald Sharp2017-05-161-1/+1
| | | | | | | | | | | | | | | | We only needed to add/change the vrf callbacks when we initialize the vrf subsystem. As such it is not necessary to handle the callbacks in any other way than through the init function. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: make consistent & update GPLv2 file headersDavid Lamparter2017-05-1514-56/+42
|/ | | | | | | | | | | 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>
* Address the error "Dead assignment" of static analysifHung-Weic Chiu2017-05-101-1/+0
| | | | | | | - Refer to https://ci1.netdef.org/browse/FRR-FRR4-44/artifact/shared/static_analysis/index.html - Remove unused variable Signed-off-by: Hung-Weic Chiu <sppsorrg@gmail.com>
* *: update thread_add_* callsQuentin Young2017-05-092-9/+11
| | | | | | | | | | | | Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: remove THREAD_ON macros, add nullity checkQuentin Young2017-05-094-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ripd: fix argv index numbers in the redistribute commandRenato Westphal2017-04-081-4/+4
| | | | | | Fixes Issue#350 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* build: fix CFLAGS for snmp modulesDavid Lamparter2017-04-041-0/+1
| | | | | | | | | | | The SNMP modules include <net-snmp/net-snmp-config.h>, which won't be found in off-searchpath directories without SNMP_CFLAGS. Unfortunately in my tests the files were on the search path even without the flags. (SNMP_LIBS is not needed because only libfrrsnmp calls into net-snmp functions.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge pull request #294 from opensourcerouting/modulesDonald Sharp2017-04-045-26/+53
|\ | | | | Loadable module support
| * *: snmp: convert into modulesDavid Lamparter2017-03-254-14/+32
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * *: use hooks for sending SNMP trapsDavid Lamparter2017-03-253-15/+23
| | | | | | | | | | | | | | This means there are no ties into the SNMP code anymore other than the init call at startup. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * build: split off libfrrsnmpDavid Lamparter2017-03-251-1/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * ripd: fix snmp compileDavid Lamparter2017-03-241-0/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: apply DEFUN_NOSH for node-switch CLI commandsDavid Lamparter2017-03-281-1/+1
|/ | | | | | | | | | These have copies in vtysh that do the node-switch locally and are listed in extract.pl's ignore list. The ignore list however is redundant since DEFUN_NOSH does the same thing... ldpd is a bit hacky, but Renato is reworking this anyway. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: Refactor ifindex2ifname to be VRF awareDonald Sharp2017-03-151-7/+7
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Refactor if_lookup_by_name to be VRF awareDonald Sharp2017-03-152-3/+4
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, ospfd, ripd: Convert if_lookup_address to be vrf awareDonald Sharp2017-03-151-4/+4
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib, pimd, zebra: Convert if_lookup_exact_address to VRF onlyDonald Sharp2017-03-151-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* lib: remove remaining struct zlog * argsDavid Lamparter2017-03-081-1/+1
| | | | | | These don't serve any purpose either. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: get rid of zlog(*, LOG_LEVEL, ...)David Lamparter2017-03-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Result of running the following Coccinelle patch + fixups: <<EOF /* long-forms: zlog(NULL, <level>, ...) * => zlog_level(...) */ @@ expression list args; @@ - zlog(NULL, LOG_DEBUG, args) + zlog_debug(args) @@ expression list args; @@ - zlog(NULL, LOG_NOTICE, args) + zlog_notice(args) @@ expression list args; @@ - zlog(NULL, LOG_INFO, args) + zlog_info(args) @@ expression list args; @@ - zlog(NULL, LOG_WARNING, args) + zlog_warn(args) @@ expression list args; @@ - zlog(NULL, LOG_ERR, args) + zlog_err(args) /* long-forms: zlog(base->log, <level>, ...) * => zlog_level(...) */ @@ expression base; expression list args; @@ - zlog(base->log, LOG_DEBUG, args) + zlog_debug(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_NOTICE, args) + zlog_notice(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_INFO, args) + zlog_info(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_WARNING, args) + zlog_warn(args) @@ expression base; expression list args; @@ - zlog(base->log, LOG_ERR, args) + zlog_err(args) EOF Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_run()David Lamparter2017-03-081-12/+1
| | | | | | | Contains the fetch-and-run-thread logic, and vty startup (which is the last thing happening before entering the main loop). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_config_fork()David Lamparter2017-03-081-57/+5
| | | | | | | | | Centralise read_config/daemonize/dryrun/pidfile/vty_serv into libfrr. This also makes multi-instance pid/config handling available as part of the library. It's only wired up in ospfd, but the code is in lib/. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: centralize more into frr_init()David Lamparter2017-03-071-3/+0
| | | | | | Move CLI/VTY/Memory accounting init into frr_* Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: add frr_init() infrastructureDavid Lamparter2017-03-072-103/+25
| | | | | | | | | Start centralising startup & option parsing into the library. FRR_DAEMON_INFO is a bit weird, but it will become useful later (e.g. for killing the ZLOG_* enum, and having the daemon name available) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'origin/stable/2.0'Donald Sharp2017-02-072-3/+3
|\
| * ripd: Fix compile warningDonald Sharp2017-02-031-2/+2
| | | | | | | | | | | | | | This issue was found compiling with ./buildtest.sh on fedora 25 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| * *: Convert libzebra -> libfrrDonald Sharp2017-02-031-1/+1
| | | | | | | | | | | | | | The library libzebra that is installed with FRR will conflict with Quagga. So let's rename it to libfrr. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge branch 'frr/pull/152' ("Lib fixes")David Lamparter2017-02-071-14/+16
|\ \ | | | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * | ripd: Prevent rip null dereferenceDonald Sharp2017-02-021-14/+16
| | | | | | | | | | | | | | | | | | | | | When rip is NULL, we dereference it anyways. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | | Merge remote-tracking branch 'origin/stable/2.0'Donald Sharp2017-02-021-2/+12
|\ \ \ | |/ / |/| / | |/
| * *: fix warning fallout from set_socket_pathDavid Lamparter2017-02-011-1/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| * ripd: Add vty_socket cli option to override the compiled-in location for the ↵Martin Winter2017-01-251-2/+12
| | | | | | | | | | | | VTY Socket Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
* | *: Fix redistribute issueDonald Sharp2017-01-271-8/+8
| | | | | | | | | | | | | | | | | | | | Somewhere in the past we switched from using the auto-generated redistribute statements to a non-generated version. This caused us to loose new protocols to redistribute as they are added. Put it back. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | Merge branch 'master' into fix-proto_redistnumQuentin Young2017-01-072-14/+14
|\ \
| * | Merge remote-tracking branch 'origin/stable/2.0'Donald Sharp2017-01-062-14/+14
| |\|
| | * build: rename (2 of ?): route_types macrosDavid Lamparter2016-12-201-16/+16
| | | | | | | | | | | | | | | | | | | | | All of the autogenerated macros in lib/route_types.pl are now called FRR_* instead of QUAGGA_*. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
| | * build: rename (1 of ?): configure.ac + preprocDavid Lamparter2016-12-201-6/+6
| | | | | | | | | | | | | | | | | | | | | This replaces Quagga -> FRR in most configure.ac settings as well as a handful of preprocessor macros in the source code. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | | all: use ->text when parsing protocol argumentQuentin Young2016-12-161-55/+40
|/ / | | | | | | | | | | and match on full protocol name in proto_redistnum() Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | *: coccinelle-replace vty->indexDavid Lamparter2016-12-092-42/+21
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | ripd: add qobj registrationsDavid Lamparter2016-12-092-0/+10
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | ripd: fix `ip rip receive...` commandQuentin Young2016-12-061-1/+1
| | | | | | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* | ripd: fix indentation problems introduced by wrong conflict resolutionRenato Westphal2016-12-051-33/+33
| | | | | | | | | | | | | | | | | | Restore trailing whitespaces from rip_interface_new() as well. If we want to fix this, we need a separate commit just for this purpose. Signed-off-by: Renato Westphal <renato@opensourcerouting.org> [DL: removed "restoring wrong whitespace" bits] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | Merge branch 'queue/osr/vtysh-generic'David Lamparter2016-12-051-5/+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-5/+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-053-106/+106
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
| * ripd: minor code simplificationRenato Westphal2016-11-252-29/+6
| | | | | | | | | | | | | | | | | | * Simplify the RIP_TIMER_OFF macro and use it on more places; * Be more explicit when creating the RIP UDP socket - cosmetic change since socket(AF_INET,SOCK_DGRAM,0) defaults to UDP on every known UNIX/Linux platform. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: make use of the IP_MULTICAST_LOOP sockoptionRenato Westphal2016-11-251-0/+1
| | | | | | | | | | | | | | | | | | We still need to check for self-generated packets on rip_read() because ripd may also send broadcast packets. But using IP_MULTICAST_LOOP on the ripd socket will at least prevent us from receiving a lot unnecessary multicast packets when RIPv2 is being used, thus improving performance. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: fix race condition on input processingRenato Westphal2016-11-251-41/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the early days of ripd, we supported running RIP on secondary IP addresses. To do that, everytime we needed to send a multicast packet, we would create a new temporary socket for each of the interface's addresses and call bind() to change the source IP of the outgoing packets. The problem with these temporary sockets is that they are more specific than the global RIP socket (bound to INADDR_ANY). Then, even though these sockets only exist for a short amount of time, they can receive some RIP packets that were supposed to be received on the global RIP socket. And since we never read from the temporary sockets, these packets are dropped. Since we don't support secondary addresses anymore, the simplest way to fix this problem is to stop using temporary sockets for sending multicast packets. We are already setting IP_MULTICAST_IF before sending each multicast packet, and in this case the primary address of the selected interface is used as the source IP of the outgoing packets, which is exactly what we want. If we decide to reintroduce support for secondary addresses in the future, we should try one of the following: * Use IP_SENDSRCADDR/IP_PKTINFO to set the source address of the outgoing multicast packets; * Create one permanent UDP socket for each possible interface address, and enable reading on all sockets. Fixes the following IxANVL RIP tests: 7.10 and 14.1. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: fix the "neighbor" command.Renato Westphal2016-11-251-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't use if_lookup_prefix() in rip_update_process() because this function uses prefix_cmp() internally to try matching an interface address to a static neighbor's address. Since prefix_cmp() tries to match exact prefixes, if_lookup_prefix() was always returning NULL. What we really need here is to use prefix_match(), which checks if one prefix includes the other (e.g. one /24 interface including a /32 static neighbor's address). The fix then is to replace the call to if_lookup_prefix() and use if_lookup_address() instead, which uses prefix_match() internally. Fixes IxANVL RIP test 17.1 Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
| * ripd: add "none" option to the "ip rip receive version" commandRenato Westphal2016-11-253-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC 2453 says (section 5.1): "(...) For completeness, routers should also implement a receive control switch which would determine whether to accept, RIP-1 only, RIP-2 only, both, or none. It should also be configurable on a per-interface basis". For the "ip rip send version" command, we don't need to implement the "none" option because there's already the "passive-interface" command for that. Fixes IxANVL RIP test 16.8. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>