summaryrefslogtreecommitdiff
path: root/proto/bgp
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:09:31 +0200
committerJan Moskyto Matejka <mq@ucw.cz>2016-04-08 12:28:33 +0200
commit7a7ac656829223713f9e6bcef63d2b5a5efce7d2 (patch)
tree153afd214a815124b37fcd88c66134d716a390cf /proto/bgp
parent4bdf1881dc6230b742d7efcaad8eeac4ed25f445 (diff)
parent06edbb67ed807811654e7fd8f0f9b83766430216 (diff)
Merge branch 'master' into int-new-channels
Diffstat (limited to 'proto/bgp')
-rw-r--r--proto/bgp/bgp.c19
-rw-r--r--proto/bgp/packets.c28
2 files changed, 32 insertions, 15 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index cb5b108c..61b5cba2 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -374,6 +374,8 @@ bgp_conn_enter_established_state(struct bgp_conn *conn)
if (ipa_zero(p->source_addr))
p->source_addr = conn->sk->saddr;
+ conn->sk->fast_rx = 0;
+
p->conn = conn;
p->last_error_class = 0;
p->last_error_code = 0;
@@ -666,6 +668,10 @@ bgp_keepalive_timeout(timer *t)
DBG("BGP: Keepalive timer\n");
bgp_schedule_packet(conn, PKT_KEEPALIVE);
+
+ /* Kick TX a bit faster */
+ if (ev_active(conn->tx_ev))
+ ev_run(conn->tx_ev);
}
static void
@@ -696,6 +702,7 @@ bgp_setup_sk(struct bgp_conn *conn, sock *s)
{
s->data = conn;
s->err_hook = bgp_sock_err;
+ s->fast_rx = 1;
conn->sk = s;
}
@@ -813,7 +820,13 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
return 0;
}
- /* We are in proper state and there is no other incoming connection */
+ /*
+ * BIRD should keep multiple incoming connections in OpenSent state (for
+ * details RFC 4271 8.2.1 par 3), but it keeps just one. Duplicate incoming
+ * connections are rejected istead. The exception is the case where an
+ * incoming connection triggers a graceful restart.
+ */
+
acc = (p->p.proto_state == PS_START || p->p.proto_state == PS_UP) &&
(p->start_state >= BSS_CONNECT) && (!p->incoming_conn.sk);
@@ -823,6 +836,10 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
bgp_handle_graceful_restart(p);
bgp_conn_enter_idle_state(p->conn);
acc = 1;
+
+ /* There might be separate incoming connection in OpenSent state */
+ if (p->incoming_conn.state > BS_ACTIVE)
+ bgp_close_conn(&p->incoming_conn);
}
BGP_TRACE(D_EVENTS, "Incoming connection from %I%J (port %d) %s",
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index ed99f623..72ca3728 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -164,6 +164,14 @@ bgp_put_cap_rr(struct bgp_proto *p UNUSED, byte *buf)
}
static byte *
+bgp_put_cap_ext_msg(struct bgp_proto *p UNUSED, byte *buf)
+{
+ *buf++ = 6; /* Capability 6: Support for extended messages */
+ *buf++ = 0; /* Capability data length */
+ return buf;
+}
+
+static byte *
bgp_put_cap_gr1(struct bgp_proto *p, byte *buf)
{
*buf++ = 64; /* Capability 64: Support for graceful restart */
@@ -223,14 +231,6 @@ bgp_put_cap_err(struct bgp_proto *p UNUSED, byte *buf)
return buf;
}
-static byte *
-bgp_put_cap_ext_msg(struct bgp_proto *p UNUSED, byte *buf)
-{
- *buf++ = 230; /* Capability TBD: Support for extended messages */
- *buf++ = 0; /* Capability data length */
- return buf;
-}
-
static byte *
bgp_create_open(struct bgp_conn *conn, byte *buf)
@@ -827,6 +827,12 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len)
conn->peer_refresh_support = 1;
break;
+ case 6: /* Extended message length capability, draft */
+ if (cl != 0)
+ goto err;
+ conn->peer_ext_messages_support = 1;
+ break;
+
case 64: /* Graceful restart capability, RFC 4724 */
if (cl % 4 != 2)
goto err;
@@ -867,12 +873,6 @@ bgp_parse_capabilities(struct bgp_conn *conn, byte *opt, int len)
conn->peer_enhanced_refresh_support = 1;
break;
- case 230: /* Extended message length capability, draft, cap number TBD */
- if (cl != 0)
- goto err;
- conn->peer_ext_messages_support = 1;
- break;
-
/* We can safely ignore all other capabilities */
}
len -= 2 + cl;