summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/kroute.c
AgeCommit message (Collapse)Author
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-01-23teach ldpd to ask if a potential pseudowire interface can do pwe3David Gwynne
this makes ldpd open the ioctl socket early so the config parser can run the SIOCGPWE3 ioctl against the requested interface. ok claudio@
2019-01-22PF_ROUTE -> AF_ROUTE in the scattered sock()/setsockopt() callsKenneth R Westerback
where the "wrong" #define was used. ok dlg@
2018-01-03Add support for IPv6 over MPLS pseudowire aka mpw(4)denis
OK claudio@ jca@
2017-07-24Unify ROUNDUP macros for parsing route messages.friehm
Use the macro from route(8) / ospf6d(8) since it works also with argument 0. OK claudio@
2017-03-04Send VPLS MAC withdrawals.Renato Westphal
RFC 4762 says that MAC address withdrawal messages can be used to improve convergence time in VPLS networks. This patch makes ldpd send MAC withdrawals whenever a non-pseudowire interface pertaining to a VPLS goes down. The processing of received MAC withdrawals will be implemented later.
2017-03-03Minor tweaks.Renato Westphal
2017-03-03Allow to run on a non-default rdomain.Renato Westphal
OK claudio@
2017-01-20work on making log.c similar in all daemons:Sebastian Benoit
move daemon-local functions into new logmsg.c, and reduce the (mostly whitespace) differences so that log.c's can be diffed easily. removal of log_rtmsg() aproved by claudio@ ok claudio@ krw@
2016-06-18Fix small LIB<->LFIB synchronization issue.Renato Westphal
ldpd operates only with the best routes of each IP prefix. In other words, the routes with the lowest priorities. When a route with a better priority is detected (possibly with a different nexthop), we should uninstall the labels from the "old" routes and try to install a new label for the new route (if there's one available in the LIB). In this specific case, ldpd was failing to uninstall the labels from the old routes because it wasn't keeping track of each route's priority in lde. With this missing bit of information, the parent process had no way to get the correct label to uninstall when processing a IMSG_KLABEL_DELETE message.
2016-05-23Update copyright information.Renato Westphal
2016-05-23Remove superfluous includes.Renato Westphal
2016-05-23Make functions and variables static whenever possible.Renato Westphal
The benefits of this include: * clean up of the ldpd global namespace; * improved readability; * more hints to the compiler/linker to generate more efficient code. Whenever possible, move global static variables to a smaller scope (function). All extern variables are now declared in header files to avoid unnecessary duplication. This patch also cleans up the indentation of all function prototypes and global variables.
2016-05-23Add support for IPv6 (RFC 7552).Renato Westphal
This includes: * Full compliance to RFC 7552; * Support for MD5 on LDPov6 sessions; * Support for pseudowires over IPv6 LSPs (we're probably the world's first implementation doing this); * Support for the IPv6 explicit-null label; * Knob to specify the prefered address-family for TCP transport connections; * Knob to use cisco non-compliant format to send and interpret the Dual-Stack capability TLV.
2016-05-23Assorted fixes and small cleanup.Renato Westphal
Nothing really interesting here.
2016-05-23Several fixes in the config reload handling.Renato Westphal
2016-05-23Copy structs by assignment instead of memcpy.Renato Westphal
Copying by straight assignment is shorter, easier to read and has a higher level of abstraction. We'll only avoid it when copying from an unaligned source (e.g., network buffers). In addition, copy in_addr structs directly.
2016-05-23Fix mess caused by my commit script.Renato Westphal
I screwed up everything... trying to fix now.
2016-05-23Standardize some log messages and fix some inconsistencies.Renato Westphal
We were using several different names for the same thing in our log messages: neighbor, neighbor ID, nbr ID and LSR ID. Standardize to always use "lsr-id" to refer to a neighbor. Also: * Use log_warnx() instead of log_warn() when appropriate; * Use fatal(x) instead of err(x) when appropriate; * Fix some inconsistent log messages.
2016-05-23More renaming.Renato Westphal
Rename a few more things to improve readability. * s/F_PW_CONTROLWORD_CONF/F_PW_CWORD_CONF/ (shorter) * s/F_PW_CONTROLWORD/F_PW_CWORD/ (shorter) * s/LDPD_FLAG_*/F_LDPD_*/ (consistency) * s/lde_nbr_address/lde_addr/ (shorter) * s/ldp_discovery_socket/ldp_disc_socket/ (shorter) * s/ldp_ediscovery_socket/ldp_edisc_socket/ (shorter) * s/ldp_sendboth/main_imsg_compose_both/ (consistency) * s/cons/total/ (makes more sense) * s/kaddr/ka/ (consistency with remaining code) * Always use 'ln' for lde_nbrs (consistency)
2016-05-23Filter our RTM_GET messages which are not from us.Renato Westphal
Pulled from ospfd. Original author: claudio@
2016-05-23Don't try to install pseudowires of unknown type.Renato Westphal
2016-05-23Replace manually written function names with __func__.Renato Westphal
2015-09-27As done for bgpd recently, rename if_mediatype to if_type in ldpd.Stefan Sperling
And some ifmedia64 fixes. "move forward" deraadt@
2015-07-21VPLS signaling support.Renato Westphal
This patch introduces full support for pseudowire signaling in ldpd(8), including Control Word and Status TLV negotiation. As of now it's not possible to configure a VPWS, but the signaling is the same. In the future, when VPWS support is available in the kernel, ldpd(8) can be extended to support VPWS with only a few modifications. Limitations: * No support for FEC 129, only FEC 128 (more widely deployed); * No support for group withdraws (not widely deployed); * No support for MAC withdraws (not widely deployed). Related RFCs: * RFC 3916: Requirements for Pseudo-Wire Emulation Edge-to-Edge (PWE3) * RFC 3985: Pseudo Wire Emulation Edge-to-Edge (PWE3) Architecture * RFC 4385: Pseudowire Emulation Edge-to-Edge (PWE3) Control Word for Use over an MPLS PSN * RFC 4446: IANA Allocations for Pseudowire Edge to Edge Emulation (PWE3) * RFC 4447: Pseudowire Setup and Maintenance Using the Label Distribution Protocol (LDP) * RFC 4448: Encapsulation Methods for Transport of Ethernet over MPLS Networks * RFC 4905: Encapsulation Methods for Transport of Layer 2 Frames over MPLS Networks * RFC 4906: Transport of Layer 2 Frames Over MPLS ok claudio@
2015-07-21Add configuration reload support.Renato Westphal
ok claudio@
2015-07-21Improve handling of addresses on ldpe.Renato Westphal
This is a preliminary work for the the next patch (sigup config reload). We want to make sure that the ldpe process can handle duplicated addresses. The idea is to alloc two different if_addr structures for each address, and link one in the global list of addresses (used to send address messages) and link the other to the associated interface list of addresses. Doing that we will be able to call kif_redistribute() after reloading the config file and activate the new LDP enabled interfaces. NOTE: Interfaces are created at config parse time and the child processes inherit them on fork() so there's no need to send a status update at startup. ok claudio@
2015-07-19Rework kroute.c to send only the best routes to lde.Renato Westphal
This is major rework of the kroute.c code. The idea is remove complexity from the lde process by making kroute.c advertise only the lowest priority routes of each prefix. kroute.c now keeps track of all routes using three different structures: kroute_prefix, kroute_priority and kroute_node. kroute_prefix represents a prefix and contains an ordered list of priorities (kroute_priority) and for each priority there is a list of nexthops (kroute_node). Arranging the routes using these three structures allows for the writing of a simpler code, easier to understand. Whenever a route is removed, if there's another route for the same prefix, but with a lower priority, this route is immediately sent to lde. Additional fixes: * On RTM_CHANGE, remove the old route before installing the new one; * On IMSG_CTL_KROUTE_ADDR, show all nexthops for multpath routes;
2015-07-17Filter routes based on RTF_LLINFO and RTF_BROADCAST flags and use RTF_CONNECTEDClaudio Jeker
to properly track connected routes on -current.
2015-04-04Remove lo protection.Renato Westphal
There's no need to protect the 127/8 network on ldpd since this network is filtered before being sent to lde. If we receive a label mapping for this network, it won't be installed because lde has no nexthop for it, and thus the code will always fall into the LMp.13 case of the RFC "Receive Label Mapping" algorithm: the mapping will be recorded but not used. ok claudio@
2015-03-21Remove unused variables and functions.Renato Westphal
2015-03-21Remove interface finite state machine.Renato Westphal
In the name of simplicity, remove the interface FSM that was inherited from ospfd. In ldpd interfaces are just up or down, so keeping a FSM for that is an overkill. Now instead of calling if_fsm(), just call if_update() whenever a relevant event occurs (status change, address addition/removal). Additional notes: 1 - s/if_act_/if_/ 2 - Remove the IMSG_IFUP and IMSG_IFDOWN events. Now whenever an interface changes its state a IMSG_IFSTATUS event will be generated with the new status. kroute.c ldpd.h ldpe.c ldpe.h CVS: ----------------------------------------------------------------------
2015-03-21ldpd: Don't assign labels for BGP routes.Renato Westphal
Although RFC 5036 is not explicit about this, LDP should not assign labels for BGP routes. Doing that would be very resource consuming in some scenarios and unnecessary. The goal is generally only to establish LSPs among all PEs in the AS since LDP is not used as an end in itself but as a means to implement advanced solutions like MPLS L2/L3 VPNs. Some implementations (e.g. JunOS) go further and only assign labels for /32 loopback routes advertised in the IGP. If Inter-AS LSPs are necessary, BGP itself should be used for distributing IPv4 labeled routes (e.g. option C. of section 10 in RFC 4364).
2015-02-11Use sizeof(u_short) in the first check since there are RT messages thatClaudio Jeker
are less then sizeof(*rtm) bytes long (e.g. interface announcements). Found the hard way by phessler@
2015-02-10Sync kroute code with bgpd/ospfd code regarding EAGAIN and short readsClaudio Jeker
2015-02-10Pass SOCK_NONBLOCK | SOCK_CLOEXEC to some more sockets. We never want toClaudio Jeker
sleep on a socket.
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-06-23The second level of the CTL_NET sysctl is a PF_*, not an AF_*Philip Guenther
inconsistent usage in route(8) noted by Gregor Best (gbe (at) ring0.de)
2013-10-30another simple %i to %d conversion for obviousnessTheo de Raadt
2013-10-15Don't bind a label for the default route.Renato Westphal
After discussing with claudio@ we came to the conclusion that it's more safe to ignore the default route and don't bind a label for it. OK @claudio
2013-10-15Fix whitespace and other style issues.Renato Westphal
OK claudio@
2013-06-04fix some minor issues before proceeding with the remaining patches fromClaudio Jeker
Renato Westphal. Diff by Renato Westphal
2013-06-03Advertise the implicit-null label for routes attached to loopbackClaudio Jeker
interfaces to guarantee PHP. With this 'fib-update no' is not totaly broken because of missing mappings for the loopbacks. Diff by Renato Westphal
2013-06-03Implement support for multiple addresses per interface.Claudio Jeker
This replaces the way addresses and interface are chained together. In ospfd there was a 1 to 1 mapping (with iface clones) but LDP does not have that limitation. Diff from Renato Westphal
2013-06-01Filter out route messages we don't need and log kernel messages inClaudio Jeker
super verbose mode. From Renato Westphal
2011-06-26Remove obsolete mcast routes in ldpd and ripd.Claudio Jeker
OK dlg@
2010-10-20Since on shutdown fib_sync is forced to 1 to remove the multicast routeClaudio Jeker
it needs to be set to 0 afterwards again, because the FIB was decoupled right before and now no "route vanished before delete" messages are printed on shutdown.
2010-10-15Rework the kroute framework of ldpd. ldpd is different from the otherClaudio Jeker
routing daemons. Change the way the kroute tree is indexed (by FEC with a linked list in case there is a priority conflict -- same route + nexthop at different priorities). This needs a mpath capable MPLS routing table. Still work in progress but works a lot better in close meshed networks.
2010-10-07Don't try to add MPLS routes with a incomming MPLS_LABEL_IMPLNULL label.Claudio Jeker
The kernel has now a static entry for them and they should not hit the wire anyway.
2010-09-01s/lfib/fib/ for more consitency with the other routing daemons.Claudio Jeker
This started manly because of ldpctl beeing inconsistent and me misstyping lfib almost every time. OK michele@