summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_message.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_message.c')
-rw-r--r--ospf6d/ospf6_message.c136
1 files changed, 64 insertions, 72 deletions
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 578b39a641..87c905af3f 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -13,10 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
@@ -352,9 +351,9 @@ ospf6_hello_recv (struct in6_addr *src, struct in6_addr *dst,
/* Schedule interface events */
if (backupseen)
- thread_add_event (master, backup_seen, oi, 0);
+ thread_add_event (master, backup_seen, oi, 0, NULL);
if (neighborchange)
- thread_add_event (master, neighbor_change, oi, 0);
+ thread_add_event (master, neighbor_change, oi, 0, NULL);
if (neighbor_ifindex_change && on->state == OSPF6_NEIGHBOR_FULL)
OSPF6_ROUTER_LSA_SCHEDULE (oi->area);
@@ -428,7 +427,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Master/Slave bit mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -436,7 +435,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Initialize bit mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -444,7 +443,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Option field mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -453,7 +452,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Sequence number mismatch (%#lx expected)",
(u_long) on->dbdesc_seqnum);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
break;
@@ -471,7 +470,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Not duplicate dbdesc in state %s",
ospf6_neighbor_state_str[on->state]);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
default:
@@ -517,7 +516,7 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("SeqNumMismatch (E-bit mismatch), discard");
ospf6_lsa_delete (his);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -549,19 +548,20 @@ ospf6_dbdesc_recv_master (struct ospf6_header *oh,
on->dbdesc_seqnum ++;
/* schedule send lsreq */
- if (on->request_list->count && (on->thread_send_lsreq == NULL))
- on->thread_send_lsreq =
- thread_add_event (master, ospf6_lsreq_send, on, 0);
+ if (on->request_list->count)
+ thread_add_event (master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq);
THREAD_OFF (on->thread_send_dbdesc);
/* More bit check */
if (! CHECK_FLAG (dbdesc->bits, OSPF6_DBDESC_MBIT) &&
! CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT))
- thread_add_event (master, exchange_done, on, 0);
- else
- on->thread_send_dbdesc =
- thread_add_event (master, ospf6_dbdesc_send_newone, on, 0);
+ thread_add_event (master, exchange_done, on, 0, NULL);
+ else {
+ on->thread_send_dbdesc = NULL;
+ thread_add_event(master, ospf6_dbdesc_send_newone, on, 0,
+ &on->thread_send_dbdesc);
+ }
/* save last received dbdesc */
memcpy (&on->dbdesc_last, dbdesc, sizeof (struct ospf6_dbdesc));
@@ -637,8 +637,9 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Duplicated dbdesc causes retransmit");
THREAD_OFF (on->thread_send_dbdesc);
- on->thread_send_dbdesc =
- thread_add_event (master, ospf6_dbdesc_send, on, 0);
+ on->thread_send_dbdesc = NULL;
+ thread_add_event(master, ospf6_dbdesc_send, on, 0,
+ &on->thread_send_dbdesc);
return;
}
@@ -646,7 +647,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Master/Slave bit mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -654,7 +655,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Initialize bit mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -662,7 +663,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Option field mismatch");
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -671,7 +672,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Sequence number mismatch (%#lx expected)",
(u_long) on->dbdesc_seqnum + 1);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
break;
@@ -684,15 +685,14 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Duplicated dbdesc causes retransmit");
THREAD_OFF (on->thread_send_dbdesc);
- on->thread_send_dbdesc =
- thread_add_event (master, ospf6_dbdesc_send, on, 0);
+ thread_add_event (master, ospf6_dbdesc_send, on, 0, &on->thread_send_dbdesc);
return;
}
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("Not duplicate dbdesc in state %s",
ospf6_neighbor_state_str[on->state]);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
default:
@@ -735,7 +735,7 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
zlog_debug ("E-bit mismatch with LSA Headers");
ospf6_lsa_delete (his);
- thread_add_event (master, seqnumber_mismatch, on, 0);
+ thread_add_event (master, seqnumber_mismatch, on, 0, NULL);
return;
}
@@ -756,14 +756,11 @@ ospf6_dbdesc_recv_slave (struct ospf6_header *oh,
on->dbdesc_seqnum = ntohl (dbdesc->seqnum);
/* schedule send lsreq */
- if ((on->thread_send_lsreq == NULL) &&
- (on->request_list->count))
- on->thread_send_lsreq =
- thread_add_event (master, ospf6_lsreq_send, on, 0);
+ if (on->request_list->count)
+ thread_add_event (master, ospf6_lsreq_send, on, 0, &on->thread_send_lsreq);
THREAD_OFF (on->thread_send_dbdesc);
- on->thread_send_dbdesc =
- thread_add_event (master, ospf6_dbdesc_send_newone, on, 0);
+ thread_add_event (master, ospf6_dbdesc_send_newone, on, 0, &on->thread_send_dbdesc);
/* save last received dbdesc */
memcpy (&on->dbdesc_last, dbdesc, sizeof (struct ospf6_dbdesc));
@@ -880,7 +877,7 @@ ospf6_lsreq_recv (struct in6_addr *src, struct in6_addr *dst,
zlog_debug ("Can't find requested [%s Id:%s Adv:%s]",
ospf6_lstype_name (e->type), id, adv_router);
}
- thread_add_event (master, bad_lsreq, on, 0);
+ thread_add_event (master, bad_lsreq, on, 0, NULL);
return;
}
@@ -891,8 +888,7 @@ ospf6_lsreq_recv (struct in6_addr *src, struct in6_addr *dst,
/* schedule send lsupdate */
THREAD_OFF (on->thread_send_lsupdate);
- on->thread_send_lsupdate =
- thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0);
+ thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0, &on->thread_send_lsupdate);
}
/* Verify, that the specified memory area contains exactly N valid IPv6
@@ -1532,7 +1528,7 @@ ospf6_receive (struct thread *thread)
/* add next read thread */
sockfd = THREAD_FD (thread);
- thread_add_read (master, ospf6_receive, NULL, sockfd);
+ thread_add_read (master, ospf6_receive, NULL, sockfd, NULL);
/* initialize */
memset (&src, 0, sizeof (src));
@@ -1739,8 +1735,7 @@ ospf6_hello_send (struct thread *thread)
}
/* set next thread */
- oi->thread_send_hello = thread_add_timer (master, ospf6_hello_send,
- oi, oi->hello_interval);
+ thread_add_timer (master, ospf6_hello_send, oi, oi->hello_interval, &oi->thread_send_hello);
memset (sendbuf, 0, iobuflen);
oh = (struct ospf6_header *) sendbuf;
@@ -1804,9 +1799,9 @@ ospf6_dbdesc_send (struct thread *thread)
/* set next thread if master */
if (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT))
- on->thread_send_dbdesc =
- thread_add_timer (master, ospf6_dbdesc_send, on,
- on->ospf6_if->rxmt_interval);
+ thread_add_timer (master, ospf6_dbdesc_send, on,
+ on->ospf6_if->rxmt_interval,
+ &on->thread_send_dbdesc);
memset (sendbuf, 0, iobuflen);
oh = (struct ospf6_header *) sendbuf;
@@ -1896,7 +1891,7 @@ ospf6_dbdesc_send_newone (struct thread *thread)
if (! CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT) && /* Slave */
! CHECK_FLAG (on->dbdesc_last.bits, OSPF6_DBDESC_MBIT) &&
! CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT))
- thread_add_event (master, exchange_done, on, 0);
+ thread_add_event (master, exchange_done, on, 0, NULL);
thread_execute (master, ospf6_dbdesc_send, on, 0);
return 0;
@@ -1927,7 +1922,7 @@ ospf6_lsreq_send (struct thread *thread)
/* schedule loading_done if request list is empty */
if (on->request_list->count == 0)
{
- thread_add_event (master, loading_done, on, 0);
+ thread_add_event (master, loading_done, on, 0, NULL);
return 0;
}
@@ -1978,9 +1973,9 @@ ospf6_lsreq_send (struct thread *thread)
/* set next thread */
if (on->request_list->count != 0)
{
- on->thread_send_lsreq =
- thread_add_timer (master, ospf6_lsreq_send, on,
- on->ospf6_if->rxmt_interval);
+ on->thread_send_lsreq = NULL;
+ thread_add_timer(master, ospf6_lsreq_send, on, on->ospf6_if->rxmt_interval,
+ &on->thread_send_lsreq);
}
return 0;
@@ -2097,13 +2092,16 @@ ospf6_lsupdate_send_neighbor (struct thread *thread)
on->ospf6_if, oh);
}
- if (on->lsupdate_list->count != 0)
- on->thread_send_lsupdate =
- thread_add_event (master, ospf6_lsupdate_send_neighbor, on, 0);
- else if (on->retrans_list->count != 0)
- on->thread_send_lsupdate =
- thread_add_timer (master, ospf6_lsupdate_send_neighbor, on,
- on->ospf6_if->rxmt_interval);
+ if (on->lsupdate_list->count != 0) {
+ on->thread_send_lsupdate = NULL;
+ thread_add_event(master, ospf6_lsupdate_send_neighbor, on, 0,
+ &on->thread_send_lsupdate);
+ }
+ else if (on->retrans_list->count != 0) {
+ on->thread_send_lsupdate = NULL;
+ thread_add_timer(master, ospf6_lsupdate_send_neighbor, on, on->ospf6_if->rxmt_interval,
+ &on->thread_send_lsupdate);
+ }
return 0;
}
@@ -2178,8 +2176,9 @@ ospf6_lsupdate_send_interface (struct thread *thread)
if (oi->lsupdate_list->count > 0)
{
- oi->thread_send_lsupdate =
- thread_add_event (master, ospf6_lsupdate_send_interface, oi, 0);
+ oi->thread_send_lsupdate = NULL;
+ thread_add_event(master, ospf6_lsupdate_send_interface, oi, 0,
+ &oi->thread_send_lsupdate);
}
return 0;
@@ -2223,8 +2222,7 @@ ospf6_lsack_send_neighbor (struct thread *thread)
/* if we run out of packet size/space here,
better to try again soon. */
THREAD_OFF (on->thread_send_lsack);
- on->thread_send_lsack =
- thread_add_event (master, ospf6_lsack_send_neighbor, on, 0);
+ thread_add_event (master, ospf6_lsack_send_neighbor, on, 0, &on->thread_send_lsack);
ospf6_lsdb_lsa_unlock (lsa);
break;
@@ -2248,11 +2246,8 @@ ospf6_lsack_send_neighbor (struct thread *thread)
on->ospf6_if, oh);
}
- if (on->thread_send_lsack == NULL && on->lsack_list->count > 0)
- {
- on->thread_send_lsack =
- thread_add_event (master, ospf6_lsack_send_neighbor, on, 0);
- }
+ if (on->lsack_list->count > 0)
+ thread_add_event (master, ospf6_lsack_send_neighbor, on, 0, &on->thread_send_lsack);
return 0;
}
@@ -2295,8 +2290,8 @@ ospf6_lsack_send_interface (struct thread *thread)
/* if we run out of packet size/space here,
better to try again soon. */
THREAD_OFF (oi->thread_send_lsack);
- oi->thread_send_lsack =
- thread_add_event (master, ospf6_lsack_send_interface, oi, 0);
+ thread_add_event (master, ospf6_lsack_send_interface, oi, 0,
+ &oi->thread_send_lsack);
ospf6_lsdb_lsa_unlock (lsa);
break;
@@ -2324,11 +2319,8 @@ ospf6_lsack_send_interface (struct thread *thread)
ospf6_send (oi->linklocal_addr, &alldrouters6, oi, oh);
}
- if (oi->thread_send_lsack == NULL && oi->lsack_list->count > 0)
- {
- oi->thread_send_lsack =
- thread_add_event (master, ospf6_lsack_send_interface, oi, 0);
- }
+ if (oi->lsack_list->count > 0)
+ thread_add_event (master, ospf6_lsack_send_interface, oi, 0, &oi->thread_send_lsack);
return 0;
}