summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-08-06 21:05:47 -0700
committerPaul Jakma <paul@quagga.net>2009-08-13 10:19:24 +0100
commit5bd5881838c22e075c3d0c245a8952a55e9dca38 (patch)
treeb0f011eef51409e492ef107aace3fefca4530f77 /bgpd
parent62bed38d2f2c7317b5c97285d9fb935c5fe681e1 (diff)
bgp: missing pieces from listener patch
* bgp_network.c: (bgp_accept) The code in current git will crash as part of the revised listener code is missing. The new listener thread code passes a pointer to a bgp_listener structure, not the bgp pointer. The old code always got a NULL for bgp pointer, so that is now hard coded.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_network.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index ade0fbc6..4cb6f7d8 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -128,21 +128,19 @@ bgp_accept (struct thread *thread)
int bgp_sock;
int accept_sock;
union sockunion su;
+ struct bgp_listener *listener = THREAD_ARG(thread);
struct peer *peer;
struct peer *peer1;
- struct bgp *bgp;
char buf[SU_ADDRSTRLEN];
- /* Regiser accept thread. */
+ /* Register accept thread. */
accept_sock = THREAD_FD (thread);
- bgp = THREAD_ARG (thread);
-
if (accept_sock < 0)
{
zlog_err ("accept_sock is nevative value %d", accept_sock);
return -1;
}
- thread_add_read (master, bgp_accept, bgp, accept_sock);
+ listener->thread = thread_add_read (master, bgp_accept, listener, accept_sock);
/* Accept client connection. */
bgp_sock = sockunion_accept (accept_sock, &su);
@@ -156,7 +154,7 @@ bgp_accept (struct thread *thread)
zlog_debug ("[Event] BGP connection from host %s", inet_sutop (&su, buf));
/* Check remote IP address */
- peer1 = peer_lookup (bgp, &su);
+ peer1 = peer_lookup (NULL, &su);
if (! peer1 || peer1->status == Idle)
{
if (BGP_DEBUG (events, EVENTS))
@@ -176,9 +174,6 @@ bgp_accept (struct thread *thread)
if (peer_sort (peer1) == BGP_PEER_EBGP)
sockopt_ttl (peer1->su.sa.sa_family, bgp_sock, peer1->ttl);
- if (! bgp)
- bgp = peer1->bgp;
-
/* Make dummy peer until read Open packet. */
if (BGP_DEBUG (events, EVENTS))
zlog_debug ("[Event] Make dummy peer structure until read Open packet");
@@ -186,7 +181,7 @@ bgp_accept (struct thread *thread)
{
char buf[SU_ADDRSTRLEN + 1];
- peer = peer_create_accept (bgp);
+ peer = peer_create_accept (peer1->bgp);
SET_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER);
peer->su = su;
peer->fd = bgp_sock;