summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2019-03-15zebra: set connected route metric based on the devaddr metricAnuradha Karuppiah
MACVLAN devices are typically used for applications such as VRR/VRRP that require a second MAC address (virtual). These devices have a corresponding SVI/VLAN device - root@TORC11:~# ip addr show vlan1002 39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff inet6 2001:aa:1::2/64 scope global valid_lft forever preferred_lft forever root@TORC11:~# ip addr show vlan1002-v0 40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff inet6 2001:aa:1::a/64 metric 1024 scope global valid_lft forever preferred_lft forever root@TORC11:~# The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via the SVI. To acheive that functionality the macvlan network's metric is set to a higher value. Zebra currently ignores the devaddr metric sent by the kernel and hardcodes it to 0. This commit eliminates that hardcoding. If the devaddr metric is available (METRIC_MAX) it is used for setting up the connected route otherwise we fallback to the dev/interface metric. Setting the macvlan metric to a higher value ensures that zebra will always select the connected route on the SVI (and subsequently use it for next hop resolution etc.) - root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64" Routing entry for 2001:aa:1::/64 Known via "connected", distance 0, metric 1024, vrf vrf1 Last update 11:30:56 ago * directly connected, vlan1002-v0 Routing entry for 2001:aa:1::/64 Known via "connected", distance 0, metric 0, vrf vrf1, best Last update 11:30:56 ago * directly connected, vlan1002 root@TORC11:~# Ticket: CM-23511 Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
2019-02-06lib: add hooks for external logging functionEmanuele Di Pascale
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
2019-01-24lib: don't disable "log file" on "log syslog"David Lamparter
FRR log targets are independent, so "log syslog" must not disable "log file" output. Fixes: #3551 Fixes: 0204baa87630b210c71d9ae0e2569cff0fb0539b Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-14lib: flip to ISC on hook & module codeDavid Lamparter
I accidentally put MIT headers on these; the intent was ISC. It doesn't really make a difference, but let's get it consistent. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-13Merge pull request #3481 from opensourcerouting/6.0-spelchekJafar Al-Gharaibeh
[6.0] spelchek
2018-12-13*: spelchekDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-12-12bgpd, doc, ldpd, lib, tests, zebra: LM fixespaco
Corrections so that the BGP daemon can work with the label manager properly through a label-manager proxy. Details: - Correction so the BGP daemon behind a proxy label manager gets the range correctly (-I added to the BGP daemon, to set the daemon instance id) - For the BGP case, added an asynchronous label manager connect command so the labels get recycled in case of a BGP daemon reconnection. With this, BGPd and LDPd would behave similarly. Signed-off-by: F. Aragon <paco@voltanet.io>
2018-12-06watchfrr, 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-25build: make clean and dist consistentDavid Lamparter
We weren't cleaning up some files (a whole lot of python foobar) and had some files in the dist tarball that don't quite belong there. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25build: fix & clean up *SAN flagsDavid Lamparter
ASAN/MSAN/TSAN flags need to be in CFLAGS and LDFLAGS; the latter links the correct compiler-dependent library. Also, the configure switch was broken (--disable-... would enable the sanitizer.) Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25*: cleanup .gitignore filesDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25build: move vtysh & manpage listings to subdir.amDavid Lamparter
Since we're now building through one large Makefile, we can easily put things with their daemons and crossreference nicely. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25build: remove common.amDavid Lamparter
Fold things into where they make sense. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25lib: Add missing smux.h to `make distrib` resultsDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-25build: non-recursive doc + parallel sphinxDavid Lamparter
Sphinx actually does work with a parallel build, if the doctree creation is a separate step (which the other builds will then just read unmodified.) This can be done with the "dummy" target. This also adds "-j6" to sphinx-build and adds a "--disable-doc-html" switch on ./configure to turn on/off building HTML docs separately. Also, HTML docs are now installed by "make install" to /usr/share/doc/frr/html. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-14lib: refactor thread_executeRafael Zalamena
Don't allocate threads in the stack, but use the standardized `thread_get` and `thread_add_unused` to avoid creating corner cases in the thread API. This fixes a thread mutex memory leak in FreeBSD. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> (cherry picked from commit c4345fbf71fcc7ef4b64d95979f252c613dd3ebf)
2018-10-14lib: fix a memory leak in FreeBSDRafael Zalamena
Two important changes: * Centralize the thread teardown procedure; * Save and restore thread mutex context to avoid losing the memory pointer; Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org> (cherry picked from commit 6655966d2c2fe7a29ca29af4366fa3e044ad1170)
2018-10-04lib: Include compiler.h as early as is possible in the buildDonald Sharp
The compiler.h header provides us with some useful macro's that we are using in the system. We do not know exactly where the CPP_NOTICE and CPP_WARN macros are used but they can move around. Place this header early in the build then. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-03lib: add "log error-code" switchDavid Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-26Merge pull request #2898 from donaldsharp/vrf_bitmap_is_whackLou Berger
lib: Convert vrf bit-map to a hash.
2018-08-25lib: Cleanup uninted `top` variable in ferr.cDonald Sharp
The `top` variable could possibly be used without any initialization, remove the possibility. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-25lib: remove Linux 2.4 TCP-MD5 supportDavid Lamparter
Linux 2.6.0 was released in December of 2003... I'm pretty sure we don't need this Linux 2.4 support anymore. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-24doc, lib, zebra: Remove deprecated encode and decode functionalityDonald Sharp
The ZEBRA_IPV4_ROUTE_[ADD|DELETE] and ZEBRA_IPV6_ROUTE_[ADD|DELETE] functionality has been deprecated for a year now, let's remove this code from the system. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Convert vrf bit-map to a hash.Donald Sharp
Memory sizes of the vrf bit-map was insane for a system with a moderate number of data on it: Zebra: VRF bit-map : 601 65536 39391944 Having a full 32bit integer bit space is problematically large, switch over to a hash to store bit data. We do not need to waste so much space. VRF bit-map : 13 8 312 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23zebra: if multiple connecteds, select loopback or vrf if presentDon Slice
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-08-23Merge pull request #2894 from donaldsharp/thread_stuffDavid Lamparter
Thread stuff
2018-08-23lib: Limit depth of unused thread listDonald Sharp
The master->unused list was unbounded during normal operation. A full BGP feed on my machine left 11k threads on the unused list, taking up over 2mb of data. This seemed a bit excessive, reduce to a limit of 10. Also fix a crash that this exposed where we assumed that a thread structure was not deleted. Future committers can make this configurable? or modify the value to something better for their system. I am dubious of the value of this. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Convert debug to error situationDonald Sharp
This debug should be moved to an error situation since it's a developmental escape that needs to be fixed. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Remove default case statement from a enum driven switchDonald Sharp
We are using a enum to drive a switch statement and we have a default case statement that can never be entered because we know all the enum states have been covered. Remove it from the code as that it cannot happen. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Remove zlog_warn from some places in buffer.cDonald Sharp
zlog_warn was being used to inform user of impossible situations or for normal operations. Remove these from the code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Remove smux option for snmpDonald Sharp
The smux.c code has not been able to compile for 2+ years and no-one has noticed. Additionally net-snmp has marked smux integration as deprecated for quite some time as well. Since no-one has noticed and it's been broken and smux integration is deprecated let's just remove this from the code base. From looking at the code, it sure looks like SNMP could use a decent cleanup. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-23lib: Seperate out Poll data from thread memory statisticsDonald Sharp
We were storing Poll data for the read and write memory information in MTYPE_THREAD, so a show run would not be able to show actual amount of memory associated with the `struct thread`. Remove unnecessary NULL checks on malloc. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-22Merge pull request #2886 from donaldsharp/stream_resizeRuss White
Stream resize
2018-08-22Merge pull request #2892 from qlyoung/fix-log-ref-number-signednessDavid Lamparter
lib: error codes are uint32_t's
2018-08-22lib: error codes are uint32_t'sQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-22Merge pull request #2884 from opensourcerouting/assorted-20180821Donald Sharp
assorted warning fixes
2018-08-22lib: Convert stream_new to use one mallocDonald Sharp
Modify stream.c to have stream_new call one malloc call instead of two. Also change stream_resize_orig to use stream_resize_inplace and to send an error to the developer to switch over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-22lib: Add stream_resize_orig and stream_resize_inplaceDonald Sharp
Start setup for handling of stream_resize into old and new functions. Create a stream_resize_inplace function that takes a double pointer to allow for a realloc operation to return the possibly moved pointer. Add a CONFDATE for removal as well. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-22Merge pull request #2888 from pguibert6WIND/misc_fix_static_tableidDonald Sharp
Misc fix static tableid
2018-08-22lib: change vrf_is_mapped_on_netns APIPhilippe Guibert
The function handles not a vrf pointer instead of a vrf_id value. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-22lib/bgpd: re-fix bgp_info_extra_free()David Lamparter
Make the wart slightly less bad... also there is still a possible write after free here. This needs to be fixed again, properly, by some structure changes. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-21build: wrap "fallthrough" attrDavid Lamparter
This generates a warning on gcc versions before 7.0. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-08-21lib: fix deadlock in log.cQuentin Young
Daemons could deadlock when log file could not be opened during a log rotation. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-21lib: fix show error allPhilippe Guibert
show error all was displaying 0 value for code, whereas real code value was not displayed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-16Merge pull request #2846 from donaldsharp/backet_dataRuss White
Backet data
2018-08-16Merge pull request #2448 from qlyoung/error-reference-cardsDavid Lamparter
Error Reference Cards
2018-08-15lib: routemap.c trust backet->dataDonald Sharp
The backet->data cannot be NULL, no need to check for it. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-15lib: Update hash.h documentationDonald Sharp
The hash_get function when called and the alloc_func returns a NULL value, we do not create a backet nor do we insert anything into the hash. As such backet->data must always be non-NULL. Modify the description in hash_get to inform of this. Additionally indicate that hash_walk and hash_iterate cannot have a NULL backet->data value. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-15lib, ripngd, zebra: Remove pre-solaris 9 special cased codeDonald Sharp
The CMSG_FIRSTHDR was broken on solaris pre version 9. Version 9 was released in May of 2002 and EOL'ed in 2014. Version 8 EOL'ed in 2012. Remove special case code for a little used platform that has not seen the light of day in a very long time. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14*: use frr_elevate_privs() (2/2: manual)David Lamparter
Signed-off-by: David Lamparter <equinox@diac24.net>