History log of /openbsd-current/usr.sbin/ldpd/init.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.37 04-Mar-2017 renato

Implement RFC 5919 (LDP End-of-LIB).


# 1.36 04-Mar-2017 renato

Implement RFC 5918 (Typed Wildcard FEC).


# 1.35 04-Mar-2017 renato

Implement RFC 5561 (LDP Capabilities).

This patch per-se doesn't introduce any useful functionality, but prepares
the ground for new enhancements to ldpd (i.e. implementation of new RFCs
that make use of LDP capabilities).


# 1.34 03-Mar-2017 renato

Kill send_notification_nbr().

Be more clever and trigger the PDU SENT event inside send_notification()
when tcp->nbr is set. This way we can eliminate send_notification_nbr()
and always use send_notification() instead.


Revision tags: OPENBSD_6_0_BASE
# 1.33 16-Jul-2016 renato

Fix parsing of mal-formed optional TLVs/Sub-TLVs.

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.


# 1.32 01-Jul-2016 renato

More renaming and whitespace cleanup.

No binary change after "strip -s".


# 1.31 01-Jul-2016 renato

Several minor tweaks.


# 1.30 27-Jun-2016 renato

Handle ibuf_add() errors.

tweaks from claudio@


# 1.29 11-Jun-2016 renato

Make all TLV parsing functions look the same for consistency.

Also, add one more safety check in recv_init().


# 1.28 08-Jun-2016 renato

Add one more safety check for Initialization messages.

RFC 5036 says the following about the "Receiver LDP Identifier" field:
"Identifies the receiver's label space. This LDP Identifier, together
with the sender's LDP Identifier in the PDU header, enables the receiver
to match the Initialization message with one of its Hello adjacencies;

If there is no matching Hello adjacency, the LSR MUST send a Session
Rejected/No Hello Notification message in response to the Initialization
message and not establish the session".

This is one more case of LDP being more complex than what it should have
been. Since LDP support MPLS label spaces (for ATM and FR), just the
sender's LSR-ID in the PDU header is not enough for identifying an Hello
adjacency. We also need the receiver's label space, and that's what this
field gives us. In fact, this field contains the full receiver's LSR-ID,
but the IP part doesn't really matter.

Since we don't support label spaces (and never will), we were happily
ignoring this field. This patch changes this to fix some errors with ANVL.

Fixes the following ANVL LDP tests: 6.5, 6.6 and 6.11.


# 1.27 23-May-2016 renato

Remove superfluous includes.


# 1.26 23-May-2016 renato

Make functions and variables static whenever possible.

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.


# 1.25 23-May-2016 renato

Add support for IPv6 (RFC 7552).

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.


# 1.24 23-May-2016 renato

Fix mess caused by my commit script.

I screwed up everything... trying to fix now.


# 1.23 23-May-2016 renato

Standardize some log messages and fix some inconsistencies.

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.


# 1.22 23-May-2016 renato

More renaming.

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)


# 1.21 23-May-2016 renato

Improve the parser of TCP/session packets.

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.


# 1.20 23-May-2016 renato

Respect the received Max PDU Length field.


# 1.19 23-May-2016 renato

Fix issue with the exponential backoff timer.

Do not start the exponential backoff timer when playing the passive role
of the session establishment process.

RFC 5036 - Section 2.5.3 says:
"The specific session establishment action that must be
delayed is the attempt to open the session transport connection by
the LSR playing the active role".


# 1.18 23-May-2016 renato

Add knob to configure the transport address.

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.


# 1.17 23-May-2016 renato

Allow setting the session holdtime per neighbor.


# 1.16 23-May-2016 renato

Replace manually written function names with __func__.


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.15 25-Oct-2014 lteo

Remove unnecessary netinet/in_systm.h include.

ok millert@


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.14 15-Oct-2013 renato

Fix whitespace and other style issues.
OK claudio@


# 1.13 15-Oct-2013 renato

Improve parsing of LDP messages.
Add more sanity checks and send proper notification messages on error
conditions.
OK claudio@


Revision tags: OPENBSD_5_4_BASE
# 1.12 04-Jun-2013 claudio

Always accept TCP connection requests and identify to which neighbor
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


# 1.11 04-Jun-2013 claudio

Properly implement the exponential backoff timer on session initialization

According with the section 2.5.3 of RFC 5036, an LSR must throttle its
session setup retry attempts with an exponential backoff in situations
where Initialization messages are being NAK'd (because of disagreements
on session parameters). It doesn't mention using this procedure for TCP
connection failures. With that said, start the inactive delay timer only
after receiving an appropriate notification message.

When playing the active role of the initialization process, throttle the
session setup retry attempts by not connecting to the remote peer. When
playing the passive role, throttle the session setup retry attempts by
delaying the processing of the received Initialization message.

Diff by Renato Westphal, adjusted by myself


# 1.10 01-Jun-2013 claudio

The keepalive timeout should be configured on a global basis and not per
interface.
Remove the iface pointer from the 'nbr' structure because it's not
needed anymore.
Diff from Renato Westphal


# 1.9 01-Jun-2013 claudio

Drop support for per-interface labelspaces.
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


# 1.8 01-Jun-2013 claudio

Drop support for passive interfaces.
Support for passive interfaces was inherited from ospfd but it doesn't
make any sense at all for ldpd.
Diff from Renato Westphal


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.7 10-Jan-2011 claudio

Implement optional parameter handling for initialization messages.
This will now correctly ignore TLV with U flag set -- like the FT
extension used by JunOS. The function is built after
tlv_decode_opt_hello_prms().
Problem reported and fix tested by Marcel Wiget.


# 1.6 04-Nov-2010 claudio

Rewrite all packet parsers to be more careful about alignment. Until
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@


Revision tags: OPENBSD_4_8_BASE
# 1.5 26-May-2010 nicm

Rename some imsg bits to make namespace collisions less likely buf to
ibuf, buf_read to ibuf_read, READ_BUF_SIZE to IBUF_READ_SIZE.

ok henning gilles claudio jacekm deraadt


Revision tags: OPENBSD_4_7_BASE
# 1.4 25-Feb-2010 claudio

Do not use bufferevent for something that's already covered in the imsg
buffer API. This fixes a few possible problems in session_read and does
some further cleanup in various places. Wrap msgbuf into evbuf to add
libevent functionality and use buf_read to handle the read side of a
session. OK michele@ and dlg@ did not see anything evil


# 1.3 20-Feb-2010 michele

Make send_* functions return void (and not int) as they can just succeed
or fatal().

ok claudio@


Revision tags: OPENBSD_4_6_BASE
# 1.2 05-Jun-2009 michele

Correctly send notification messages when errors occur.

ok claudio@ laurent@


# 1.1 01-Jun-2009 michele

Welcome ldpd, the Label Distribution Protocol daemon.
Built using the imsg/three process framework, its main aim
is to redistribute MPLS labels between peers.

Right now it has some really basic functionalities,
the basic protocol works and peers are able to exchange
labels and insert them in the kernel.
It still does not react to changes of topology.

Not yet connected to the builds.

ok claudio@ deraadt@