summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2010-02-01 17:19:12 +0000
committerpaulo <paul@bayleaf.org.uk>2010-02-01 17:19:12 +0000
commitb5be77ccc56a4345fd18c97f2daa7cf4342a2438 (patch)
tree12226fed6fea36de8c6d484439960c919c4642d1
parent6e75be0d8cb3810692b78292f827b58f69a4c67c (diff)
downloadquagga-b5be77ccc56a4345fd18c97f2daa7cf4342a2438.tar.bz2
quagga-b5be77ccc56a4345fd18c97f2daa7cf4342a2438.tar.xz
Use session->notification instead of peer's. Fix HUP - race condition.
-rw-r--r--bgpd/bgp_main.c3
-rw-r--r--bgpd/bgp_open.c7
-rw-r--r--bgpd/bgp_peer.c4
-rw-r--r--bgpd/bgp_peer.h3
-rw-r--r--bgpd/bgp_route.c1
-rw-r--r--bgpd/bgp_vty.c5
-rw-r--r--lib/command_queue.c8
7 files changed, 15 insertions, 16 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index 7aed87cc..05868896 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -203,6 +203,7 @@ sighup (void)
zlog_info ("bgpd restarting!");
/* Reload config file. */
+ vty_reset();
vty_read_config (config_file, config_default);
/* Create VTY's socket */
@@ -652,7 +653,7 @@ sighup_action(mqueue_block mqb, mqb_flag_t flag)
{
if (flag == mqb_action)
{
- bgp_terminate (0, 0); /* send notfies */
+ bgp_terminate (0, 0); /* send notifies */
bgp_reset ();
}
diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
index 9e878784..7bcddca0 100644
--- a/bgpd/bgp_open.c
+++ b/bgpd/bgp_open.c
@@ -58,8 +58,11 @@ bgp_capability_vty_out (struct vty *vty, struct peer *peer)
struct capability_mp_data mpc;
struct capability_header *hdr;
- pnt = (char*)peer->notify->data;
- end = pnt + peer->notify->length;
+ if (peer == NULL || peer->session == NULL || peer->session->notification == NULL)
+ return;
+
+ pnt = (char*)peer->session->notification->data;
+ end = pnt + peer->session->notification->length;
while (pnt < end)
{
diff --git a/bgpd/bgp_peer.c b/bgpd/bgp_peer.c
index 54e84e49..bc112c24 100644
--- a/bgpd/bgp_peer.c
+++ b/bgpd/bgp_peer.c
@@ -200,7 +200,7 @@ bgp_session_has_established(bgp_peer peer)
SET_FLAG (peer->sflags, PEER_STATUS_CAPABILITY_OPEN);
/* Clear last notification data. */
- bgp_notify_unset(&(peer->notify));
+ bgp_notify_unset(&(peer->session->notification));
/* Clear start timer value to default. */
peer->v_start = BGP_INIT_START_TIMER;
@@ -954,8 +954,6 @@ peer_free (struct peer *peer)
if (peer->session)
bgp_session_free(peer->session);
- bgp_notify_unset(&peer->notify) ;
-
bgp_sync_delete (peer);
memset (peer, 0, sizeof (struct peer));
diff --git a/bgpd/bgp_peer.h b/bgpd/bgp_peer.h
index de0be84f..b05d7e06 100644
--- a/bgpd/bgp_peer.h
+++ b/bgpd/bgp_peer.h
@@ -316,9 +316,6 @@ struct peer
/* Announcement attribute hash. */
struct hash *hash[AFI_MAX][SAFI_MAX];
- /* Notify data. */
- bgp_notify notify;
-
/* Filter structure. */
struct bgp_filter filter[AFI_MAX][SAFI_MAX];
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 37a39ffc..1beae6b2 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -3007,7 +3007,6 @@ bgp_cleanup_routes (void)
void
bgp_reset (void)
{
- vty_reset ();
bgp_zclient_reset ();
access_list_reset ();
prefix_list_reset ();
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index f0462236..5452640b 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -7622,8 +7622,9 @@ bgp_show_peer (struct vty *vty, struct peer *p)
VTY_NEWLINE);
#endif
- if (p->notify != NULL && p->notify->code == BGP_NOTIFY_OPEN_ERR
- && p->notify->subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
+ if (p->session != NULL && p->session->notification != NULL
+ && p->session->notification->code == BGP_NOTIFY_OPEN_ERR
+ && p->session->notification->subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
bgp_capability_vty_out (vty, p);
vty_out (vty, "%s", VTY_NEWLINE);
diff --git a/lib/command_queue.c b/lib/command_queue.c
index 3bb3473f..b14bcd20 100644
--- a/lib/command_queue.c
+++ b/lib/command_queue.c
@@ -34,10 +34,10 @@ cq_enqueue(struct cmd_element *matched_element, struct vty *vty,
int argc, const char *argv[], qpn_nexus bgp_nexus)
{
int i;
- mqueue_block mqb = mqb_init_new(NULL, cq_action, matched_element) ;
+ mqueue_block mqb = mqb_init_new(NULL, cq_action, vty) ;
/* all parameters are pointers so use the queue's argv */
- mqb_push_argv_p(mqb, vty);
+ mqb_push_argv_p(mqb, matched_element);
for (i = 0; i < argc; ++i)
mqb_push_argv_p(mqb, XSTRDUP(MTYPE_MARSHAL, argv[i]));
@@ -55,11 +55,11 @@ cq_action(mqueue_block mqb, mqb_flag_t flag)
void **argv;
int argc;
- matched_element = mqb_get_arg0(mqb);
+ vty = mqb_get_arg0(mqb);
argc = mqb_get_argv_count(mqb);
argv = mqb_get_argv(mqb) ;
- vty = argv[0];
+ matched_element = argv[0];
argv++;
argc--;