summaryrefslogtreecommitdiffstats
path: root/zebra/irdp_main.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zebra: Move the master thread handler to the zrouter structureDonald Sharp2019-01-311-4/+4
| | | | | | | | The master thread handler is really part of the zrouter structure. So let's move it over to that. Eventually zserv.h will only be used for zapi messages. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: style for EC replacementsQuentin Young2018-09-131-2/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: fix includesQuentin Young2018-09-061-0/+1
| | | | | | Add and remove error related includes as necessary. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra: flog_warn conversionQuentin Young2018-09-061-6/+7
| | | | | | Convert Zebra to user error subsystem. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use frr_elevate_privs() (1/2: coccinelle)David Lamparter2018-08-141-10/+4
| | | | Signed-off-by: David Lamparter <equinox@diac24.net>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* zebra, lib: error references for zebraQuentin Young2018-08-141-5/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-6/+2
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: use the FOR_ALL_INTERFACES abstraction from babeldRenato Westphal2017-10-101-1/+1
| | | | | | | | | | 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>
* *: use rb-trees to store interfaces instead of sorted linked-listsRenato Westphal2017-10-101-2/+1
| | | | | | | | | | | 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>
* *: use clang's 'ForEachMacros' format style optionRenato Westphal2017-09-151-14/+14
| | | | | | | | | | | | | This fixes the broken indentation of several foreach loops throughout the code. From clang's documentation[1]: ForEachMacros: A vector of macros that should be interpreted as foreach loops instead of as function calls. [1] http://clang.llvm.org/docs/ClangFormatStyleOptions.html Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* zebra: irdp: convert into moduleDavid Lamparter2017-08-151-4/+15
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: irdp: manage separate IRDP structDavid Lamparter2017-08-151-6/+19
| | | | | | | This allocates the per-interface IRDP data as needed; so the pointer in zebra_if is now really opaque. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* zebra: start detangling rtadv & irdpDavid Lamparter2017-08-151-1/+8
| | | | | | | Replace some cross-dependencies with hooks & move bits to where they belong. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: reindentreindent-master-afterwhitespace / reindent2017-07-171-222/+218
| | | | | | indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* Merge remote-tracking branch 'origin/stable/3.0'Donald Sharp2017-06-291-1/+1
|\
| * zebra: more dbzingQuentin Young2017-06-161-2/+1
| | | | | | | | | | | | | | Revert to the previous <= restrictions, improve error messages, fix the divide by zero. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
| * zebra: fix divide-by-zeroQuentin Young2017-06-141-1/+2
| | | | | | | | | | | | x % 0 = FPE Signed-off-by: Quentin Young <qlyoung@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>
* | *: update thread_add_* callsQuentin Young2017-05-091-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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-091-6/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* lib: convert vrf code to use red-black trees as wellRenato Westphal2016-11-281-4/+3
| | | | Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
* *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEsDavid Lamparter2016-09-191-0/+1
| | | | | | | | | | | | | | | | | | | This is a rather large mechanical commit that splits up the memory types defined in lib/memtypes.c and distributes them into *_memory.[ch] files in the individual daemons. The zebra change is slightly annoying because there is no nice place to put the #include "zebra_memory.h" statement. bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the library for its own use. This is bad practice and would break when the memtype are made static. Acked-by: Vincent JARDIN <vincent.jardin@6wind.com> Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> [CF: rebased for cmaster-next] Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Signed-off-by: Christian Franke <chris@opensourcerouting.org>
* zebra: use prefix2str for logging where possibleTimo Teräs2016-06-091-3/+3
| | | | | | | | This makes code more robust, consice and readable. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org> (cherry picked from commit be6335d682c5ee1b6930345193eda875705fbab2)
* zebra: Refactor struct zebra_tDonald Sharp2016-04-151-2/+0
| | | | | | | | | | | We were including 'extern struct zebra_t zebrad;' all over the place. This made no sense. Refactor into zserv.h where the definition was and remove resulting unnecessary code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Don Slice <dslice@cumulusnetworks.com> Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
* quagga: Remove iflist global variableDonald Sharp2016-04-081-17/+19
| | | | | | | | | | | | | | | 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>
* zebra: deal with irdp compile warningsStephen Hemminger2009-12-101-19/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * zebra/irdp.h * irdp_send_thread(): move prototype to common header file * irdp_advert_off(): idem * process_solicit(): idem * irdp_read_raw(): idem * send_packet(): idem * zebra/irdp_interface.c * inet_2a(): move function to where it is used * in_cksum(): lib/checksum.h already provides prototype * irdp_send_thread(): prototype moved away * inet_2a(): idem * irdp_advert_off(): idem * b1, b2, b3, b4: get rid of global buffers for inet_2a() * if_group(): add local buffer for inet_2a() * if_add_group(): idem * if_drop_group(): idem * irdp_config_write(): idem * Adv_new(): make static * zebra/irdp_main.c * irdp_read_raw(): prototype moved away * send_packet(): idem * in_cksum(): lib/checksum.h already provides prototype * inet_2a(): function moved to irdp_interface.c * zebra/irdp_packet.c * b1, b2, b3, b4: get rid of global buffers for inet_2a() * in_cksum(): lib/checksum.h already provides prototype * process_solicit(): prototype moved away * irdp_read_raw(): fix uninitialized variable
* [zebra] IRDP should ignore non-IPv4 addressesPaul Jakma2007-02-261-0/+4
| | | | | | | | 2007-02-26 Robert Olsson <Robert.Olsson@data.slu.se> * irdp_main.c: (irdp_send_thread) Skip non-AF_INET addresses, i.e. do not try interpret IPv6 addresses as IPv4 addresses to broadcast in IRDP announcements..
* [zebra] IRDP: Move stream_free to where its created, probably fixing a leakPaul Jakma2006-08-041-1/+2
| | | | | | | | | | | | 2006-08-01 Paul Jakma <paul.jakma@sun.com> * irdp_main.c: (irdp_advertisement) free the stream here, when done, right under where it was allocated so it's blindingly obvious it's correct. This possibly fixes a very slow leak of streams in zebra. * irdp_packet.c: (send_packet) don't free the stream here as it's hard to tell if right, plus an error case seemed to returning before free anyway.
* 2005-04-07 Paul Jakma <paul.jakma@sun.com>paul2005-04-071-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
* 2005-03-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-03-301-29/+19
| | | | | | | | | | | | | | | | | | | | | | | * irdp.h: Add prototype for irdp_sock_init, and fix protos for other irdp_* functions. * irdp_interface.c: (irdp_if_start) If irdp_sock is negative, call irdp_sock_init to create the IRDP socket. (irdp_if_init) Rename to irdp_init(). (get_iflist_ifp) Remove function that is a duplicate of if_lookup_by_index. (*) Make many functions static. And remove superfluous "\n" from several zlog messages. * irdp_main.c: (irdp_init) Remove function that used to call irdp_if_init() and irdp_sock_init(), since we will now create the socket only upon first use. (irdp_sock_init) Do not update global irdp_sock variable, just return the fd and assume that the caller will do so. If setsockopt calls fail, close the socket before returning -1. (*) Make many functions static. * irdp_packet.c: Initialize irdp_sock to -1. (irdp_read_raw) Call standard library function if_lookup_by_index instead of get_iflist_ifp. (irdp_recvmsg) Should be static, not global.
* 2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-01-291-1/+3
| | | | | | | | | | | | | * if_ioctl_solaris.c: (interface_list_ioctl) Save errno before calling zserv_privs.change. * ioctl{,_solaris}.c: (if_ioctl,if_ioctl_ipv6) Save errno before calling zserv_privs.change. * ipforward_solaris.c: (solaris_nd) Save errno before calling zserv_privs.change. * irdp_main.c: (irdp_sock_init) Save errno before calling zserv_privs.change. [backport candidate]
* 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-071-2/+2
| | | | * *.c: Change level of debug messages to LOG_DEBUG.
* 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bgp_main.c: (main) The 2nd argument to openzlog has been removed. * isis_main.c: (main) The 2nd argument to openzlog has been removed. * ospf6_main.c: (main) The 2nd argument to openzlog has been removed. Note that stdout logging will no longer be enabled by default when not running as a daemon. * ospf_main.c: (main) The 2nd argument to openzlog has been removed. * rip_main.c: (main) The 2nd argument to openzlog has been removed. * ripng_main.c: (main) The 2nd argument to openzlog has been removed. * main.c: (main) The 2nd argument to openzlog has been removed. So stdout logging will no longer be enabled by default. * irdp_main.c: (irdp_finish) Reduce severity of shutdown message from LOG_WARNING to LOG_INFO. * vtysh.c: Make several functions static instead of global. Added several commands to support destination-specific logging levels. (vtysh_completion) This function is unused, so comment it out. * basic.texi: Document new logging features. Separate basic config commands from basic VTY commands. * log.h: Replace struct zlog flags and maskpri fields with maxlvl array to support individual logging levels for each destination. Remove the 2nd argument to openzlog since the default logging config should be standardized inside the library. Replaced the zlog_set_flag and zlog_reset_flag functions with zlog_set_level. And zlog_set_file now requires an additional log_level argument. Declare zlog_proto_names for use inside command.c in the "show logging" command. Added defines useful for command construction. * log.c: (vzlog) Decide where to send the message based on the individual logging levels configured for each destination. Remove support for ZLOG_STDERR since it was never actually used. Support record-priority for terminal monitors. (zlog_signal,zlog_backtrace_sigsafe) Support destination-specific logging levels. Remove stderr support (was never used). Added support for terminal monitor logging. (_zlog_assert_failed) Increase message severity to LOG_EMERG. (openzlog) Remove 2nd argument since default config should be standardized in library. By default, terminal monitoring is set to debug, and all other logging is disabled. (zlog_set_flag,zlog_reset_flag) Removed. (zlog_set_level) New function to replace zlog_set_flag and zlog_reset_flag. Supports destination-specific logging levels. (zlog_set_file,zlog_reset_file) Support file-specific logging level. (zlog_rotate) Log an error message if fopen fails, and support new file-specific logging level. * command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that command functions will be static instead of global. Remove declarations for config_exit and config_help. Define new macros DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can have deprecated commands in vtysh. Similarly, for completeness, define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED. Also, fix bug in ALIAS_ATTR macro (didn't matter because it was never used). * command.c: Make many functions static instead of global. (facility_name,facility_match,level_match) New functions to support enhanced destination-specific logging levels. (config_write_host) Support new destination-specific logging levels. (config_logmsg) Added new "logmsg" command to help test logging system. (show_logging) Added "show logging" command to show the current configuration of the logging system. (config_log_stdout_level) Support explicit stdout logging level. (no_config_log_stdout) Now takes optional LEVEL arg. (config_log_monitor,config_log_monitor_level,no_config_log_monitor) New commands creating new "log monitor" commands to set terminal monitoring log level. (config_log_file_level) Support explicit file logging level. (config_log_syslog_level) Support explicit syslog logging level. (config_log_facility,no_config_log_facility) Implement new "log facility" command. (cmd_init) Add hooks for new commands: "show logging", "logmsg", "log stdout <level>", "log monitor", "log monitor <level>", "no log monitor", "log file <filename> <level>", "no log file <filename> <level>", "log syslog <level>", "log facility", and "no log facility". * vty.h: Added a "level" argument to vty_log so it can support "log record-priority". Declare new function vty_log_fixed for use in signal handlers. * vty.c: (vty_log,vty_log_out) Added a "level" argument to support "log record-priority" for vty terminal monitors. (vty_down_level) Use config_exit_cmd.func instead of calling config_exit directly (since command functions will now be static instead of global). (vty_log_fixed) New function to send terminal monitor messages from inside a signal handler.
* 2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-201-5/+5
| | | | | * global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
* 2004-10-22 Paul Jakma <paul@dishone.st>paul2004-10-221-1/+1
| | | | | * ospfd/ospf_packet.c: setsockopt_pktinfo -> setsockopt_ifindex * zebra/irdp_main.c: ditto
* Compiler warnings fixes.hasso2004-09-261-0/+1
|
* 2004-09-24 Paul Jakma <paul@dishone.st>paul2004-09-241-41/+39
| | | | | | | | | | | | * irdp_{interface,main}.c: lists typedef removal cleanup. update some list loops to LIST_LOOP. some miscellaneous style and indent fixups. (no_ip_irdp_address_preference_cmd) Fix delete of referenced node in loop. * irdp_packet.c: (irdp_recvmsg) Fix buggy assignment of integer to pointer. * if_ioctl{,_solaris}.c: lists typedef removal cleanup. update some list loops to LIST_LOOP.
* 2004-08-19 Paul Jakma <paul@dishone.st>paul2004-08-191-1/+1
| | | | | | * irdp_main.c: update to match sockopt renames. * irdp_packet.c: include sockopt.h and update to match sockopt renames.
* 2004-07-23 Paul Jakma <paul@dishone.st>paul2004-07-231-3/+1
| | | | | | * irdp_main.c: use setsockopt_pktinfo_ipv4 * irdp_packet.c: use SOPT_SIZE_CMSG_PKTINFO_IPV4 and getsockopt_pktinfo_ifindex()
* Creating irdp socket requires more privileges.hasso2004-07-131-0/+12
|
* OK, here it is - irdp support. But don't expect me to fix any bugs in it.hasso2004-06-121-0/+347