summaryrefslogtreecommitdiff
path: root/lib/libfrr.c
AgeCommit message (Collapse)Author
2018-10-27lib: introduce new northbound APIRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-04Merge pull request #3098 from opensourcerouting/watchfrr-delayQuentin Young
tools/frr + watchfrr spring cleaning (southern hemisphere)
2018-10-02watchfrr, lib: cleanup & delay detachingDavid Lamparter
This cleans up watchfrr to be more "normal" like the other daemons in terms of what it does in main(), i.e. using the full frr_*() call set. Also, this changes the startup behaviour on watchfrr to stay attached on the daemon's parent process until startup is really complete. This should allow removing the "watchfrr.started" hack at some point. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02lib: print version information in libfrr.soDavid Lamparter
This makes libfrr.so executable to print its version info. This is useful if you need to check your libfrr.so matches your daemons. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-22Revert "lib: Ensure FRR detects running of the second instance of a FRR ↵Donald Sharp
daemon, doesnot allow it to run." This reverts commit 6e23e5e9e16fb16aafb4ef05ceb3514a02147a21.
2018-09-13*: style for EC replacementsQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13*: LIB_[ERR|WARN] -> EC_LIBQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-12Merge remote-tracking branch 'frr/master' into warningsDavid Lamparter
Conflicts: zebra/if_ioctl_solaris.c zebra/rtread_getmsg.c Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-11lib: whitespace/spelling fixDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-06lib: Convert libfrr.c to use new error code systemDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06lib: Ensure FRR detects running of the second instance of a FRR daemon, ↵Biswajit Sadhu
doesnot allow it to run. Solution : The following procedures would be performed : 1. Verify if the pid file for each daemon is present or not. If the file is not present, that means the daemon is getting instantiated for the first time. So let it go ahead. If the file is present proceed to point ‘2’. 2. Try fetching the properties of the pid file. 3. If it has RW lock, that means one instance of this the daemon is already running. So stop moving ahead and do exit() else let it go ahead.
Please note all above procedure happen at the initial state of daemon’s instantiation, much before it starts any session with other process/allocates resources etc.. and this verification do not have any impact of any operations done later, if the verification succeeds. Signed-off-by: bisdhdh sadhub@vmware.com
2018-08-14*: rename ferr_zlog -> flog_err_sysQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename ferr_ref -> log_refQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: rename zlog_fer -> flog_errQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14lib: remove still reachable blocks in ferr.cQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14*: stop double initialization of ferrQuentin Young
* Stop double init of ferr * Fixup bugs in zebra ferr * Add missing init in ospfd Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14lib: Cleanup some missed LIB_ERR_SYSTEM_CALLDonald Sharp
libfrr.c had some detection for system call issues. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14lib, bgpd: Add code to make lib auto create the ferr infrastructureDonald Sharp
Add code to auto-create the ferr infrastructure as well as add some initial error handling for vrf.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-07-29lib: Set proper write file when using backup configDonald Sharp
When we read in a backup file, we should save the original host.config so that we can put it back to the correct original location after we read in the backup config. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-25lib: check return value (Coverity 1453456)paco
Signed-off-by: F. Aragon <paco@voltanet.io>
2018-06-19lib: Add --log-level to daemonsDonald Sharp
Add the ability to specify the designated log level at startup. --log-level <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19lib: Remove special case code to use syslogDonald Sharp
Remove the special case code to use syslog for Cumulus. They can specify this via startup now instead of having a special compile flag for this option. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19lib: Add new cli to specify where to output logs on startupDonald Sharp
When we are starting a daemon, allow the user to specify: --log <stdout|syslog|file:file_name> This can be used on early startup to put the log files where the end user wants them to show up. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19lib: Create a thread for reading in the cliDonald Sharp
The read in of cli was happening prior to thread event handling for non-integrated configs. This is interesting for 2 reasons: 1) Read-in of integrated configs was after thread event loop startup, so we had a difference of behavior 2) Read-in can cause a series of events that cause us to attempt to communicate with zebra. The zebra zapi connection only happens after the thread event loop has been started. This can cause data that is being written down to zebra to be lost and no real way to notice that this has happened and to recover gracefully. Modify the code to create a thread event for read in of client config. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-19lib: Add ability to retry if backup is specifiedDonald Sharp
If we fail to read in the config file and we have specified a backup of the backup, attempt to read that information. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-06-07bgpd, lib, ospf6d, vtysh: fix possible snprintf possible truncationDonald Sharp
With a new version of clang 6.0, the compiler is detecting more issues where we may be possibly be truncating the output string. Fix by increasing the size of the output string to make the compiler happy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-11lib: fix pathspace option -NChristian Franke
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2017-10-05lib, ldpd: fix "argument cannot be negative" coverity warningsRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-09-29Merge pull request #1255 from qlyoung/vtysh-remove-double-slashRenato Westphal
vtysh: remove extra / in config path
2017-09-29lib: remove extra / in other pathsQuentin Young
Non-integrated config paths need the treatment as well. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-09-25lib: Free thread_master pointer after freeDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-28lib: add -N/--pathspace optionDavid Lamparter
This allows running the daemons inside of Linux network namespaces without messing with an additional mount/fs namespace (or a ton of options). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24lib: fix cosmetic issue with exit raceDavid Lamparter
if we're using --terminal, the daemon may in some cases exit fast enough for the parent to see this; this resulted in a confusing/bogus "failed to start, exited 0" message. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-24lib: centralized memstats-at-exitDavid Lamparter
adds a new all-daemon "debug memstats-at-exit" command. Also saves memstats to a file in /tmp, useful if a long-running daemon is having weird issues (e.g. in a user install). Fixes: #437 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-15*: centralize some exit cleanup into libfrrDavid Lamparter
Start creating a counterpart to frr_init and frr_late_init. Unfortunately, some daemons don't do any exit handling, this doesn't change that just yet. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-11lib: don't close stdio when running foregroundDavid Lamparter
c9c8d0d ("lib: close stdin/out/err in non-terminal case") overshot its goal and closes stdin/stdout/stderr even when a daemon is running in foreground. That means stdout logging & exit memory reporting are both broken. Reported-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-09Merge remote-tracking branch 'frr/master' into tcp-zebraDavid Lamparter
2017-08-09lib: don't mkdir state paths in watchfrrDavid Lamparter
watchfrr doesn't know if there will be -u/-g options on the individual daemons, so it doesn't know what the appropriate ownership is. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-08lib: thoroughly disable tcp-zebraDavid Lamparter
Disable this in the code to make it hard for people to shoot themselves in the foot. It's only left as a remnant for development use. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-08*: remove --enable-tcp-zebra, rework ZAPI pathDavid Lamparter
This adds "@tcp" as new choice on the -z option present in zebra and the protocol daemons. The --enable-tcp-zebra option on configure is no longer needed, both UNIX and TCP socket support is always available. Note that @tcp should not be used by default (e.g. in an init script), and --enable-tcp-zebra should never have been in any distro package builds, because **** TCP-ZEBRA IS A SECURITY PROBLEM **** It allows arbitrary local users to mess with the routing table and inject bogus data -- and also ZAPI is not designed to be robust against attacks. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-03lib: close stdin/out/err in non-terminal caseDavid Lamparter
Oops, forgot this path... in the --terminal case, stdio is closed when the user ends the terminal session, but without terminal it was left open. (This caused a ssh session hang in the CentOS6 CI because the file descriptors were still open, so ssh would keep the session alive...) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: plug logging hole during startupDavid Lamparter
zlog_* doesn't work in startup before we've loaded the real logging configuration. Add some code to log to stderr for that window of time. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: create pid/vty directoriesDavid Lamparter
If the paths for pid or vty don't exist, try creating them. Failure is ignored (on EEXIST) or prints a non-fatal warning (other errors). Fixes: #507 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: privs: make uid/gid accessible before setuidDavid Lamparter
This splits off privs_preinit(), which does the lookups for user and group IDs. This is so the init code can create state directories while still running as root. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: vty_stdio signal handlingDavid Lamparter
- SIGTSTP appropriately suspends the foreground terminal - SIGINT causes the daemon to exit, regardless of -d - SIGQUIT causes the daemon to daemonize, regardless of -d Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: --terminal option for all daemonsDavid Lamparter
This allows, among other things, piping in a configuration from stdin. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-02lib: daemonize more intelligentlyDavid Lamparter
Block the parent process until the child has reached the main loop, e.g. full service is available. This means it's no longer neccessary to add a "safety sleep" for daemon cross-dependencies, when using the -d startup option. This doesn't help if -d isn't used. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17*: reindentreindent-master-afterwhitespace / reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-06-29lib: more `show thread cpu`Quentin Young
Add support for naming pthreads. Also, note that we don't have any records yet if that's the case. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>