This way, full functionality of `zlog_*` is available.
Having `fatal()` be wrappers around `assertf()` also means we get
backtraces, which is not the case for a plain `exit(1)`.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ
is the standard for interface name length on all platforms
that FRR currently compiles on.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Effectively a massive search and replace of
`struct thread` to `struct event`. Using the
term `thread` gives people the thought that
this event system is a pthread when it is not
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system. There is a continual
problem where people are confusing `struct thread` with a true
pthread. In reality, our entire thread.c is an event system.
In this commit rename the thread.[ch] files to event.[ch].
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Don't rely on the OS interface name length definition and use the FRR
definition instead.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
If LDP is miss configured in a setup and the router has LSPs with no remote
label, this code installs the LSP with a pop instruction of the top-level
label so the packet can be forwarded using IP. This is a best-effort
attempt to deliver labeled IP packets to their final destination instead of
dropping them. If this config is turned off the code will only install
LSPs that have a valid remote label.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Instead of registering to receive default-VRF information and routes
when first connected to zebra, defer the registration until some ldp
configuration is entered.
This avoids redistributing IPv4/IPv6 routes to ldpd when not needed.
Signed-off-by: Fredi Raspall <fredi@voltanet.io>
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
A long time ago there was a difference between number-named and string-named
access/prefix-lists. Currently we always treat the name as a string and
there is no need for a separate list for number-named lists.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Add support for the read-only snmp mib objects as described in RFC 3815
that are statistics.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
Add support for read-only snmp mib objects as described in RFC 3815,
excluding statistics.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
Add an API that allows IGP client daemons to register/unregister
RLFAs with ldpd.
IGP daemons need to be able to query the LDP labels needed by RLFAs
and monitor label updates that might affect those RLFAs. This is
similar to the NHT mechanism used by bgpd to resolve and monitor
recursive nexthops.
This API is based on the following ZAPI opaque messages:
* LDP_RLFA_REGISTER: used by IGP daemons to register an RLFA with ldpd.
* LDP_RLFA_UNREGISTER_ALL: used by IGP daemons to unregister all of
their RLFAs with ldpd.
* LDP_RLFA_LABELS: used by ldpd to send RLFA labels to the registered
clients.
For each RLFA, ldpd needs to return the following labels:
* Outer label(s): the labels advertised by the adjacent routers to
reach the PQ node;
* Inner label: the label advertised by the PQ node to reach the RLFA
destination.
For the inner label, ldpd automatically establishes a targeted
neighborship with the PQ node if one doesn't already exist. For that
to work, the PQ node needs to be configured to accept targeted hello
messages. If that doesn't happen, ldpd doesn't send a response to
the IGP client daemon which in turn won't be able to activate the
previously computed RLFA.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
L2VPN PW are very hard to determine why they do not come up. The following
fixes expand the existing show commands in ldp and zebra to display a
reason why the PW is in the DOWN state and also display the labeled nexthop
route selected to reach the PW peer. By adding this information it will
provide the user some guidance on how to debug the PW issue. Also fixed an
assert if labels were changed for a PW that is between directly connected
peers.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Changes to ACL rules were not applied to LDP. This fix allows
LDP to be notified when a rule in an ACL filter is modified by
the user. The filter is properly applied to the LDP session.
The filter may cause a LDP session to go down/up or to remove/add
labels being advertised/received from a neighbor.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
LDP ordered label distribution control only binds a label to
a FEC if it is the egress LSR, or the router received a label
binding for a FEC from the next hop router. In this mode,
an MPLS router will create a label binding for each FEC and
distribute it to its neighbors so long as he has a entry in
the RIB for the destination.
Signed-off-by: Lynne Morrison <lynne@voltanet.io>
Signed-off-by: Karen Schoener <karen@voltanet.io>
As I understand it ldpd was originally developed as a standalone
daemon for *BSD land. Then ported to FRR. FRR uses ifindex_t
as the base type for the ifindex. Mixing `unsigned short` and
`int` and `unsigned int` is going to lead to fun somewhere
along the way. Especially when we get to run on a system
with ifindex churn( I'm looking at you docker ).
Attempt to convert all of ldpd to think of the ifindex as a
`ifindex_t`.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Use the route type and instance instead of the route distance
to identify MPLS FTNs. This is a more robust approach since the
routing daemons can modify the distance of their announced routes
via configuration, which can cause inconsistencies.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit fixes two issues:
- memcpy() using containers of different sizes when using addr2sa(), mixing
'struct sockaddr_storage' and 'union sockunion'.
- addr2sa() function not being thread safe (using a local static variable as
container.
Signed-off-by: F. Aragon <paco@voltanet.io>
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>
In some circumstances zebra and ldpd would display a pseudowire as UP
when in reality it's not (example: MTU mismatch between the two ends). Fix
this to avoid confusion.
Reported-by: ßingen <bingen@voltanet.io>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
The simple queue implementation in OpenBSD and FreeBSD are called diferently,
standardize in the use of the FreeBSD version and map the missing names only
if we compile on OpenBSD.
Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
If we receive a notification from zebra indicating that the installation
of a pseudowire has failed (e.g. no reachability), send a PW Status
notification to the remote peer (or a Label Withdraw if the remote peer
doesn't support the PW Status TLV).
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Base framework for supporting MPLS pseudowires in FRR.
A consistent zserv interface is provided so that any client daemon
(e.g. ldpd, bgpd) can install/uninstall pseudowires in a standard
way. Static pseudowires can also be implemented by using the same
interface.
When zebra receives a request to install a pseudowire and the installation
in the kernel or hardware fails, a notification is sent back to the
client daemon and a new install attempt is made every 60 seconds (until
it succeeds).
Support for external dataplanes is provided by the use of hooks to
install/uninstall pseudowires.
Signed-off-by: ßingen <bingen@voltanet.io>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This patch attempts to make the code easier to read by removing a
global variable and changing a few other things. Also, ldpd now calls
merge_config() only after reading the whole initial configuration at
startup, instead of doing that for every command in the configuration
file.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
We shouldn't check the operational status of an interface in ldpd if
it's configured with "no link-detect" in zebra. That's what all the
other routing daemons do.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
In order to have separate ASLR/cookies per process, ldpd calls exec()
in the child processes after fork() (this is also known as the fork+exec
model).
This is an important security feature but it makes the initialization
of the child processes a bit more complicated as they're not a copy of
the parent anymore, so all parameters given via command line are lost.
To solve this problem, we were creating an argv array by hand with all
necessary parameters and providing it to the exec() syscall. This works
but it's a very ugly solution. This patch introduces a different approach
to solve the problem: send an IMSG_INIT message to the child processes
with all parameters they need in order to initialize properly. This
makes adding additional initialization parameters much more convenient
and less error prone.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
David Lamparter gave the idea of keeping vty_conf as a permanent copy of
ldpd_conf in order to simplify the CLI code and facilitate the integration
with his cap'n proto framework in the future. Doing this demanded quite
some effort but it was worth it as the code looks much better now.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
The rationale here is to do something very similar to what the original
OpenBSD's ldpd(8) does to reload configuration files:
* create a new empty base configuration (vty_conf);
* parse the configuration file and store the result in vty_conf;
* merge the new configuration into the current configuration.
To do this, introduce a new global variable called "sighup" so that ldpd
doesn't attempt to merge vty_conf into ldpd_conf for each command in
the configuration file, which would be very disruptive. vty_conf should
be merged only after the whole configuration file is parsed in order to
avoid taking actions like shutting down neighbors when not necessary.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
The logic to make configuration changes in ldpd is as follows:
1 - duplicate the current configuration;
2 - modify the duplicated configuration (delta);
3 - merge the duplicated configuration into the current configuration.
We can however change things a little bit in order to simplify the code.
If we provide a global vty_conf variable and make sure that it's
always an up-to-date duplicate of ldpd_conf, then we don't need to call
ldp_dup_config() in the callback of each configuration command. Instead
of that, we just need to duplicate ldpd_conf in the startup of the daemon
and in the end of the ldp_reload() function. Doing this is safe because,
due to the single-threaded nature of the parent process, it's impossible
to have multiple requests to change the configuration at the same time.
Also, we can remove the *_ref() functions and do something much simpler
instead. The problem we have to deal with here is that VTY_GET_CONTEXT()
returns a pointer to an element of ldpd_conf, and what we want is a
pointer to an element of vty_conf (e.g. an l2vpn). To solve this,
we just need to look for the equivalent element inside vty_conf using
standard functions from ldpd like l2vpn_find() and others.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>