summaryrefslogtreecommitdiffstats
path: root/proto
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2010-02-11 11:12:58 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2010-02-11 11:12:58 +0100
commit2af25a971a28ccac05d2385669e8b103c0328f7d (patch)
treec24af521f1f2581709a81b09c0e624c9983b8fcd /proto
parentfa5a99c766dde2a4ac3d44596ff5396a0efd1cc8 (diff)
downloadbird-2af25a971a28ccac05d2385669e8b103c0328f7d.tar
bird-2af25a971a28ccac05d2385669e8b103c0328f7d.zip
Fixes a crash caused by missing error hook on BGP listening socket.
Error happened when too many BGP connections arrived in one moment (ECONNABORTED).
Diffstat (limited to 'proto')
-rw-r--r--proto/bgp/bgp.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
index 215dc81..f4cb112 100644
--- a/proto/bgp/bgp.c
+++ b/proto/bgp/bgp.c
@@ -55,6 +55,8 @@
#undef LOCAL_DEBUG
+#include <errno.h>
+
#include "nest/bird.h"
#include "nest/iface.h"
#include "nest/protocol.h"
@@ -614,6 +616,15 @@ bgp_incoming_connection(sock *sk, int dummy UNUSED)
return 0;
}
+static void
+bgp_listen_sock_err(sock *sk, int err)
+{
+ if (err == ECONNABORTED)
+ log(L_WARN "BGP: Incoming connection aborted");
+ else
+ log(L_ERR "BGP: Error on incoming socket: %M", err);
+}
+
static sock *
bgp_setup_listen_sk(ip_addr addr, unsigned port, u32 flags)
{
@@ -627,9 +638,10 @@ bgp_setup_listen_sk(ip_addr addr, unsigned port, u32 flags)
s->rbsize = BGP_RX_BUFFER_SIZE;
s->tbsize = BGP_TX_BUFFER_SIZE;
s->rx_hook = bgp_incoming_connection;
+ s->err_hook = bgp_listen_sock_err;
if (sk_open(s))
{
- log(L_ERR "Unable to open incoming BGP socket");
+ log(L_ERR "BGP: Unable to open incoming socket");
rfree(s);
return NULL;
}