summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd/labelmapping.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix small memleak on error path.renato2016-09-021-1/+2
|
* Improve logging of sent and received messages.renato2016-09-021-12/+9
| | | | | | | | | | | | | * Standardize the logging format of sent and received messages: "msg-[in|out]: message type: lsr-id A.B.C.D [additional info]"; * Log sent label messages as well, not only the received ones; * Move the logging of sent notification messages from send_notification_nbr() to send_notification_full(), this way notification triggered by the lde process are logged as well; * Minor clean-up.
* Normalize the received prefixes.renato2016-08-081-8/+27
| | | | | | | | | | | We need to use ldp_applymask() to normalize the received prefixes. Example: 10.1.1.0/16 -> 10.1.0.0/16. Additionally, stop using IANA's AF numbers in map->fec.prefix.af and use AF_INET/AF_INET6 instead. This makes the code much simpler, use AF_IPV[46] only when necessary (decoding/encoding prefixes). ok claudio@
* Fix parsing of mal-formed optional TLVs/Sub-TLVs.renato2016-07-161-4/+13
| | | | | | | We must detect if a TLV's length extends beyond the end of the containing message. And, if so, send a fatal "Bad TLV Length" notification message. Found with the Mu Dynamics Mu-8000 protocol fuzzer.
* Improve logging of reserved labels.renato2016-07-151-3/+3
| | | | | | | | | Print "exp-null" and "imp-null" instead of "0" and "3", for example. Also, remove print_label() and print_pw_type() from ldpctl.c and use the equivalent functions from ldpd's log.c. While here, be more paranoid and use UINT32_MAX instead of UINT_MAX for NO_LABEL.
* Explicitly ignore the Hop Count and Path Vector TLVs.renato2016-07-151-1/+5
| | | | | | | | Since these are "well known" TLVs, we have to explicitly ignore them otherwise ldpd would send "Unknown TLV" Notification messages when it shouldn't. Fixes regression caused by rev1.51.
* More renaming and whitespace cleanup.renato2016-07-011-84/+80
| | | | No binary change after "strip -s".
* Be more compliant with RFC 4447.renato2016-07-011-3/+14
| | | | | | | | | | When sending a label withdraw during the pseudowire Control Word negotiation, append a "Wrong C-bit" status TLV after the FEC TLV (in conformance to RFC 4447 section 6.2). Apparently this has no use other than aiding in troubleshooting. Also, extend the recv_labelmessage() function to accept Status TLVs and ignore them instead of shutting down the session.
* Several minor tweaks.renato2016-07-011-13/+10
|
* Handle ibuf_add() errors.renato2016-06-271-31/+39
| | | | tweaks from claudio@
* Remove TODO comments about loop detection.renato2016-06-181-5/+1
| | | | | | | LDP loop detection is only necessary for ATM LSRs running in cell mode. We are never going to implement this "feature". Also, add two more comments in lde_check_request().
* Send an 'Unknown FEC' Notification for unexpected wildcard FECs.renato2016-06-111-2/+2
| | | | | | | This is basically just to make ANVL happy, there's not much difference between sending an 'Unknown FEC' or a 'Malformed TLV' Notification. Fixes ANVL LDP test 15.6.
* Make all TLV parsing functions look the same for consistency.renato2016-06-111-7/+9
| | | | Also, add one more safety check in recv_init().
* Make it possible to parse unknown TLVs in the future.renato2016-06-111-2/+2
| | | | | | | | | | | In the parsing of label and notification messages, we were always unsetting the first bit of the TLV type before comparing it against the types we know. We should not do this because our type constants can have this bit set when appropriate. By now the only unknown TLV supported by ldpd(8) is TLV_TYPE_DUALSTACK, which is only used in Hello messages. But we might change this in the future with support for MAC List TLVs and maybe RFC 7473.
* Fix parsing of multiple optional TLVs in label and notification messages.renato2016-06-111-6/+1
| | | | | | We were accepting at most one optional TLV. Fixes IxANVL LDP test 15.3.
* Update copyright information.renato2016-05-231-1/+2
|
* Remove superfluous includes.renato2016-05-231-12/+2
|
* Make functions and variables static whenever possible.renato2016-05-231-9/+9
| | | | | | | | | | | | | | | | 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.
* Add support for IPv6 (RFC 7552).renato2016-05-231-22/+54
| | | | | | | | | | | | | 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.
* Reject null labels for PW-ID FECs.renato2016-05-231-3/+10
|
* Fix mess caused by my commit script.renato2016-05-231-80/+80
| | | | I screwed up everything... trying to fix now.
* Make send_labelmessage() more robust.renato2016-05-231-1/+5
| | | | | | Immediately return from this function if the given list of mappings is empty. This way we have more freedom when sending label messages, not having to care with corner cases.
* Fix check of when a wildcard group PW-ID FEC is valid or not.renato2016-05-231-3/+4
| | | | | In addition to label mappings, wildcard group PW-ID FECs are invalid in label requests and label abort requests too.
* Remove unnecessary break statements.renato2016-05-231-3/+1
|
* Rename a few constants to avoid confusion.renato2016-05-231-7/+7
| | | | | | | | | | | | | | | | | | | | In ldpd we have the map structure, which is used to represent a label message, and the fec structure, used to store FECs in the LIB. As of now, ldpd supports two type of FECs: * IPv4 prefix (FEC_TYPE_IPV4); * PWID (FEC_TYPE_PWID). For the label messages, the following contants were being used: * FEC_WILDCARD; * FEC_PREFIX (IPv4 or IPv6); * FEC_PWID. Since these contants have similar names to the previous ones, rename them to: * MAP_TYPE_WILDCARD; * MAP_TYPE_PREFIX; * MAP_TYPE_PWID.
* Improve the parser of TCP/session packets.renato2016-05-231-2/+2
| | | | | | | | | | Add more safeguards against malformed packets and fix existing ones. Also, rename a few variables and constants to match their real meaning. For example, rename gen_msg_tlv() to gen_msg_hdr() because this function generates an LDP header, not a TLV. Finally, clean-up all the send_* functions so they all follow the same pattern.
* Replace manually written function names with __func__.renato2016-05-231-2/+2
|
* Rename, move and reuse mapping list functions.renato2015-07-211-8/+10
| | | | ok claudio@
* VPLS signaling support.renato2015-07-211-80/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Rework label mapping algorithms to be more in line with the RFC.renato2015-07-191-16/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Initialise a variable to please gcc.claudio2015-02-091-2/+2
|
* Do not assume a read buffer coming from libevent is aligned. Copy thederaadt2015-01-201-3/+6
| | | | | int to an aligned variable before operating on it. ok claudio
* Remove unnecessary netinet/in_systm.h include.lteo2014-10-251-2/+1
| | | | ok millert@
* Respect the max pdu length and merge all send_label* functions intorenato2013-10-171-156/+42
| | | | a single generic function.
* Improve parsing of label mapping messages and merge all recv_label*renato2013-10-171-364/+190
| | | | | | | | functions into a single generic function. Add a few error checks and implement parsing of optional tlvs. Putting it all together helps avoid to code duplication and improve maintainability.
* Generate the NBR_EVT_PDU_RCVD event in a single point.renato2013-10-151-11/+1
| | | | OK claudio@
* Improve parsing of LDP messages.renato2013-10-151-50/+104
| | | | | | Add more sanity checks and send proper notification messages on error conditions. OK claudio@
* Always accept TCP connection requests and identify to which neighborclaudio2013-06-041-6/+6
| | | | | | | | it belongs only _after_ receiving an Initialization message containing the information we need. Before an Initialization message is received, the TCP connection shouldn't be associated with any neighbor/adjacency. Therefor refactor that part into a own module. From Renato Westphal
* Restart the keepalive timer whenever a LDP PDU is sent. There is no needclaudio2013-06-011-1/+6
| | | | | | | to send a keepalive packet when a other PDU was sent out. Also add a missing NBR_EVT_PDU_RCVD call to recv_address() which restarts the session keepalive timeout. All other places already do that. Diff by Renato Westphal
* Improve error handling on session_readclaudio2013-06-011-31/+1
| | | | | | | | | | | * Don't try to send a Shutdown message if the connection is already closed or a read error occured; * As per RFC 5036, send a Shutdown message if an unexpected message is received during the initialization process; * Check if the whole LSR ID of received messages is correct; * On ldpe_dispatch_main(), ignore the messages from the lde process whose associated neighbor is not in the operational state. Diff from Renato Westphal
* Drop support for per-interface labelspaces.claudio2013-06-011-6/+6
| | | | | | | Support for per-interface labelspaces is only necessary for legacy ATM/FR interfaces running in cell-mode. We shouldn't worry about this. For platform-wide label spaces the label space id is always 0. Diff by Renato Westphal
* Drop support for passive interfaces.claudio2013-06-011-16/+1
| | | | | | Support for passive interfaces was inherited from ospfd but it doesn't make any sense at all for ldpd. Diff from Renato Westphal
* Rename struct fec_tlv to struct tlv since it is just the genericclaudio2011-01-101-7/+7
| | | | | TLV header which will be used in different places shortly. Cleanup the ldp.h header file a tiny bit.
* Add missing #includes instead of assuming that some system header pulls inguenther2010-12-311-1/+2
| | | | | | the needed bits ok deraadt@, millert@
* Rewrite all packet parsers to be more careful about alignment. Untilclaudio2010-11-041-163/+230
| | | | | | | now ldpd had no chance to run on a strict alignment architecture but this makes ldpd happy on sparc64. Be careful to do all needed overflow checks and try to make all parsing functions look similar. OK michele@
* Implement the optional label request message ID TLV.claudio2010-10-261-26/+57
| | | | Currently on the genaration side is done.
* For label release and withdraw messages make sure that a wildcardclaudio2010-10-261-6/+33
| | | | | | | FEC is the one and only FEC of that message. This is required by the RFC. While it is not correct to have multiple FEC in anything but label mapping messages ldpd will accept those since the RFC is extra vague about this feature and it does not hurt.
* struct mapping_entry should just have a struct map instead of ownclaudio2010-10-261-20/+20
| | | | | definition of a FEC mapping. This makes extending struct map simpler and makes it possible to access the additional data in struct map.
* Switch prefix in struct map to a struct in_addr instead of a u_int32_t.claudio2010-06-301-7/+7
| | | | Needed for further clean etc.
* Move the logging of FEC changes to the LDE and print the FEC and labelclaudio2010-06-091-19/+1
| | | | | information. This is more useful. OK michele