summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/ldpe.c
AgeCommit message (Collapse)Author
2016-06-18Fix removal of dual-stack neighbors.Renato Westphal
2016-06-13Implement support for the Configuration Sequence Number TLV.Renato Westphal
The Configuration Sequence Number optional TLV is documented in RFC 5036, pages 53 and 54. Fixes IxANVL LDP test 23.10.
2016-06-13Do not create sockets for disabled address-families.Renato Westphal
2016-06-09Send a fatal notification when the last hello adjacency is deleted.Renato Westphal
RFC 5036 says: "When the last Hello adjacency for an LDP session is deleted, the LSR terminates the LDP session by sending a Notification message and closing the transport connection". Send a "Hold Timer Expired" notification when the triggering event is a hello hold time timeout. In the other cases, like disabling LDP on an interface, send a "Shutdown" notification instead. Before this patch we were just closing the neighbor's transport connection. Fixes the following ANVL LDP tests: 7.17 and 23.3.
2016-06-08Fix quick reconnect when the transport address is changed.Renato Westphal
When the transport address is changed, we can't try to reconnect to the neighbors inside merge_af() because the ldpe process still didn't receive the new network sockets from the parent at this point. To resolve this, try to reconnect just after we receive these sockets.
2016-06-06Fix imsg parameter passingRenato Westphal
When ldpe requests new network sockets to the parent process (after the transport-address is changed), it must specify the desired address-family (IPv4 or IPv6). We can use the 'pid' or 'peerid' members of the imsg_hdr structure for this. Use 'pid' for convenience (no need to extend the wrapper function, ldpe_imsg_compose_parent()).
2016-05-23Improve security by calling exec after fork.Renato Westphal
For each child process (lde and ldpe), re-exec ldpd with a special "per-role" getopt flag. This way we have seperate ASLR/cookies per process. Based on a similar patch for bgpd, from claudio@ Requested by deraadt@
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-23Enable changing the router-id via config reload.Renato Westphal
Now ldpd can start without a router-id, since it can be set later. Since a router-id of 0.0.0.0 is invalid, interfaces and targeted-neighbors will check for a valid router-id in order to be activated. When the router-id is changed, all the neighborships are reset.
2016-05-23Several fixes in the config reload handling.Renato Westphal
2016-05-23Don't create l2vpn targeted neighbors inside the config parser.Renato Westphal
When removing a configured pseudowire, we remove the associated tnbr in ldpe_l2vpn_pw_exit(). So, when a new pseudowire is configured, it makes sense to create its tnbr in ldpe_l2vpn_pw_init() to keep things consistent.
2016-05-23Add an exception for kernels built without PFKEYv2 support.Renato Westphal
2016-05-23Create network sockets on the parent process.Renato Westphal
We drop our privileges in ldpe right after we create the network sockets. The problem is that we might want to change the transport-address and reload the config, in which case we need new sockets. To allow that, always create the network sockets in the parent process and pass them to ldpe via imsg.
2016-05-23Move socket creation and setup into a specialized function.Renato Westphal
Right now we use three network sockets in ldpd: * the discovery socket (udp+mcast); * the extended discovery socket (udp); * the session socket (tcp). When we introduce IPv6 support, we'll get three more sockets. In order to prevent code duplication in the future, add a specialized function that creates a socket according to the given type (and address-family later). This also improves readability because it makes it easier to see the differences between each socket.
2016-05-23Fix mess caused by my commit script.Renato Westphal
I screwed up everything... trying to fix now.
2016-05-23pledge() earlier on ldpe.Renato Westphal
2016-05-23Move some code around.Renato Westphal
This patch doesn't introduce any logical change.
2016-05-23Add knob to configure the transport address.Renato Westphal
This will be especially important when we add support for IPv6, because we'll not be able to use the router-id as the transport-address in this case.
2016-05-23Clear the configuration before closing the network sockets.Renato Westphal
This fixes some errors and warnings when ldpd is shutting down.
2016-05-23Replace manually written function names with __func__.Renato Westphal
2016-05-23Explicitly close the pfkey socket on exit.Renato Westphal
2016-05-23Call accept_del() on exit.Renato Westphal
2015-12-05EAGAIN handling for imsg_read. OK henning@ benno@Claudio Jeker
2015-10-23Add pledge(2) to the child processes.Renato Westphal
This is almost identical to the eigrpd(8) pledge diff, with the exception that the parent process can not be pledged bacause of a SIOCSETMPWCFG ioctl used to configure pseudowires. Looks good to deraadt@.
2015-07-21Call control_cleanup() from the ldpe process, where it belongs.Renato Westphal
ok claudio@
2015-07-21Rename, move and reuse mapping list functions.Renato Westphal
ok claudio@
2015-07-21Fix some awful ipc synchronization issues.Renato Westphal
Under some rare circumstances the following can happen: 1 - one neighbor sends a label withdraw followed by a fatal notification message; 2 - ldpe parses the label withdraw and sends it to lde; 3 - ldpe parses the fatal notification message and closes the session; 4 - lde processes the label withdraw and asks ldpe to send a label release; 5 - at around the same time, ldpe restarts the session with the neighbor; 6 - ldpe processes the lde message and then sends a label release to the new neighbor. The problem is that we don't want a message enqueue to a neighbor to be sent after the session is restarted. If a session is closed, all the enqueued messages should be discarded. To acomplish this, we update the peerid of the nbr structure everytime the session is established. ok claudio@
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-21Reuse merge_config() logic to simplify the shutdown of each process.Renato Westphal
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-19Implement md5 authentication support.Renato Westphal
ok claudio@
2015-07-19Rework label mapping algorithms to be more in line with the RFC.Renato Westphal
This patch presents a thoroughly review of the label mapping algorithms. Most of the changes are minor bug fixes in the handling of received label messages. Additional improvements: * Add a few more references to the Appendix A of the RFC5036 ("LDP Label Distribution Procedures") into the code; * Add full multipath support; * Send label withdraws when appropriate; * Add label withdraw/release wildcard support. NOTE: As a result of implementing only the "Liberal Label Retention" and "Downstream Unsolicited" modes, we will never send a label request ("Request Never"). And that means that we can ignore the following notification messages: "Label Request Aborted", "No Label Resources", "No Route" and "Label Resources Available". The following algorithms mentioned in the RFC can also be ignored: "Timeout of Deferred Label Request", "Detect Local Label Resources Have Become Available" and "Receive Label Abort Request". Now, considering that we only support one combination of all modes of operation, we can say that we have an almost complete implementation of the protocol. ok claudio@
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-21Don't try to send address withdraws to neighbors that are unreachableRenato Westphal
after an address removal in the system.
2015-03-21Close extended discovery socket on exit.Renato Westphal
2015-02-10Pass SOCK_NONBLOCK | SOCK_CLOEXEC to some more sockets. We never want toClaudio Jeker
sleep on a socket.
2015-02-09More SOCK_NONBLOCK | SOCK_CLOEXEC love and one less session_socket_blockmodeClaudio Jeker
2014-11-18Nuke more obvious #include duplications.Kenneth R Westerback
ok deraadt@ millert@ tedu@
2014-07-12Close connections when msgbuf_write() returns 0.Kenneth R Westerback
ok claudio@
2013-11-26deal with msgbuf_write EAGAIN, ok gilles bennoHenning Brauer
2013-10-17Respect the max pdu length and merge all send_label* functions intoRenato Westphal
a single generic function.
2013-06-04Implement support for adjacencies and targeted hellosClaudio Jeker
Refactor adjacencies out of the neighbor handling so that it is possible to have more complex topologies with targeted sessions. From Renato Westphal
2013-06-04Minor adjustments in the startup of the lde and ldpe processesClaudio Jeker
The 'ldpd_process' variable should be set as soon as possible in the initialization of each process. In that way if something goes wrong in the initialization we will know in which process the problem happened. Diff by Renato Westphal
2013-06-04fix some minor issues before proceeding with the remaining patches fromClaudio Jeker
Renato Westphal. 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