OpenBSD CVS

CVS log for src/usr.sbin/ldpd/neighbor.c


[BACK] Up to [local] / src / usr.sbin / ldpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.81 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:48 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, HEAD
Changes since 1.80: +2 -2 lines
Diff to previous 1.80 (colored)

When system calls indicate an error they return -1, not some arbitrary
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.

Revision 1.80 / (download) - annotate - [select for diffs], Wed Jan 23 02:02:04 2019 UTC (5 years, 4 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.79: +4 -7 lines
Diff to previous 1.79 (colored)

rework how tcp md5 signatures are configured.

previously ldpd only allowed tcp md5 to be configured against a
neighbor (by ldp router id), but other vendors supported configuring
tcp md5sig by prefix as well as neighbor. this reworks the config
so auth is maintained globally as a list of prefixes that you do
and do not want to do tcp md5sig auth with.

the config statements look more like what is in bgpd.conf now too.

an example of the new config for interoperating with my baby cisco
test network:

on ios:

	mpls ldp password required for MPLS
	mpls ldp password option 1 for MPLS key-chain LDPAUTH

	key chain LDPAUTH
	 key 1
	  key-string secret

	interface Loopback0
	 ip address 192.168.0.0 255.255.255.255
	end

	ip prefix-list MPLS seq 5 permit 192.168.0.0/24
	ip access-list standard MPLS

	mpls ldp router-id Loopback0 force

and in ldpd.conf:

	router-id 192.168.0.25
	tcp md5sig password secret 192.168.0.0/24
	address-family ipv4 { interface vmx1 }

this still supports specifying tcp md5sig on neighbors, but that
is syntactic sugar around adding entries to the list of auths.

ok (and lots of help from) claudio@

Revision 1.79 / (download) - annotate - [select for diffs], Sat Mar 4 00:15:35 2017 UTC (7 years, 3 months ago) by renato
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.78: +2 -1 lines
Diff to previous 1.78 (colored)

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

Revision 1.78 / (download) - annotate - [select for diffs], Sat Sep 3 16:07:08 2016 UTC (7 years, 9 months ago) by renato
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored)

Rework the sending of address messages.

* Respect the session's negotiated maximum pdu length and split the
  sending of our local addresses into multiple messages if necessary;

* Log sent/received addresses;

* Add new wrappers to send only one address (send_address_single)
  and to send all addresses of the given address-family
  (send_address_all). These wrappers create a temporary list of addresses
  to be sent, and send_address() then acts on this last.

Revision 1.77 / (download) - annotate - [select for diffs], Fri Jul 1 23:29:55 2016 UTC (7 years, 11 months ago) by renato
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.76: +3 -1 lines
Diff to previous 1.76 (colored)

Several minor tweaks.

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jul 1 23:22:42 2016 UTC (7 years, 11 months ago) by renato
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Decrease the initialization FSM timeout.

The previous value of 180 was just too long. If a neighbor get stuck in
the initialization FSM for more than 15 seconds, then there's certainly
something wrong and the session should be dropped.

A potential case of a neighbor getting stuck in the initialization
FSM is when both the local and the remote LSRs disable the LDPv4 GTSM
negotiation and there's a mismatch in their GTSM configuration (one is
enabled for GTSM while the other is not).

In this case, a smaller timeout allows for a quicker recovery of the
session when the configuration is fixed on either side.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Jul 1 23:14:31 2016 UTC (7 years, 11 months ago) by renato
Branch: MAIN
Changes since 1.74: +89 -1 lines
Diff to previous 1.74 (colored)

Add GTSM support (RFC 6720).

This also finishes the missing bits from our RFC 7552 implementation
because GTSM is mandatory for LDPv6.

To avoid any kind of interoperability problems, I included a few
knobs to enable/disable GTSM on a per-address-family and per-neighbor
basis. Cisco's LDPv6 implementation, for instance, doesn't support GTSM.

"reads good" claudio@

Revision 1.74 / (download) - annotate - [select for diffs], Mon Jun 13 23:01:37 2016 UTC (7 years, 11 months ago) by renato
Branch: MAIN
Changes since 1.73: +2 -1 lines
Diff to previous 1.73 (colored)

Implement support for the Configuration Sequence Number TLV.

The Configuration Sequence Number optional TLV is documented in RFC 5036,
pages 53 and 54.

Fixes IxANVL LDP test 23.10.

Revision 1.73 / (download) - annotate - [select for diffs], Mon Jun 13 20:19:40 2016 UTC (7 years, 11 months ago) by renato
Branch: MAIN
Changes since 1.72: +41 -1 lines
Diff to previous 1.72 (colored)

Implement a timeout for the session initialization FSM.

This prevents neighbors stuck in the initialization FSM to linger forever
as long as the associated transport connection is up.

This timeout can be seen in the 'Session Initialization State Transition
Diagram' of RFC 5036. The RFC, however, doesn't specify how much we
should wait. Let's use 180 seconds for that, the default LDP hold time.

Fixes IxANVL LDP test 6.15.

Revision 1.72 / (download) - annotate - [select for diffs], Mon May 23 19:20:55 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.71: +17 -1 lines
Diff to previous 1.71 (colored)

Add support for manually resetting neighbors.

Revision 1.71 / (download) - annotate - [select for diffs], Mon May 23 19:14:03 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.70: +2 -1 lines
Diff to previous 1.70 (colored)

Update copyright information.

Revision 1.70 / (download) - annotate - [select for diffs], Mon May 23 19:11:42 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.69: +2 -13 lines
Diff to previous 1.69 (colored)

Remove superfluous includes.

Revision 1.69 / (download) - annotate - [select for diffs], Mon May 23 19:09:25 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.68: +49 -50 lines
Diff to previous 1.68 (colored)

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.

Revision 1.68 / (download) - annotate - [select for diffs], Mon May 23 18:58:48 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.67: +76 -37 lines
Diff to previous 1.67 (colored)

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.

Revision 1.67 / (download) - annotate - [select for diffs], Mon May 23 18:55:21 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.66: +2 -4 lines
Diff to previous 1.66 (colored)

Assorted fixes and small cleanup.

Nothing really interesting here.

Revision 1.66 / (download) - annotate - [select for diffs], Mon May 23 18:28:22 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.65: +8 -8 lines
Diff to previous 1.65 (colored)

Copy structs by assignment instead of memcpy.

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.

Revision 1.65 / (download) - annotate - [select for diffs], Mon May 23 17:43:42 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.64: +18 -10 lines
Diff to previous 1.64 (colored)

Fix mess caused by my commit script.

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

Revision 1.64 / (download) - annotate - [select for diffs], Mon May 23 16:58:31 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.63: +3 -1 lines
Diff to previous 1.63 (colored)

Fix fd leak in error path.

Revision 1.63 / (download) - annotate - [select for diffs], Mon May 23 16:23:06 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

Reuse nbr_pending_connect() on nbr_del().

Revision 1.62 / (download) - annotate - [select for diffs], Mon May 23 16:20:59 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.61: +8 -8 lines
Diff to previous 1.61 (colored)

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.

Revision 1.61 / (download) - annotate - [select for diffs], Mon May 23 16:18:51 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.60: +9 -9 lines
Diff to previous 1.60 (colored)

Make neighbor parameters per lsr-id not per transport-address.

With the advent of IPv6 support, a single neighbor can have two different
transport-addresses: one for ipv4 and one for ipv6. In order to define
neighbor-specific parameters in an indistinguishable way, define them
by lsr-id. This way we can switch between LDPov4 and LDPov6 and keep
the same configuration.

Revision 1.60 / (download) - annotate - [select for diffs], Mon May 23 16:16:44 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.59: +26 -1 lines
Diff to previous 1.59 (colored)

Rework the way we handle income connection requests.

The logic of the previous code was to accept all TCP connection requests
(destined to port 646) and create a tcp_conn structure for each them. Once
the first packet of a connection was received, we would analyze the
LDP Initialization message and identify its origin by looking at the
LSR-ID field.

When parsing a received TCP packet, we would need to distinguish between
two cases: tcp packet from an LDP neighbor and tcp packet from a newborn
connection (not associated with any neighbor yet). For this reason,
the session_read() function was quite complicated.

Also, we were not keeping track of the allocated tcp_conn structures. So,
we were subject to memory leaks and even DOS attacks.

With this patch, we also accept all TCP connection requests, but with two
major differences:
* We identify the neighbor by the source address of the SYN
  packet. This is possible because we don't support label spaces, so
  the transport-address by itself is enough to identify a neighbor,
  we don't need to wait for the Initialization message;
* If there's no matching adjacency for this neighbor, then we start a
  timer of 5 seconds. If we receive a Hello packet from this neighbor
  within this interval, then we stop this timer and move on in
  the Initialization state machine. Otherwise, we send a No Hello
  Notification message and close the socket. We try to avoid sending
  the No Hello notification as much as possible because it triggers the
  backoff exponential in the remote peer, which considerably slow down
  the session establishment process.

In summary, this new approach allows for a simpler code and fixes the
memory leak problem mentioned before.

Revision 1.59 / (download) - annotate - [select for diffs], Mon May 23 15:59:55 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.58: +2 -5 lines
Diff to previous 1.58 (colored)

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".

Revision 1.58 / (download) - annotate - [select for diffs], Mon May 23 15:57:50 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.57: +4 -11 lines
Diff to previous 1.57 (colored)

Remove duplicated code in timer functions.

Revision 1.57 / (download) - annotate - [select for diffs], Mon May 23 15:49:31 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

We don't need a separate function for sending address withdraws.

Address and Address Withdraw messages have the exact same format, only
their type is different.

Revision 1.56 / (download) - annotate - [select for diffs], Mon May 23 15:47:24 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.55: +1 -17 lines
Diff to previous 1.55 (colored)

Move some code around.

This patch doesn't introduce any logical change.

Revision 1.55 / (download) - annotate - [select for diffs], Mon May 23 15:43:11 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.54: +11 -10 lines
Diff to previous 1.54 (colored)

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.

Revision 1.54 / (download) - annotate - [select for diffs], Mon May 23 15:41:04 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.53: +13 -1 lines
Diff to previous 1.53 (colored)

Allow setting the session holdtime per neighbor.

Revision 1.53 / (download) - annotate - [select for diffs], Mon May 23 15:14:07 2016 UTC (8 years ago) by renato
Branch: MAIN
Changes since 1.52: +27 -30 lines
Diff to previous 1.52 (colored)

Replace manually written function names with __func__.

Revision 1.52 / (download) - annotate - [select for diffs], Tue Jul 21 05:02:57 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.51: +1 -25 lines
Diff to previous 1.51 (colored)

Rename, move and reuse mapping list functions.

ok claudio@

Revision 1.51 / (download) - annotate - [select for diffs], Tue Jul 21 05:01:46 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored)

Remove more unused defines.

ok claudio@

Revision 1.50 / (download) - annotate - [select for diffs], Tue Jul 21 04:58:48 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.49: +24 -13 lines
Diff to previous 1.49 (colored)

Fix some awful ipc synchronization issues.

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@

Revision 1.49 / (download) - annotate - [select for diffs], Tue Jul 21 04:43:28 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (colored)

Add configuration reload support.

ok claudio@

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jul 19 21:04:38 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.47: +2 -1 lines
Diff to previous 1.47 (colored)

Add missing LIST_INIT's.

ok claudio@

Revision 1.47 / (download) - annotate - [select for diffs], Sun Jul 19 21:01:56 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.46: +56 -5 lines
Diff to previous 1.46 (colored)

Implement md5 authentication support.

ok claudio@

Revision 1.46 / (download) - annotate - [select for diffs], Sun Jul 19 20:50:03 2015 UTC (8 years, 10 months ago) by renato
Branch: MAIN
Changes since 1.45: +3 -5 lines
Diff to previous 1.45 (colored)

Remove incomplete support for unnecessary modes of  operation.

LDP has several modes of operation, it was designed in that way so it
could run on legacy equipment like ATM/FR switches with very strict
memory limitations.

For modern hardware there's no point on using either the "Conservative
Label Retention" or "Downstream On Demand" modes of operation since they
save memory at cost of blackholing traffic when routing changes. Major
vendors implement only the "Liberal Label Retention" and "Downstream
Unsolicited" modes for non ATM/FR hardware. Let's do that too.

As for using either "Independent Control" or "Ordered Control", let's
stick with the first option mainly because it's easier to implement
and because it doesn't really matter which control mode is used. For
reference, Cisco implements only "Independent Control" and Juniper only
"Ordered Control". Both modes are interoperable.

The point of supporting only one combination of all modes of operation
is that it will allow for the writing of a simpler code without removing
useful functionality.

ok claudio@

Revision 1.45 / (download) - annotate - [select for diffs], Sat Mar 21 18:34:01 2015 UTC (9 years, 2 months ago) by renato
Branch: MAIN
Changes since 1.44: +1 -28 lines
Diff to previous 1.44 (colored)

Remove unused variables and functions.

Revision 1.44 / (download) - annotate - [select for diffs], Mon Feb 9 11:54:24 2015 UTC (9 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.43: +2 -4 lines
Diff to previous 1.43 (colored)

More SOCK_NONBLOCK | SOCK_CLOEXEC love and one less session_socket_blockmode

Revision 1.43 / (download) - annotate - [select for diffs], Thu Oct 17 17:47:04 2013 UTC (10 years, 7 months ago) by renato
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.42: +7 -7 lines
Diff to previous 1.42 (colored)

Improve parsing of label mapping messages and merge all recv_label*
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.

Revision 1.42 / (download) - annotate - [select for diffs], Tue Oct 15 20:41:10 2013 UTC (10 years, 7 months ago) by renato
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

Minor fixes on if_del() and nbr_new().

if_del(): this function is always called after an IF_EVT_DOWN event so
there's no need to cleanup things here;

nbr_new(): C structs shouldn't be copied directly.

OK claudio@

Revision 1.41 / (download) - annotate - [select for diffs], Tue Oct 15 20:36:30 2013 UTC (10 years, 7 months ago) by renato
Branch: MAIN
Changes since 1.40: +3 -8 lines
Diff to previous 1.40 (colored)

Simplify the lde_nbr_new() function.

There's no need the pass a whole lde_nbr structure as argument if we
want only the neighbor IP address.

Also, remove the lde_nbr_del() prototype on lde.h because it's a
duplicate.

OK claudio@

Revision 1.40 / (download) - annotate - [select for diffs], Tue Oct 15 20:31:13 2013 UTC (10 years, 7 months ago) by renato
Branch: MAIN
Changes since 1.39: +8 -7 lines
Diff to previous 1.39 (colored)

Improve debug and error logs.
OK claudio@

Revision 1.39 / (download) - annotate - [select for diffs], Tue Oct 15 20:21:26 2013 UTC (10 years, 7 months ago) by renato
Branch: MAIN
Changes since 1.38: +3 -3 lines
Diff to previous 1.38 (colored)

Fix whitespace and other style issues.
OK claudio@

Revision 1.38 / (download) - annotate - [select for diffs], Tue Jun 4 02:39:10 2013 UTC (11 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.37: +10 -1 lines
Diff to previous 1.37 (colored)

Speed-up the session establishment process
* Send an extra Hello message before attempting to connect to a remote
  peer to guarantee that it formed an adjacency with us as well;
* Don't wait for the first timeout to send the first Hello message.
Both tricks together will allow for fast session establish since with both
optimizations passive role neighbors can open the connection immediatly by
sending and receiving the hellos at the same time as the TCP session.
From Renato Westphal

Revision 1.37 / (download) - annotate - [select for diffs], Tue Jun 4 02:34:48 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.36: +9 -42 lines
Diff to previous 1.36 (colored)

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

Revision 1.36 / (download) - annotate - [select for diffs], Tue Jun 4 02:25:28 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.35: +4 -60 lines
Diff to previous 1.35 (colored)

Implement support for adjacencies and targeted hellos
Refactor adjacencies out of the neighbor handling so that it is possible to
have more complex topologies with targeted sessions.
From Renato Westphal

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jun 4 01:32:16 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.34: +23 -7 lines
Diff to previous 1.34 (colored)

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

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jun 4 00:56:49 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.33: +48 -52 lines
Diff to previous 1.33 (colored)

Minor adjustments in the initialization FSM
* Remove the unused NBR_EVT_DOWN event;
* Print the FSM transitions before performing the appropriate actions. In
  this way nested calls to nbr_fsm() won't print the state transitions in
  reverse order;
* When playing the active role of the initialization process, transition
  from NBA_STA_PRESENT to NBR_STA_INITIAL before going to NBR_STA_OPENSENT;
* Call session_shutdown() on nbr_ktimeout() to remove duplicated code;
* Notify the lde process when a neighbor is deleted (discovery timeout);
* Fix a few memory leaks on nbr_del().
Diff from Renato Westphal.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 1 19:42:07 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

Restart the keepalive timer whenever a LDP PDU is sent. There is no need
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

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jun 1 19:28:55 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.31: +2 -6 lines
Diff to previous 1.31 (colored)

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

Revision 1.31 / (download) - annotate - [select for diffs], Sat Jun 1 18:47:07 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.30: +3 -9 lines
Diff to previous 1.30 (colored)

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

Revision 1.30 / (download) - annotate - [select for diffs], Sat Jun 1 18:24:28 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.29: +13 -13 lines
Diff to previous 1.29 (colored)

Use the nbr_stop_[*]timer functions
Diff from Renato Westphal

Revision 1.29 / (download) - annotate - [select for diffs], Sat Jun 1 18:21:45 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.28: +2 -6 lines
Diff to previous 1.28 (colored)

After sending a keepalive message in the OPENSENT state, we must move to
the OPENREC state and wait for a keepalive before considering the
session as established
Another bug fix by Renato Westphal

Revision 1.28 / (download) - annotate - [select for diffs], Sat Jun 1 18:16:35 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.27: +15 -15 lines
Diff to previous 1.27 (colored)

After returning from accept, we got a TCP connection not a LDP session.
Rename event/actions in the discovery FSM to avoid confusion
* NBR_EVT_SESSION_UP -> NBR_EVT_CONNECT_UP
* NBR_ACT_SESSION_EST -> NBR_ACT_CONNECT_SETUP
* nbr_act_session_establish -> nbr_act_connect_setup
* NBR_ACT_INIT_SEND -> NBR_ACT_PASSIVE_INIT
* NBR_ACT_STRT_KTIMER -> NBR_ACT_SESSION_EST
Diff by Renato Westphal

Revision 1.27 / (download) - annotate - [select for diffs], Sat Jun 1 01:34:57 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.26: +33 -9 lines
Diff to previous 1.26 (colored)

Always advertise the Router-ID as the transport address.
RFC 5036 - Section 2.5.2 says:
    An LSR MUST advertise the same transport address in all
    Hellos that advertise the same label space...
To satisfy this condition, always advertise the Router-ID as the
transport address by using the "IPv4 Transport Address" TLV in the
generated Hello messages.
From Renato Westphal

Revision 1.26 / (download) - annotate - [select for diffs], Fri May 31 14:10:10 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.25: +49 -9 lines
Diff to previous 1.25 (colored)

When the ldpe process calls connect(), it doesn't regain control until
either the connection is made or an error occurs. The time the process
is blocked can be significantly large to the point of other LDP sessions
being torn down because of their holdtime. Besides that, the ldpctl
program gets unresponsive if the ldpe process is blocked. Fix these
issues by using a non-blocking connect.
Diff from Renato Westphal [renatowestphal at gmail.com]

Revision 1.25 / (download) - annotate - [select for diffs], Thu May 30 16:14:50 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.24: +5 -2 lines
Diff to previous 1.24 (colored)

Simplify hello holdtime calculation and stop the timeout timer if the
holdtime is "infinite".
Diff from Renato Westphal [renatowestphal at gmail.com]

Revision 1.24 / (download) - annotate - [select for diffs], Sat Mar 12 01:57:13 2011 UTC (13 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.23: +4 -2 lines
Diff to previous 1.23 (colored)

Bad bad Claudio. Fix an evil bug that caused nbr addr_tree corruption.
Do not insert neighbors first to the address tree and then assign the
address to the struct. Instead pass the address to nbr_new() so all
keys for the various RB trees are available when setting the neighbor up.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jan 10 12:28:25 2011 UTC (13 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.22: +73 -62 lines
Diff to previous 1.22 (colored)

Fix a bad heritage from ospfd. Make neighbors independent of interfaces.
They are not bound as strongly as in ospf and causes problems when the
TCP connection is established from an not connected IP (e.g. a loopback).
Use three RB trees to sort the neighbor list by id, addr and peerid.
More cleanup is needed but this makes ldpd work against peers using
loopback IPs. Problem found, reported and fix tested again by Marcel Wiget.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Oct 26 12:22:35 2010 UTC (13 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.21: +4 -7 lines
Diff to previous 1.21 (colored)

struct mapping_entry should just have a struct map instead of own
definition of a FEC mapping. This makes extending struct map simpler
and makes it possible to access the additional data in struct map.

Revision 1.21 / (download) - annotate - [select for diffs], Mon Sep 6 08:36:33 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.20: +4 -1 lines
Diff to previous 1.20 (colored)

Only run the nbr_idtimer() when this side is acting as master (establishing
the tcp session). Calling nbr_act_session_establish() on slave systems can
crash ldpd because active events are reinitialized.
OK michele@

Revision 1.20 / (download) - annotate - [select for diffs], Mon Sep 6 08:28:44 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.19: +3 -57 lines
Diff to previous 1.19 (colored)

The nbr_reset_*() timer fucntions are the same as the nbr_start_* function.
So replace the few calls to the reset function with nbr_start_*().
OK michele@

Revision 1.19 / (download) - annotate - [select for diffs], Thu Sep 2 14:34:04 2010 UTC (13 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.18: +5 -5 lines
Diff to previous 1.18 (colored)

NBR_STA_SESSION, NBR_STA_UP, and NBR_STA_ACTIVE represent all the same
group of states (all but NBR_STA_DOWN). Clean up this confusion and remove
NBR_STA_UP and NBR_STA_ACTIVE.
OK michele@

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jun 30 01:47:11 2010 UTC (13 years, 11 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Switch prefix in struct map to a struct in_addr instead of a u_int32_t.
Needed for further clean etc.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jun 10 10:04:10 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)

Signal a neighbor down event to the LDE when the TCP session is closed.
The LDE only tracks neighbors with a running sessions, no session no
neighbor needed. So do not wait until the neighbor is removed in the
engine to signal the LDE since that happens a lot later.
Solves a fatal in LDE when restarting a remote ldpd quickly.
OK michele

Revision 1.16 / (download) - annotate - [select for diffs], Fri May 28 12:27:17 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.15: +17 -9 lines
Diff to previous 1.15 (colored)

Send the IMSG_NEIGHBOR_UP msg when the neighbor is going into operational
status instead upon creation (when the first HELLO is received). The LDE
needs only to know about operational neighbors or it may happen that the
LDE is sending messages to neighbors that have no session open resulting
in a crash because of unitialized structures.
OK michele@

Revision 1.15 / (download) - annotate - [select for diffs], Wed May 26 13:56:08 2010 UTC (14 years ago) by nicm
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

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 1.14 / (download) - annotate - [select for diffs], Tue May 25 09:26:12 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.13: +3 -1 lines
Diff to previous 1.13 (colored)

I removed code in the last commit that is needed. Allocate rbuf now by
default or else we bomb on the first read access.

Revision 1.13 / (download) - annotate - [select for diffs], Wed May 19 15:28:51 2010 UTC (14 years ago) by claudio
Branch: MAIN
Changes since 1.12: +2 -15 lines
Diff to previous 1.12 (colored)

Remove yet another ospf leftover that is not needed here. This time
neighbor self and all the madness surrounding this amazing concept.
LDP is not self aware so there is no need for this.
OK michele@

Revision 1.12 / (download) - annotate - [select for diffs], Fri Mar 26 16:02:18 2010 UTC (14 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.11: +3 -2 lines
Diff to previous 1.11 (colored)

Never call close(nbr->fd) when the neighbor session was fully established,
call session_close(nbr) instead since only that will do all needed cleanup.
Still not prefect but at least the lde is no longer eating all CPU when a
session times out. OK michele@

Revision 1.11 / (download) - annotate - [select for diffs], Thu Feb 25 17:40:46 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.10: +11 -22 lines
Diff to previous 1.10 (colored)

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

Revision 1.10 / (download) - annotate - [select for diffs], Sun Feb 21 20:41:35 2010 UTC (14 years, 3 months ago) by michele
Branch: MAIN
Changes since 1.9: +6 -1 lines
Diff to previous 1.9 (colored)

Check bufferevent_new() return value. If it is NULL print an error message
and return.

From Martin Hedenfalk.

ok claudio@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 20 21:05:00 2010 UTC (14 years, 3 months ago) by michele
Branch: MAIN
Changes since 1.8: +14 -80 lines
Diff to previous 1.8 (colored)

Remove unneeded abstraction in neighbor fsm.

ok claudio@

Revision 1.8 / (download) - annotate - [select for diffs], Fri Feb 19 14:32:34 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.7: +1 -2 lines
Diff to previous 1.7 (colored)

Oups, unbreak build.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Feb 19 13:37:09 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.6: +12 -24 lines
Diff to previous 1.6 (colored)

Cleanup a bit, remove unneeded dummy neighbor and initialize queue heads
in the correct place. Queue mappings ordered by inserting at tail.
OK michele

Revision 1.6 / (download) - annotate - [select for diffs], Thu Feb 18 09:26:29 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.5: +1 -4 lines
Diff to previous 1.5 (colored)

Remove some debug messages that are too verbose and no longer needed.
OK michele@

Revision 1.5 / (download) - annotate - [select for diffs], Thu Feb 18 09:25:16 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored)

Close a fd leak when opening the tcp connection to the neighbor.
OK michele

Revision 1.4 / (download) - annotate - [select for diffs], Sun Dec 6 16:12:47 2009 UTC (14 years, 6 months ago) by michele
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

During the session's initialization, when playing the passive role, send
the initialization message before the keepalive.

This fixes session initialazion failures noticed by Christophe Fillot.

ok claudio@

Revision 1.3 / (download) - annotate - [select for diffs], Sat Aug 1 12:47:02 2009 UTC (14 years, 10 months ago) by michele
Branch: MAIN
Changes since 1.2: +11 -4 lines
Diff to previous 1.2 (colored)

Correctly print interface state and neighbor uptime in ldpctl show neighbor.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jun 5 22:34:45 2009 UTC (15 years ago) by michele
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

Correctly send notification messages when errors occur.

ok claudio@ laurent@

Revision 1.1 / (download) - annotate - [select for diffs], Mon Jun 1 20:59:45 2009 UTC (15 years ago) by michele
Branch: MAIN

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@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.