openbox lab initialized

This commit is contained in:
2025-11-06 00:01:42 +08:00
parent 0fe20bb24c
commit edb0725375
2508 changed files with 670396 additions and 66 deletions

View File

@@ -0,0 +1,361 @@
/*
* API message handling module for OSPF daemon and client.
* Copyright (C) 2001, 2002 Ralph Keller
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2, or (at your
* option) any later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
/* This file is used both by the OSPFd and client applications to
define message formats used for communication. */
#ifndef _OSPF_API_H
#define _OSPF_API_H
#define OSPF_API_VERSION 1
/* MTYPE definition is not reflected to "memory.h". */
#define MTYPE_OSPF_API_MSG MTYPE_TMP
#define MTYPE_OSPF_API_FIFO MTYPE_TMP
/* Default API server port to accept connection request from client-side. */
/* This value could be overridden by "ospfapi" entry in "/etc/services". */
#define OSPF_API_SYNC_PORT 2607
/* -----------------------------------------------------------
* Generic messages
* -----------------------------------------------------------
*/
/* Message header structure, fields are in network byte order and
aligned to four octets. */
struct apimsghdr
{
u_char version; /* OSPF API protocol version */
u_char msgtype; /* Type of message */
u_int16_t msglen; /* Length of message w/o header */
u_int32_t msgseq; /* Sequence number */
};
/* Message representation with header and body */
struct msg
{
struct msg *next; /* to link into fifo */
/* Message header */
struct apimsghdr hdr;
/* Message body */
struct stream *s;
};
/* Prototypes for generic messages. */
extern struct msg *msg_new (u_char msgtype, void *msgbody,
u_int32_t seqnum, u_int16_t msglen);
extern struct msg *msg_dup (struct msg *msg);
extern void msg_print (struct msg *msg); /* XXX debug only */
extern void msg_free (struct msg *msg);
struct msg *msg_read (int fd);
extern int msg_write (int fd, struct msg *msg);
/* For requests, the message sequence number is between MIN_SEQ and
MAX_SEQ. For notifications, the sequence number is 0. */
#define MIN_SEQ 1
#define MAX_SEQ 2147483647
extern void msg_set_seq (struct msg *msg, u_int32_t seqnr);
extern u_int32_t msg_get_seq (struct msg *msg);
/* -----------------------------------------------------------
* Message fifo queues
* -----------------------------------------------------------
*/
/* Message queue structure. */
struct msg_fifo
{
unsigned long count;
struct msg *head;
struct msg *tail;
};
/* Prototype for message fifo queues. */
extern struct msg_fifo *msg_fifo_new (void);
extern void msg_fifo_push (struct msg_fifo *, struct msg *msg);
extern struct msg *msg_fifo_pop (struct msg_fifo *fifo);
extern struct msg *msg_fifo_head (struct msg_fifo *fifo);
extern void msg_fifo_flush (struct msg_fifo *fifo);
extern void msg_fifo_free (struct msg_fifo *fifo);
/* -----------------------------------------------------------
* Specific message type and format definitions
* -----------------------------------------------------------
*/
/* Messages to OSPF daemon. */
#define MSG_REGISTER_OPAQUETYPE 1
#define MSG_UNREGISTER_OPAQUETYPE 2
#define MSG_REGISTER_EVENT 3
#define MSG_SYNC_LSDB 4
#define MSG_ORIGINATE_REQUEST 5
#define MSG_DELETE_REQUEST 6
/* Messages from OSPF daemon. */
#define MSG_REPLY 10
#define MSG_READY_NOTIFY 11
#define MSG_LSA_UPDATE_NOTIFY 12
#define MSG_LSA_DELETE_NOTIFY 13
#define MSG_NEW_IF 14
#define MSG_DEL_IF 15
#define MSG_ISM_CHANGE 16
#define MSG_NSM_CHANGE 17
struct msg_register_opaque_type
{
u_char lsatype;
u_char opaquetype;
u_char pad[2]; /* padding */
};
struct msg_unregister_opaque_type
{
u_char lsatype;
u_char opaquetype;
u_char pad[2]; /* padding */
};
/* Power2 is needed to convert LSA types into bit positions,
* see typemask below. Type definition starts at 1, so
* Power2[0] is not used. */
#ifdef ORIGINAL_CODING
static const u_int16_t
Power2[] = { 0x0, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80,
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000
};
#else
static const u_int16_t
Power2[] = { 0, (1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4),
(1 << 5), (1 << 6), (1 << 7), (1 << 8), (1 << 9),
(1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14),
(1 << 15)
};
#endif /* ORIGINAL_CODING */
struct lsa_filter_type
{
u_int16_t typemask; /* bitmask for selecting LSA types (1..16) */
u_char origin; /* selects according to origin. */
#define NON_SELF_ORIGINATED 0
#define SELF_ORIGINATED (OSPF_LSA_SELF)
#define ANY_ORIGIN 2
u_char num_areas; /* number of areas in the filter. */
/* areas, if any, go here. */
};
struct msg_register_event
{
struct lsa_filter_type filter;
};
struct msg_sync_lsdb
{
struct lsa_filter_type filter;
};
struct msg_originate_request
{
/* Used for LSA type 9 otherwise ignored */
struct in_addr ifaddr;
/* Used for LSA type 10 otherwise ignored */
struct in_addr area_id;
/* LSA header and LSA-specific part */
struct lsa_header data;
};
struct msg_delete_request
{
struct in_addr area_id; /* "0.0.0.0" for AS-external opaque LSAs */
u_char lsa_type;
u_char opaque_type;
u_char pad[2]; /* padding */
u_int32_t opaque_id;
};
struct msg_reply
{
signed char errcode;
#define OSPF_API_OK 0
#define OSPF_API_NOSUCHINTERFACE (-1)
#define OSPF_API_NOSUCHAREA (-2)
#define OSPF_API_NOSUCHLSA (-3)
#define OSPF_API_ILLEGALLSATYPE (-4)
#define OSPF_API_OPAQUETYPEINUSE (-5)
#define OSPF_API_OPAQUETYPENOTREGISTERED (-6)
#define OSPF_API_NOTREADY (-7)
#define OSPF_API_NOMEMORY (-8)
#define OSPF_API_ERROR (-9)
#define OSPF_API_UNDEF (-10)
u_char pad[3]; /* padding to four byte alignment */
};
/* Message to tell client application that it ospf daemon is
* ready to accept opaque LSAs for a given interface or area. */
struct msg_ready_notify
{
u_char lsa_type;
u_char opaque_type;
u_char pad[2]; /* padding */
struct in_addr addr; /* interface address or area address */
};
/* These messages have a dynamic length depending on the embodied LSA.
They are aligned to four octets. msg_lsa_change_notify is used for
both LSA update and LSAs delete. */
struct msg_lsa_change_notify
{
/* Used for LSA type 9 otherwise ignored */
struct in_addr ifaddr;
/* Area ID. Not valid for AS-External and Opaque11 LSAs. */
struct in_addr area_id;
u_char is_self_originated; /* 1 if self originated. */
u_char pad[3];
struct lsa_header data;
};
struct msg_new_if
{
struct in_addr ifaddr; /* interface IP address */
struct in_addr area_id; /* area this interface belongs to */
};
struct msg_del_if
{
struct in_addr ifaddr; /* interface IP address */
};
struct msg_ism_change
{
struct in_addr ifaddr; /* interface IP address */
struct in_addr area_id; /* area this interface belongs to */
u_char status; /* interface status (up/down) */
u_char pad[3]; /* not used */
};
struct msg_nsm_change
{
struct in_addr ifaddr; /* attached interface */
struct in_addr nbraddr; /* Neighbor interface address */
struct in_addr router_id; /* Router ID of neighbor */
u_char status; /* NSM status */
u_char pad[3];
};
/* We make use of a union to define a structure that covers all
possible API messages. This allows us to find out how much memory
needs to be reserved for the largest API message. */
struct apimsg
{
struct apimsghdr hdr;
union
{
struct msg_register_opaque_type register_opaque_type;
struct msg_register_event register_event;
struct msg_sync_lsdb sync_lsdb;
struct msg_originate_request originate_request;
struct msg_delete_request delete_request;
struct msg_reply reply;
struct msg_ready_notify ready_notify;
struct msg_new_if new_if;
struct msg_del_if del_if;
struct msg_ism_change ism_change;
struct msg_nsm_change nsm_change;
struct msg_lsa_change_notify lsa_change_notify;
}
u;
};
#define OSPF_API_MAX_MSG_SIZE (sizeof(struct apimsg) + OSPF_MAX_LSA_SIZE)
/* -----------------------------------------------------------
* Prototypes for specific messages
* -----------------------------------------------------------
*/
/* For debugging only. */
extern void api_opaque_lsa_print (struct lsa_header *data);
/* Messages sent by client */
extern struct msg *new_msg_register_opaque_type (u_int32_t seqnum,
u_char ltype, u_char otype);
extern struct msg *new_msg_register_event (u_int32_t seqnum,
struct lsa_filter_type *filter);
extern struct msg *new_msg_sync_lsdb (u_int32_t seqnum,
struct lsa_filter_type *filter);
extern struct msg *new_msg_originate_request (u_int32_t seqnum,
struct in_addr ifaddr,
struct in_addr area_id,
struct lsa_header *data);
extern struct msg *new_msg_delete_request (u_int32_t seqnum,
struct in_addr area_id,
u_char lsa_type,
u_char opaque_type,
u_int32_t opaque_id);
/* Messages sent by OSPF daemon */
extern struct msg *new_msg_reply (u_int32_t seqnum, u_char rc);
extern struct msg *new_msg_ready_notify (u_int32_t seqnr, u_char lsa_type,
u_char opaque_type,
struct in_addr addr);
extern struct msg *new_msg_new_if (u_int32_t seqnr,
struct in_addr ifaddr,
struct in_addr area);
extern struct msg *new_msg_del_if (u_int32_t seqnr, struct in_addr ifaddr);
extern struct msg *new_msg_ism_change (u_int32_t seqnr, struct in_addr ifaddr,
struct in_addr area, u_char status);
extern struct msg *new_msg_nsm_change (u_int32_t seqnr, struct in_addr ifaddr,
struct in_addr nbraddr,
struct in_addr router_id,
u_char status);
/* msgtype is MSG_LSA_UPDATE_NOTIFY or MSG_LSA_DELETE_NOTIFY */
extern struct msg *new_msg_lsa_change_notify (u_char msgtype,
u_int32_t seqnum,
struct in_addr ifaddr,
struct in_addr area_id,
u_char is_self_originated,
struct lsa_header *data);
/* string printing functions */
extern const char *ospf_api_errname (int errcode);
extern const char *ospf_api_typename (int msgtype);
#endif /* _OSPF_API_H */

View File

@@ -0,0 +1,80 @@
/*
* OSPF AS Boundary Router functions.
* Copyright (C) 1999, 2000 Kunihiro Ishiguro, Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_ASBR_H
#define _ZEBRA_OSPF_ASBR_H
struct route_map_set_values
{
int32_t metric;
int32_t metric_type;
};
/* Redistributed external information. */
struct external_info
{
/* Type of source protocol. */
u_char type;
/* Prefix. */
struct prefix_ipv4 p;
/* Interface index. */
unsigned int ifindex;
/* Nexthop address. */
struct in_addr nexthop;
/* Additional Route tag. */
u_int32_t tag;
struct route_map_set_values route_map_set;
#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
#define ROUTEMAP_METRIC_TYPE(E) (E)->route_map_set.metric_type
};
#define OSPF_ASBR_CHECK_DELAY 30
extern void ospf_external_route_remove (struct ospf *, struct prefix_ipv4 *);
extern struct external_info *ospf_external_info_new (u_char);
extern void ospf_reset_route_map_set_values (struct route_map_set_values *);
extern int ospf_route_map_set_compare (struct route_map_set_values *,
struct route_map_set_values *);
extern struct external_info *ospf_external_info_add (u_char,
struct prefix_ipv4,
unsigned int,
struct in_addr);
extern void ospf_external_info_delete (u_char, struct prefix_ipv4);
extern struct external_info *ospf_external_info_lookup (u_char,
struct prefix_ipv4 *);
extern struct ospf_route *ospf_external_route_lookup (struct ospf *,
struct prefix_ipv4 *);
extern void ospf_asbr_status_update (struct ospf *, u_char);
extern void ospf_redistribute_withdraw (struct ospf *, u_char);
extern void ospf_asbr_check (void);
extern void ospf_schedule_asbr_check (void);
extern void ospf_asbr_route_install_lsa (struct ospf_lsa *);
extern struct ospf_lsa *ospf_external_info_find_lsa (struct ospf *,
struct prefix_ipv4 *p);
#endif /* _ZEBRA_OSPF_ASBR_H */

View File

@@ -0,0 +1,144 @@
/*
* OSPFd dump routine.
* Copyright (C) 1999 Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_DUMP_H
#define _ZEBRA_OSPF_DUMP_H
/* Debug Flags. */
#define OSPF_DEBUG_HELLO 0x01
#define OSPF_DEBUG_DB_DESC 0x02
#define OSPF_DEBUG_LS_REQ 0x04
#define OSPF_DEBUG_LS_UPD 0x08
#define OSPF_DEBUG_LS_ACK 0x10
#define OSPF_DEBUG_ALL 0x1f
#define OSPF_DEBUG_SEND 0x01
#define OSPF_DEBUG_RECV 0x02
#define OSPF_DEBUG_SEND_RECV 0x03
#define OSPF_DEBUG_DETAIL 0x04
#define OSPF_DEBUG_ISM_STATUS 0x01
#define OSPF_DEBUG_ISM_EVENTS 0x02
#define OSPF_DEBUG_ISM_TIMERS 0x04
#define OSPF_DEBUG_ISM 0x07
#define OSPF_DEBUG_NSM_STATUS 0x01
#define OSPF_DEBUG_NSM_EVENTS 0x02
#define OSPF_DEBUG_NSM_TIMERS 0x04
#define OSPF_DEBUG_NSM 0x07
#define OSPF_DEBUG_LSA_GENERATE 0x01
#define OSPF_DEBUG_LSA_FLOODING 0x02
#define OSPF_DEBUG_LSA_INSTALL 0x04
#define OSPF_DEBUG_LSA_REFRESH 0x08
#define OSPF_DEBUG_LSA 0x0F
#define OSPF_DEBUG_ZEBRA_INTERFACE 0x01
#define OSPF_DEBUG_ZEBRA_REDISTRIBUTE 0x02
#define OSPF_DEBUG_ZEBRA 0x03
#define OSPF_DEBUG_EVENT 0x01
#define OSPF_DEBUG_NSSA 0x02
/* Macro for setting debug option. */
#define CONF_DEBUG_PACKET_ON(a, b) conf_debug_ospf_packet[a] |= (b)
#define CONF_DEBUG_PACKET_OFF(a, b) conf_debug_ospf_packet[a] &= ~(b)
#define TERM_DEBUG_PACKET_ON(a, b) term_debug_ospf_packet[a] |= (b)
#define TERM_DEBUG_PACKET_OFF(a, b) term_debug_ospf_packet[a] &= ~(b)
#define DEBUG_PACKET_ON(a, b) \
do { \
CONF_DEBUG_PACKET_ON(a, b); \
TERM_DEBUG_PACKET_ON(a, b); \
} while (0)
#define DEBUG_PACKET_OFF(a, b) \
do { \
CONF_DEBUG_PACKET_OFF(a, b); \
TERM_DEBUG_PACKET_OFF(a, b); \
} while (0)
#define CONF_DEBUG_ON(a, b) conf_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
#define CONF_DEBUG_OFF(a, b) conf_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
#define TERM_DEBUG_ON(a, b) term_debug_ospf_ ## a |= (OSPF_DEBUG_ ## b)
#define TERM_DEBUG_OFF(a, b) term_debug_ospf_ ## a &= ~(OSPF_DEBUG_ ## b)
#define DEBUG_ON(a, b) \
do { \
CONF_DEBUG_ON(a, b); \
TERM_DEBUG_ON(a, b); \
} while (0)
#define DEBUG_OFF(a, b) \
do { \
CONF_DEBUG_OFF(a, b); \
TERM_DEBUG_OFF(a, b); \
} while (0)
/* Macro for checking debug option. */
#define IS_DEBUG_OSPF_PACKET(a, b) \
(term_debug_ospf_packet[a] & OSPF_DEBUG_ ## b)
#define IS_DEBUG_OSPF(a, b) \
(term_debug_ospf_ ## a & OSPF_DEBUG_ ## b)
#define IS_DEBUG_OSPF_EVENT IS_DEBUG_OSPF(event,EVENT)
#define IS_DEBUG_OSPF_NSSA IS_DEBUG_OSPF(nssa,NSSA)
#define IS_CONF_DEBUG_OSPF_PACKET(a, b) \
(conf_debug_ospf_packet[a] & OSPF_DEBUG_ ## b)
#define IS_CONF_DEBUG_OSPF(a, b) \
(conf_debug_ospf_ ## a & OSPF_DEBUG_ ## b)
#ifdef ORIGINAL_CODING
#else /* ORIGINAL_CODING */
struct stream;
#endif /* ORIGINAL_CODING */
#define AREA_NAME(A) ospf_area_name_string ((A))
#define IF_NAME(I) ospf_if_name_string ((I))
/* Extern debug flag. */
extern unsigned long term_debug_ospf_packet[];
extern unsigned long term_debug_ospf_event;
extern unsigned long term_debug_ospf_ism;
extern unsigned long term_debug_ospf_nsm;
extern unsigned long term_debug_ospf_lsa;
extern unsigned long term_debug_ospf_zebra;
extern unsigned long term_debug_ospf_nssa;
/* Message Strings. */
extern char *ospf_lsa_type_str[];
extern const struct message ospf_auth_type_str[];
extern const size_t ospf_auth_type_str_max;
/* Prototypes. */
extern const char *ospf_area_name_string (struct ospf_area *);
extern const char *ospf_area_desc_string (struct ospf_area *);
extern const char *ospf_if_name_string (struct ospf_interface *);
extern void ospf_nbr_state_message (struct ospf_neighbor *, char *, size_t);
extern char *ospf_options_dump (u_char);
extern const char *ospf_timer_dump (struct thread *, char *, size_t);
extern const char *ospf_timeval_dump (struct timeval *, char *, size_t);
extern void ospf_ip_header_dump (struct ip *);
extern void ospf_packet_dump (struct stream *);
extern void ospf_lsa_header_dump (struct lsa_header *);
extern void debug_init (void);
/* Appropriate buffer size to use with ospf_timer_dump and ospf_timeval_dump: */
#define OSPF_TIME_DUMP_SIZE 16
#endif /* _ZEBRA_OSPF_DUMP_H */

View File

@@ -0,0 +1,114 @@
/*
* OSPF version 2 Interface State Machine.
* From RFC2328 [OSPF Version 2]
* Copyright (C) 1999 Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_ISM_H
#define _ZEBRA_OSPF_ISM_H
/* OSPF Interface State Machine Status. */
#define ISM_DependUpon 0
#define ISM_Down 1
#define ISM_Loopback 2
#define ISM_Waiting 3
#define ISM_PointToPoint 4
#define ISM_DROther 5
#define ISM_Backup 6
#define ISM_DR 7
#define OSPF_ISM_STATE_MAX 8
/* Because DR/DROther values are exhanged wrt RFC */
#define ISM_SNMP(x) (((x) == ISM_DROther) ? ISM_DR : \
((x) == ISM_DR) ? ISM_DROther : (x))
/* OSPF Interface State Machine Event. */
#define ISM_NoEvent 0
#define ISM_InterfaceUp 1
#define ISM_WaitTimer 2
#define ISM_BackupSeen 3
#define ISM_NeighborChange 4
#define ISM_LoopInd 5
#define ISM_UnloopInd 6
#define ISM_InterfaceDown 7
#define OSPF_ISM_EVENT_MAX 8
#define OSPF_ISM_WRITE_ON(O) \
do \
{ \
if (oi->on_write_q == 0) \
{ \
listnode_add ((O)->oi_write_q, oi); \
oi->on_write_q = 1; \
} \
if ((O)->t_write == NULL) \
(O)->t_write = \
thread_add_write (master, ospf_write, (O), (O)->fd); \
} while (0)
/* Macro for OSPF ISM timer turn on. */
#define OSPF_ISM_TIMER_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer (master, (F), oi, (V)); \
} while (0)
#define OSPF_ISM_TIMER_MSEC_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer_msec (master, (F), oi, (V)); \
} while (0)
/* convenience macro to set hello timer correctly, according to
* whether fast-hello is set or not
*/
#define OSPF_HELLO_TIMER_ON(O) \
do { \
if (OSPF_IF_PARAM ((O), fast_hello)) \
OSPF_ISM_TIMER_MSEC_ON ((O)->t_hello, ospf_hello_timer, \
1000 / OSPF_IF_PARAM ((O), fast_hello)); \
else \
OSPF_ISM_TIMER_ON ((O)->t_hello, ospf_hello_timer, \
OSPF_IF_PARAM ((O), v_hello)); \
} while (0)
/* Macro for OSPF ISM timer turn off. */
#define OSPF_ISM_TIMER_OFF(X) \
do { \
if (X) \
{ \
thread_cancel (X); \
(X) = NULL; \
} \
} while (0)
/* Macro for OSPF schedule event. */
#define OSPF_ISM_EVENT_SCHEDULE(I,E) \
thread_add_event (master, ospf_ism_event, (I), (E))
/* Macro for OSPF execute event. */
#define OSPF_ISM_EVENT_EXECUTE(I,E) \
thread_execute (master, ospf_ism_event, (I), (E))
/* Prototypes. */
extern int ospf_ism_event (struct thread *);
extern void ism_change_status (struct ospf_interface *, int);
extern int ospf_hello_timer (struct thread *thread);
#endif /* _ZEBRA_OSPF_ISM_H */

View File

@@ -0,0 +1,345 @@
/*
* OSPF Link State Advertisement
* Copyright (C) 1999, 2000 Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_LSA_H
#define _ZEBRA_OSPF_LSA_H
#include "stream.h"
/* OSPF LSA Range definition. */
#define OSPF_MIN_LSA 1 /* begin range here */
#if defined (HAVE_OPAQUE_LSA)
#define OSPF_MAX_LSA 12
#else
#define OSPF_MAX_LSA 8
#endif
/* OSPF LSA Type definition. */
#define OSPF_UNKNOWN_LSA 0
#define OSPF_ROUTER_LSA 1
#define OSPF_NETWORK_LSA 2
#define OSPF_SUMMARY_LSA 3
#define OSPF_ASBR_SUMMARY_LSA 4
#define OSPF_AS_EXTERNAL_LSA 5
#define OSPF_GROUP_MEMBER_LSA 6 /* Not supported. */
#define OSPF_AS_NSSA_LSA 7
#define OSPF_EXTERNAL_ATTRIBUTES_LSA 8 /* Not supported. */
#define OSPF_OPAQUE_LINK_LSA 9
#define OSPF_OPAQUE_AREA_LSA 10
#define OSPF_OPAQUE_AS_LSA 11
#define OSPF_LSA_HEADER_SIZE 20U
#define OSPF_ROUTER_LSA_LINK_SIZE 12U
#define OSPF_ROUTER_LSA_TOS_SIZE 4U
#define OSPF_MAX_LSA_SIZE 1500U
/* AS-external-LSA refresh method. */
#define LSA_REFRESH_IF_CHANGED 0
#define LSA_REFRESH_FORCE 1
/* OSPF LSA header. */
struct lsa_header
{
u_int16_t ls_age;
u_char options;
u_char type;
struct in_addr id;
struct in_addr adv_router;
u_int32_t ls_seqnum;
u_int16_t checksum;
u_int16_t length;
};
/* OSPF LSA. */
struct ospf_lsa
{
/* LSA origination flag. */
u_char flags;
#define OSPF_LSA_SELF 0x01
#define OSPF_LSA_SELF_CHECKED 0x02
#define OSPF_LSA_RECEIVED 0x04
#define OSPF_LSA_APPROVED 0x08
#define OSPF_LSA_DISCARD 0x10
#define OSPF_LSA_LOCAL_XLT 0x20
#define OSPF_LSA_PREMATURE_AGE 0x40
#define OSPF_LSA_IN_MAXAGE 0x80
/* LSA data. */
struct lsa_header *data;
/* Received time stamp. */
struct timeval tv_recv;
/* Last time it was originated */
struct timeval tv_orig;
/* All of reference count, also lock to remove. */
int lock;
/* Flags for the SPF calculation. */
int stat;
#define LSA_SPF_NOT_EXPLORED -1
#define LSA_SPF_IN_SPFTREE -2
/* If stat >= 0, stat is LSA position in candidates heap. */
/* References to this LSA in neighbor retransmission lists*/
int retransmit_counter;
/* Area the LSA belongs to, may be NULL if AS-external-LSA. */
struct ospf_area *area;
/* Parent LSDB. */
struct ospf_lsdb *lsdb;
/* Related Route. */
void *route;
/* Refreshement List or Queue */
int refresh_list;
/* For Type-9 Opaque-LSAs */
struct ospf_interface *oi;
};
/* OSPF LSA Link Type. */
#define LSA_LINK_TYPE_POINTOPOINT 1
#define LSA_LINK_TYPE_TRANSIT 2
#define LSA_LINK_TYPE_STUB 3
#define LSA_LINK_TYPE_VIRTUALLINK 4
/* OSPF Router LSA Flag. */
#define ROUTER_LSA_BORDER 0x01 /* The router is an ABR */
#define ROUTER_LSA_EXTERNAL 0x02 /* The router is an ASBR */
#define ROUTER_LSA_VIRTUAL 0x04 /* The router has a VL in this area */
#define ROUTER_LSA_NT 0x10 /* The routers always translates Type-7 */
#define ROUTER_LSA_SHORTCUT 0x20 /* Shortcut-ABR specific flag */
#define IS_ROUTER_LSA_VIRTUAL(x) ((x)->flags & ROUTER_LSA_VIRTUAL)
#define IS_ROUTER_LSA_EXTERNAL(x) ((x)->flags & ROUTER_LSA_EXTERNAL)
#define IS_ROUTER_LSA_BORDER(x) ((x)->flags & ROUTER_LSA_BORDER)
#define IS_ROUTER_LSA_SHORTCUT(x) ((x)->flags & ROUTER_LSA_SHORTCUT)
#define IS_ROUTER_LSA_NT(x) ((x)->flags & ROUTER_LSA_NT)
/* OSPF Router-LSA Link information. */
struct router_lsa_link
{
struct in_addr link_id;
struct in_addr link_data;
struct
{
u_char type;
u_char tos_count;
u_int16_t metric;
} m[1];
};
/* OSPF Router-LSAs structure. */
#define OSPF_ROUTER_LSA_MIN_SIZE 4U /* w/0 link descriptors */
/* There is an edge case, when number of links in a Router-LSA may be 0 without
breaking the specification. A router, which has no other links to backbone
area besides one virtual link, will not put any VL descriptor blocks into
the Router-LSA generated for area 0 until a full adjacency over the VL is
reached (RFC2328 12.4.1.3). In this case the Router-LSA initially received
by the other end of the VL will have 0 link descriptor blocks, but soon will
be replaced with the next revision having 1 descriptor block. */
struct router_lsa
{
struct lsa_header header;
u_char flags;
u_char zero;
u_int16_t links;
struct
{
struct in_addr link_id;
struct in_addr link_data;
u_char type;
u_char tos;
u_int16_t metric;
} link[1];
};
/* OSPF Network-LSAs structure. */
#define OSPF_NETWORK_LSA_MIN_SIZE 8U /* w/1 router-ID */
struct network_lsa
{
struct lsa_header header;
struct in_addr mask;
struct in_addr routers[1];
};
/* OSPF Summary-LSAs structure. */
#define OSPF_SUMMARY_LSA_MIN_SIZE 8U /* w/1 TOS metric block */
struct summary_lsa
{
struct lsa_header header;
struct in_addr mask;
u_char tos;
u_char metric[3];
};
/* OSPF AS-external-LSAs structure. */
#define OSPF_AS_EXTERNAL_LSA_MIN_SIZE 16U /* w/1 TOS forwarding block */
struct as_external_lsa
{
struct lsa_header header;
struct in_addr mask;
struct
{
u_char tos;
u_char metric[3];
struct in_addr fwd_addr;
u_int32_t route_tag;
} e[1];
};
#ifdef HAVE_OPAQUE_LSA
#include "ospfd/ospf_opaque.h"
#endif /* HAVE_OPAQUE_LSA */
/* Macros. */
#define GET_METRIC(x) get_metric(x)
#define IS_EXTERNAL_METRIC(x) ((x) & 0x80)
#define GET_AGE(x) (ntohs ((x)->data->ls_age) + time (NULL) - (x)->tv_recv)
#define LS_AGE(x) (OSPF_LSA_MAXAGE < get_age(x) ? \
OSPF_LSA_MAXAGE : get_age(x))
#define IS_LSA_SELF(L) (CHECK_FLAG ((L)->flags, OSPF_LSA_SELF))
#define IS_LSA_MAXAGE(L) (LS_AGE ((L)) == OSPF_LSA_MAXAGE)
#define OSPF_LSA_UPDATE_DELAY 2
#define OSPF_LSA_UPDATE_TIMER_ON(T,F) \
if (!(T)) \
(T) = thread_add_timer (master, (F), 0, 2)
/* Prototypes. */
/* XXX: Eek, time functions, similar are in lib/thread.c */
extern struct timeval tv_adjust (struct timeval);
extern int tv_ceil (struct timeval);
extern int tv_floor (struct timeval);
extern struct timeval int2tv (int);
extern struct timeval tv_add (struct timeval, struct timeval);
extern struct timeval tv_sub (struct timeval, struct timeval);
extern int tv_cmp (struct timeval, struct timeval);
extern int get_age (struct ospf_lsa *);
extern u_int16_t ospf_lsa_checksum (struct lsa_header *);
extern int ospf_lsa_checksum_valid (struct lsa_header *);
extern int ospf_lsa_refresh_delay (struct ospf_lsa *);
extern const char *dump_lsa_key (struct ospf_lsa *);
extern u_int32_t lsa_seqnum_increment (struct ospf_lsa *);
extern void lsa_header_set (struct stream *, u_char, u_char, struct in_addr,
struct in_addr);
extern struct ospf_neighbor *ospf_nbr_lookup_ptop (struct ospf_interface *);
extern int ospf_check_nbr_status (struct ospf *);
/* Prototype for LSA primitive. */
extern struct ospf_lsa *ospf_lsa_new (void);
extern struct ospf_lsa *ospf_lsa_dup (struct ospf_lsa *);
extern void ospf_lsa_free (struct ospf_lsa *);
extern struct ospf_lsa *ospf_lsa_lock (struct ospf_lsa *);
extern void ospf_lsa_unlock (struct ospf_lsa **);
extern void ospf_lsa_discard (struct ospf_lsa *);
extern struct lsa_header *ospf_lsa_data_new (size_t);
extern struct lsa_header *ospf_lsa_data_dup (struct lsa_header *);
extern void ospf_lsa_data_free (struct lsa_header *);
/* Prototype for various LSAs */
extern int ospf_router_lsa_update (struct ospf *);
extern int ospf_router_lsa_update_area (struct ospf_area *);
extern void ospf_network_lsa_update (struct ospf_interface *);
extern struct ospf_lsa *ospf_summary_lsa_originate (struct prefix_ipv4 *, u_int32_t,
struct ospf_area *);
extern struct ospf_lsa *ospf_summary_asbr_lsa_originate (struct prefix_ipv4 *,
u_int32_t,
struct ospf_area *);
extern struct ospf_lsa *ospf_lsa_install (struct ospf *,
struct ospf_interface *, struct ospf_lsa *);
extern void ospf_nssa_lsa_flush (struct ospf *ospf, struct prefix_ipv4 *p);
extern void ospf_external_lsa_flush (struct ospf *, u_char, struct prefix_ipv4 *,
unsigned int /* , struct in_addr nexthop */);
extern struct in_addr ospf_get_ip_from_ifp (struct ospf_interface *);
extern struct ospf_lsa *ospf_external_lsa_originate (struct ospf *, struct external_info *);
extern int ospf_external_lsa_originate_timer (struct thread *);
extern int ospf_default_originate_timer (struct thread *);
extern struct ospf_lsa *ospf_lsa_lookup (struct ospf_area *, u_int32_t,
struct in_addr, struct in_addr);
extern struct ospf_lsa *ospf_lsa_lookup_by_id (struct ospf_area *,
u_int32_t,
struct in_addr);
extern struct ospf_lsa *ospf_lsa_lookup_by_header (struct ospf_area *,
struct lsa_header *);
extern int ospf_lsa_more_recent (struct ospf_lsa *, struct ospf_lsa *);
extern int ospf_lsa_different (struct ospf_lsa *, struct ospf_lsa *);
extern void ospf_flush_self_originated_lsas_now (struct ospf *);
extern int ospf_lsa_is_self_originated (struct ospf *, struct ospf_lsa *);
extern struct ospf_lsa *ospf_lsa_lookup_by_prefix (struct ospf_lsdb *, u_char,
struct prefix_ipv4 *,
struct in_addr);
extern void ospf_lsa_maxage (struct ospf *, struct ospf_lsa *);
extern u_int32_t get_metric (u_char *);
extern int ospf_lsa_maxage_walker (struct thread *);
extern struct ospf_lsa *ospf_lsa_refresh (struct ospf *, struct ospf_lsa *);
extern void ospf_external_lsa_refresh_default (struct ospf *);
extern void ospf_external_lsa_refresh_type (struct ospf *, u_char, int);
extern struct ospf_lsa *ospf_external_lsa_refresh (struct ospf *,
struct ospf_lsa *,
struct external_info *,
int);
extern struct in_addr ospf_lsa_unique_id (struct ospf *, struct ospf_lsdb *, u_char,
struct prefix_ipv4 *);
extern void ospf_schedule_lsa_flood_area (struct ospf_area *, struct ospf_lsa *);
extern void ospf_schedule_lsa_flush_area (struct ospf_area *, struct ospf_lsa *);
extern void ospf_refresher_register_lsa (struct ospf *, struct ospf_lsa *);
extern void ospf_refresher_unregister_lsa (struct ospf *, struct ospf_lsa *);
extern int ospf_lsa_refresh_walker (struct thread *);
extern void ospf_lsa_maxage_delete (struct ospf *, struct ospf_lsa *);
extern void ospf_discard_from_db (struct ospf *, struct ospf_lsdb *, struct ospf_lsa*);
extern int is_prefix_default (struct prefix_ipv4 *);
extern int metric_type (struct ospf *, u_char);
extern int metric_value (struct ospf *, u_char);
extern struct in_addr ospf_get_nssa_ip (struct ospf_area *);
extern int ospf_translated_nssa_compare (struct ospf_lsa *, struct ospf_lsa *);
extern struct ospf_lsa *ospf_translated_nssa_refresh (struct ospf *, struct ospf_lsa *,
struct ospf_lsa *);
extern struct ospf_lsa *ospf_translated_nssa_originate (struct ospf *, struct ospf_lsa *);
#endif /* _ZEBRA_OSPF_LSA_H */

View File

@@ -0,0 +1,87 @@
/*
* OSPF LSDB support.
* Copyright (C) 1999, 2000 Alex Zinin, Kunihiro Ishiguro, Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_LSDB_H
#define _ZEBRA_OSPF_LSDB_H
/* OSPF LSDB structure. */
struct ospf_lsdb
{
struct
{
unsigned long count;
unsigned long count_self;
unsigned int checksum;
struct route_table *db;
} type[OSPF_MAX_LSA];
unsigned long total;
#define MONITOR_LSDB_CHANGE 1 /* XXX */
#ifdef MONITOR_LSDB_CHANGE
/* Hooks for callback functions to catch every add/del event. */
int (* new_lsa_hook)(struct ospf_lsa *);
int (* del_lsa_hook)(struct ospf_lsa *);
#endif /* MONITOR_LSDB_CHANGE */
};
/* Macros. */
#define LSDB_LOOP(T,N,L) \
if ((T) != NULL) \
for ((N) = route_top ((T)); ((N)); ((N)) = route_next ((N))) \
if (((L) = (N)->info))
#define ROUTER_LSDB(A) ((A)->lsdb->type[OSPF_ROUTER_LSA].db)
#define NETWORK_LSDB(A) ((A)->lsdb->type[OSPF_NETWORK_LSA].db)
#define SUMMARY_LSDB(A) ((A)->lsdb->type[OSPF_SUMMARY_LSA].db)
#define ASBR_SUMMARY_LSDB(A) ((A)->lsdb->type[OSPF_ASBR_SUMMARY_LSA].db)
#define EXTERNAL_LSDB(O) ((O)->lsdb->type[OSPF_AS_EXTERNAL_LSA].db)
#define NSSA_LSDB(A) ((A)->lsdb->type[OSPF_AS_NSSA_LSA].db)
#define OPAQUE_LINK_LSDB(A) ((A)->lsdb->type[OSPF_OPAQUE_LINK_LSA].db)
#define OPAQUE_AREA_LSDB(A) ((A)->lsdb->type[OSPF_OPAQUE_AREA_LSA].db)
#define OPAQUE_AS_LSDB(O) ((O)->lsdb->type[OSPF_OPAQUE_AS_LSA].db)
#define AREA_LSDB(A,T) ((A)->lsdb->type[(T)].db)
#define AS_LSDB(O,T) ((O)->lsdb->type[(T)].db)
/* OSPF LSDB related functions. */
extern struct ospf_lsdb *ospf_lsdb_new (void);
extern void ospf_lsdb_init (struct ospf_lsdb *);
extern void ospf_lsdb_free (struct ospf_lsdb *);
extern void ospf_lsdb_cleanup (struct ospf_lsdb *);
extern void ls_prefix_set (struct prefix_ls *lp, struct ospf_lsa *lsa);
extern void ospf_lsdb_add (struct ospf_lsdb *, struct ospf_lsa *);
extern void ospf_lsdb_delete (struct ospf_lsdb *, struct ospf_lsa *);
extern void ospf_lsdb_delete_all (struct ospf_lsdb *);
/* Set all stats to -1 (LSA_SPF_NOT_EXPLORED). */
extern void ospf_lsdb_clean_stat (struct ospf_lsdb *lsdb);
extern struct ospf_lsa *ospf_lsdb_lookup (struct ospf_lsdb *, struct ospf_lsa *);
extern struct ospf_lsa *ospf_lsdb_lookup_by_id (struct ospf_lsdb *, u_char,
struct in_addr, struct in_addr);
extern struct ospf_lsa *ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *, u_char,
struct in_addr, struct in_addr,
int);
extern unsigned long ospf_lsdb_count_all (struct ospf_lsdb *);
extern unsigned long ospf_lsdb_count (struct ospf_lsdb *, int);
extern unsigned long ospf_lsdb_count_self (struct ospf_lsdb *, int);
extern unsigned int ospf_lsdb_checksum (struct ospf_lsdb *, int);
extern unsigned long ospf_lsdb_isempty (struct ospf_lsdb *);
#endif /* _ZEBRA_OSPF_LSDB_H */

View File

@@ -0,0 +1,90 @@
/*
* OSPF version 2 Neighbor State Machine
* From RFC2328 [OSPF Version 2]
* Copyright (C) 1999 Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_NSM_H
#define _ZEBRA_OSPF_NSM_H
/* OSPF Neighbor State Machine State. */
#define NSM_DependUpon 0
#define NSM_Deleted 1
#define NSM_Down 2
#define NSM_Attempt 3
#define NSM_Init 4
#define NSM_TwoWay 5
#define NSM_ExStart 6
#define NSM_Exchange 7
#define NSM_Loading 8
#define NSM_Full 9
#define OSPF_NSM_STATE_MAX 10
/* OSPF Neighbor State Machine Event. */
#define NSM_NoEvent 0
#define NSM_PacketReceived 1 /* HelloReceived in the protocol */
#define NSM_Start 2
#define NSM_TwoWayReceived 3
#define NSM_NegotiationDone 4
#define NSM_ExchangeDone 5
#define NSM_BadLSReq 6
#define NSM_LoadingDone 7
#define NSM_AdjOK 8
#define NSM_SeqNumberMismatch 9
#define NSM_OneWayReceived 10
#define NSM_KillNbr 11
#define NSM_InactivityTimer 12
#define NSM_LLDown 13
#define OSPF_NSM_EVENT_MAX 14
/* Macro for OSPF NSM timer turn on. */
#define OSPF_NSM_TIMER_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer (master, (F), nbr, (V)); \
} while (0)
/* Macro for OSPF NSM timer turn off. */
#define OSPF_NSM_TIMER_OFF(X) \
do { \
if (X) \
{ \
thread_cancel (X); \
(X) = NULL; \
} \
} while (0)
/* Macro for OSPF NSM schedule event. */
#define OSPF_NSM_EVENT_SCHEDULE(N,E) \
thread_add_event (master, ospf_nsm_event, (N), (E))
/* Macro for OSPF NSM execute event. */
#define OSPF_NSM_EVENT_EXECUTE(N,E) \
thread_execute (master, ospf_nsm_event, (N), (E))
/* Prototypes. */
extern int ospf_nsm_event (struct thread *);
extern void ospf_check_nbr_loading (struct ospf_neighbor *);
extern int ospf_db_summary_isempty (struct ospf_neighbor *);
extern int ospf_db_summary_count (struct ospf_neighbor *);
extern void ospf_db_summary_clear (struct ospf_neighbor *);
#endif /* _ZEBRA_OSPF_NSM_H */

View File

@@ -0,0 +1,166 @@
/*
* This is an implementation of rfc2370.
* Copyright (C) 2001 KDD R&D Laboratories, Inc.
* http://www.kddlabs.co.jp/
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPF_OPAQUE_H
#define _ZEBRA_OSPF_OPAQUE_H
#include "vty.h"
#define IS_OPAQUE_LSA(type) \
((type) == OSPF_OPAQUE_LINK_LSA || \
(type) == OSPF_OPAQUE_AREA_LSA || \
(type) == OSPF_OPAQUE_AS_LSA)
/*
* Usage of Opaque-LSA administrative flags in "struct ospf".
*
* 7 6 5 4 3 2 1 0
* +---+---+---+---+---+---+---+---+
* |///|///|///|///|B11|B10|B09| O |
* +---+---+---+---+---+---+---+---+
* |<--------->| A
* | +--- Operation status (operational = 1)
* +----------- Blocking status for each LSA type
*/
#define IS_OPAQUE_LSA_ORIGINATION_BLOCKED(V) \
CHECK_FLAG((V), (OPAQUE_BLOCK_TYPE_09_LSA_BIT | \
OPAQUE_BLOCK_TYPE_10_LSA_BIT | \
OPAQUE_BLOCK_TYPE_11_LSA_BIT))
/*
* Opaque LSA's link state ID is redefined as follows.
*
* 24 16 8 0
* +--------+--------+--------+--------+
* |tttttttt|........|........|........|
* +--------+--------+--------+--------+
* |<-Type->|<------- Opaque ID ------>|
*/
#define LSID_OPAQUE_TYPE_MASK 0xff000000 /* 8 bits */
#define LSID_OPAQUE_ID_MASK 0x00ffffff /* 24 bits */
#define GET_OPAQUE_TYPE(lsid) \
(((u_int32_t)(lsid) & LSID_OPAQUE_TYPE_MASK) >> 24)
#define GET_OPAQUE_ID(lsid) \
((u_int32_t)(lsid) & LSID_OPAQUE_ID_MASK)
#define SET_OPAQUE_LSID(type, id) \
((((type) << 24) & LSID_OPAQUE_TYPE_MASK) \
| ((id) & LSID_OPAQUE_ID_MASK))
/*
* Opaque LSA types will be assigned by IANA.
* <http://www.iana.org/assignments/ospf-opaque-types>
*/
#define OPAQUE_TYPE_TRAFFIC_ENGINEERING_LSA 1
#define OPAQUE_TYPE_SYCAMORE_OPTICAL_TOPOLOGY_DESC 2
#define OPAQUE_TYPE_GRACE_LSA 3
/* Followings types are proposed in internet-draft documents. */
#define OPAQUE_TYPE_8021_QOSPF 129
#define OPAQUE_TYPE_SECONDARY_NEIGHBOR_DISCOVERY 224
#define OPAQUE_TYPE_FLOODGATE 225
/* Ugly hack to make use of an unallocated value for wildcard matching! */
#define OPAQUE_TYPE_WILDCARD 0
#define OPAQUE_TYPE_RANGE_UNASSIGNED(type) \
( 4 <= (type) && (type) <= 127)
#define OPAQUE_TYPE_RANGE_RESERVED(type) \
(127 < (type) && (type) <= 255)
#define VALID_OPAQUE_INFO_LEN(lsahdr) \
((ntohs((lsahdr)->length) >= sizeof (struct lsa_header)) && \
((ntohs((lsahdr)->length) % sizeof (u_int32_t)) == 0))
/* Prototypes. */
extern void ospf_opaque_init (void);
extern void ospf_opaque_term (void);
extern int ospf_opaque_type9_lsa_init (struct ospf_interface *oi);
extern void ospf_opaque_type9_lsa_term (struct ospf_interface *oi);
extern int ospf_opaque_type10_lsa_init (struct ospf_area *area);
extern void ospf_opaque_type10_lsa_term (struct ospf_area *area);
extern int ospf_opaque_type11_lsa_init (struct ospf *ospf);
extern void ospf_opaque_type11_lsa_term (struct ospf *ospf);
extern int
ospf_register_opaque_functab (
u_char lsa_type,
u_char opaque_type,
int (* new_if_hook)(struct interface *ifp),
int (* del_if_hook)(struct interface *ifp),
void (* ism_change_hook)(struct ospf_interface *oi, int old_status),
void (* nsm_change_hook)(struct ospf_neighbor *nbr, int old_status),
void (* config_write_router)(struct vty *vty),
void (* config_write_if )(struct vty *vty, struct interface *ifp),
void (* config_write_debug )(struct vty *vty),
void (* show_opaque_info )(struct vty *vty, struct ospf_lsa *lsa),
int (* lsa_originator)(void *arg),
struct ospf_lsa *(* lsa_refresher )(struct ospf_lsa *lsa),
int (* new_lsa_hook)(struct ospf_lsa *lsa),
int (* del_lsa_hook)(struct ospf_lsa *lsa)
);
extern void ospf_delete_opaque_functab (u_char lsa_type, u_char opaque_type);
extern int ospf_opaque_new_if (struct interface *ifp);
extern int ospf_opaque_del_if (struct interface *ifp);
extern void ospf_opaque_ism_change (struct ospf_interface *oi,
int old_status);
extern void ospf_opaque_nsm_change (struct ospf_neighbor *nbr,
int old_status);
extern void ospf_opaque_config_write_router (struct vty *vty, struct ospf *);
extern void ospf_opaque_config_write_if (struct vty *vty,
struct interface *ifp);
extern void ospf_opaque_config_write_debug (struct vty *vty);
extern void show_opaque_info_detail (struct vty *vty, struct ospf_lsa *lsa);
extern void ospf_opaque_lsa_dump (struct stream *s, u_int16_t length);
extern void ospf_opaque_lsa_originate_schedule (struct ospf_interface *oi,
int *init_delay);
extern struct ospf_lsa *ospf_opaque_lsa_install (struct ospf_lsa *,
int rt_recalc);
extern struct ospf_lsa *ospf_opaque_lsa_refresh (struct ospf_lsa *lsa);
extern void ospf_opaque_lsa_reoriginate_schedule (void *lsa_type_dependent,
u_char lsa_type,
u_char opaque_type);
extern void ospf_opaque_lsa_refresh_schedule (struct ospf_lsa *lsa);
extern void ospf_opaque_lsa_flush_schedule (struct ospf_lsa *lsa);
extern void ospf_opaque_adjust_lsreq (struct ospf_neighbor *nbr,
struct list *lsas);
extern void ospf_opaque_self_originated_lsa_received (struct ospf_neighbor
*nbr,
struct ospf_lsa *lsa);
extern void ospf_opaque_ls_ack_received (struct ospf_neighbor *nbr,
struct ospf_lsa *lsa);
extern void htonf (float *src, float *dst);
extern void ntohf (float *src, float *dst);
extern struct ospf *oi_to_top (struct ospf_interface *oi);
#endif /* _ZEBRA_OSPF_OPAQUE_H */

View File

@@ -0,0 +1,570 @@
/*
* OSPFd main header.
* Copyright (C) 1998, 99, 2000 Kunihiro Ishiguro, Toshiaki Takada
*
* This file is part of GNU Zebra.
*
* GNU Zebra is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* GNU Zebra is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* 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.
*/
#ifndef _ZEBRA_OSPFD_H
#define _ZEBRA_OSPFD_H
#include <zebra.h>
#include "libospf.h"
#include "filter.h"
#include "log.h"
#define OSPF_VERSION 2
/* VTY port number. */
#define OSPF_VTY_PORT 2604
/* IP TTL for OSPF protocol. */
#define OSPF_IP_TTL 1
#define OSPF_VL_IP_TTL 100
/* Default configuration file name for ospfd. */
#define OSPF_DEFAULT_CONFIG "ospfd.conf"
#define OSPF_NSSA_TRANS_STABLE_DEFAULT 40
#define OSPF_ALLSPFROUTERS 0xe0000005 /* 224.0.0.5 */
#define OSPF_ALLDROUTERS 0xe0000006 /* 224.0.0.6 */
/* OSPF Authentication Type. */
#define OSPF_AUTH_NULL 0
#define OSPF_AUTH_SIMPLE 1
#define OSPF_AUTH_CRYPTOGRAPHIC 2
/* For Interface authentication setting default */
#define OSPF_AUTH_NOTSET -1
/* For the consumption and sanity of the command handler */
/* DO NIOT REMOVE!!! Need to detect whether a value has
been given or not in VLink command handlers */
#define OSPF_AUTH_CMD_NOTSEEN -2
/* OSPF options. */
#define OSPF_OPTION_T 0x01 /* TOS. */
#define OSPF_OPTION_E 0x02
#define OSPF_OPTION_MC 0x04
#define OSPF_OPTION_NP 0x08
#define OSPF_OPTION_EA 0x10
#define OSPF_OPTION_DC 0x20
#define OSPF_OPTION_O 0x40
/* OSPF Database Description flags. */
#define OSPF_DD_FLAG_MS 0x01
#define OSPF_DD_FLAG_M 0x02
#define OSPF_DD_FLAG_I 0x04
#define OSPF_DD_FLAG_ALL 0x07
#define OSPF_LS_REFRESH_SHIFT (60 * 15)
#define OSPF_LS_REFRESH_JITTER 60
/* OSPF master for system wide configuration and variables. */
struct ospf_master
{
/* OSPF instance. */
struct list *ospf;
/* OSPF thread master. */
struct thread_master *master;
/* Zebra interface list. */
struct list *iflist;
/* Redistributed external information. */
struct route_table *external_info[ZEBRA_ROUTE_MAX + 1];
#define EXTERNAL_INFO(T) om->external_info[T]
/* OSPF start time. */
time_t start_time;
/* Various OSPF global configuration. */
u_char options;
#define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
};
/* OSPF instance structure. */
struct ospf
{
/* OSPF Router ID. */
struct in_addr router_id; /* Configured automatically. */
struct in_addr router_id_static; /* Configured manually. */
/* ABR/ASBR internal flags. */
u_char flags;
#define OSPF_FLAG_ABR 0x0001
#define OSPF_FLAG_ASBR 0x0002
/* ABR type. */
u_char abr_type;
#define OSPF_ABR_UNKNOWN 0
#define OSPF_ABR_STAND 1
#define OSPF_ABR_IBM 2
#define OSPF_ABR_CISCO 3
#define OSPF_ABR_SHORTCUT 4
#define OSPF_ABR_DEFAULT OSPF_ABR_CISCO
/* NSSA ABR */
u_char anyNSSA; /* Bump for every NSSA attached. */
/* Configured variables. */
u_char config;
#define OSPF_RFC1583_COMPATIBLE (1 << 0)
#define OSPF_OPAQUE_CAPABLE (1 << 2)
#define OSPF_LOG_ADJACENCY_CHANGES (1 << 3)
#define OSPF_LOG_ADJACENCY_DETAIL (1 << 4)
#ifdef HAVE_OPAQUE_LSA
/* Opaque-LSA administrative flags. */
u_char opaque;
#define OPAQUE_OPERATION_READY_BIT (1 << 0)
#define OPAQUE_BLOCK_TYPE_09_LSA_BIT (1 << 1)
#define OPAQUE_BLOCK_TYPE_10_LSA_BIT (1 << 2)
#define OPAQUE_BLOCK_TYPE_11_LSA_BIT (1 << 3)
#endif /* HAVE_OPAQUE_LSA */
/* RFC3137 stub router. Configured time to stay stub / max-metric */
unsigned int stub_router_startup_time; /* seconds */
unsigned int stub_router_shutdown_time; /* seconds */
#define OSPF_STUB_ROUTER_UNCONFIGURED 0
u_char stub_router_admin_set;
#define OSPF_STUB_ROUTER_ADMINISTRATIVE_SET 1
#define OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET 0
#define OSPF_STUB_MAX_METRIC_SUMMARY_COST 0x00ff0000
/* SPF parameters */
unsigned int spf_delay; /* SPF delay time. */
unsigned int spf_holdtime; /* SPF hold time. */
unsigned int spf_max_holdtime; /* SPF maximum-holdtime */
unsigned int spf_hold_multiplier; /* Adaptive multiplier for hold time */
int default_originate; /* Default information originate. */
#define DEFAULT_ORIGINATE_NONE 0
#define DEFAULT_ORIGINATE_ZEBRA 1
#define DEFAULT_ORIGINATE_ALWAYS 2
u_int32_t ref_bandwidth; /* Reference Bandwidth (Kbps). */
struct route_table *networks; /* OSPF config networks. */
struct list *vlinks; /* Configured Virtual-Links. */
struct list *areas; /* OSPF areas. */
struct route_table *nbr_nbma;
struct ospf_area *backbone; /* Pointer to the Backbone Area. */
struct list *oiflist; /* ospf interfaces */
u_char passive_interface_default; /* passive-interface default */
/* LSDB of AS-external-LSAs. */
struct ospf_lsdb *lsdb;
/* Flags. */
int external_origin; /* AS-external-LSA origin flag. */
int ase_calc; /* ASE calculation flag. */
#ifdef HAVE_OPAQUE_LSA
struct list *opaque_lsa_self; /* Type-11 Opaque-LSAs */
#endif /* HAVE_OPAQUE_LSA */
/* Routing tables. */
struct route_table *old_table; /* Old routing table. */
struct route_table *new_table; /* Current routing table. */
struct route_table *old_rtrs; /* Old ABR/ASBR RT. */
struct route_table *new_rtrs; /* New ABR/ASBR RT. */
struct route_table *new_external_route; /* New External Route. */
struct route_table *old_external_route; /* Old External Route. */
struct route_table *external_lsas; /* Database of external LSAs,
prefix is LSA's adv. network*/
/* Time stamps */
struct timeval ts_spf; /* SPF calculation time stamp. */
struct timeval ts_spf_duration; /* Execution time of last SPF */
struct route_table *maxage_lsa; /* List of MaxAge LSA for deletion. */
int redistribute; /* Num of redistributed protocols. */
/* Threads. */
struct thread *t_abr_task; /* ABR task timer. */
struct thread *t_asbr_check; /* ASBR check timer. */
struct thread *t_distribute_update; /* Distirbute list update timer. */
struct thread *t_spf_calc; /* SPF calculation timer. */
struct thread *t_ase_calc; /* ASE calculation timer. */
struct thread *t_external_lsa; /* AS-external-LSA origin timer. */
#ifdef HAVE_OPAQUE_LSA
struct thread *t_opaque_lsa_self; /* Type-11 Opaque-LSAs origin event. */
#endif /* HAVE_OPAQUE_LSA */
unsigned int maxage_delay; /* Delay on Maxage remover timer, sec */
struct thread *t_maxage; /* MaxAge LSA remover timer. */
struct thread *t_maxage_walker; /* MaxAge LSA checking timer. */
struct thread *t_deferred_shutdown; /* deferred/stub-router shutdown timer*/
struct thread *t_write;
struct thread *t_read;
int fd;
unsigned int maxsndbuflen;
struct stream *ibuf;
struct list *oi_write_q;
/* Distribute lists out of other route sources. */
struct
{
char *name;
struct access_list *list;
} dlist[ZEBRA_ROUTE_MAX];
#define DISTRIBUTE_NAME(O,T) (O)->dlist[T].name
#define DISTRIBUTE_LIST(O,T) (O)->dlist[T].list
/* Redistribute metric info. */
struct
{
int type; /* External metric type (E1 or E2). */
int value; /* Value for static metric (24-bit).
-1 means metric value is not set. */
} dmetric [ZEBRA_ROUTE_MAX + 1];
/* For redistribute route map. */
struct
{
char *name;
struct route_map *map;
} route_map [ZEBRA_ROUTE_MAX + 1]; /* +1 is for default-information */
#define ROUTEMAP_NAME(O,T) (O)->route_map[T].name
#define ROUTEMAP(O,T) (O)->route_map[T].map
int default_metric; /* Default metric for redistribute. */
#define OSPF_LSA_REFRESHER_GRANULARITY 10
#define OSPF_LSA_REFRESHER_SLOTS ((OSPF_LS_REFRESH_TIME + \
OSPF_LS_REFRESH_SHIFT)/10 + 1)
struct
{
u_int16_t index;
struct list *qs[OSPF_LSA_REFRESHER_SLOTS];
} lsa_refresh_queue;
struct thread *t_lsa_refresher;
time_t lsa_refresher_started;
#define OSPF_LSA_REFRESH_INTERVAL_DEFAULT 10
u_int16_t lsa_refresh_interval;
/* Distance parameter. */
u_char distance_all;
u_char distance_intra;
u_char distance_inter;
u_char distance_external;
/* Statistics for LSA origination. */
u_int32_t lsa_originate_count;
/* Statistics for LSA used for new instantiation. */
u_int32_t rx_lsa_count;
struct route_table *distance_table;
};
/* OSPF area structure. */
struct ospf_area
{
/* OSPF instance. */
struct ospf *ospf;
/* Zebra interface list belonging to the area. */
struct list *oiflist;
/* Area ID. */
struct in_addr area_id;
/* Area ID format. */
char format;
#define OSPF_AREA_ID_FORMAT_ADDRESS 1
#define OSPF_AREA_ID_FORMAT_DECIMAL 2
/* Address range. */
struct list *address_range;
/* Configured variables. */
int external_routing; /* ExternalRoutingCapability. */
#define OSPF_AREA_DEFAULT 0
#define OSPF_AREA_STUB 1
#define OSPF_AREA_NSSA 2
#define OSPF_AREA_TYPE_MAX 3
int no_summary; /* Don't inject summaries into stub.*/
int shortcut_configured; /* Area configured as shortcut. */
#define OSPF_SHORTCUT_DEFAULT 0
#define OSPF_SHORTCUT_ENABLE 1
#define OSPF_SHORTCUT_DISABLE 2
int shortcut_capability; /* Other ABRs agree on S-bit */
u_int32_t default_cost; /* StubDefaultCost. */
int auth_type; /* Authentication type. */
u_char NSSATranslatorRole; /* NSSA configured role */
#define OSPF_NSSA_ROLE_NEVER 0
#define OSPF_NSSA_ROLE_CANDIDATE 1
#define OSPF_NSSA_ROLE_ALWAYS 2
u_char NSSATranslatorState; /* NSSA operational role */
#define OSPF_NSSA_TRANSLATE_DISABLED 0
#define OSPF_NSSA_TRANSLATE_ENABLED 1
int NSSATranslatorStabilityInterval;
u_char transit; /* TransitCapability. */
#define OSPF_TRANSIT_FALSE 0
#define OSPF_TRANSIT_TRUE 1
struct route_table *ranges; /* Configured Area Ranges. */
/* RFC3137 stub router state flags for area */
u_char stub_router_state;
#define OSPF_AREA_ADMIN_STUB_ROUTED (1 << 0) /* admin stub-router set */
#define OSPF_AREA_IS_STUB_ROUTED (1 << 1) /* stub-router active */
#define OSPF_AREA_WAS_START_STUB_ROUTED (1 << 2) /* startup SR was done */
/* Area related LSDBs[Type1-4]. */
struct ospf_lsdb *lsdb;
/* Self-originated LSAs. */
struct ospf_lsa *router_lsa_self;
#ifdef HAVE_OPAQUE_LSA
struct list *opaque_lsa_self; /* Type-10 Opaque-LSAs */
#endif /* HAVE_OPAQUE_LSA */
/* Area announce list. */
struct
{
char *name;
struct access_list *list;
} _export;
#define EXPORT_NAME(A) (A)->_export.name
#define EXPORT_LIST(A) (A)->_export.list
/* Area acceptance list. */
struct
{
char *name;
struct access_list *list;
} import;
#define IMPORT_NAME(A) (A)->import.name
#define IMPORT_LIST(A) (A)->import.list
/* Type 3 LSA Area prefix-list. */
struct
{
char *name;
struct prefix_list *list;
} plist_in;
#define PREFIX_LIST_IN(A) (A)->plist_in.list
#define PREFIX_NAME_IN(A) (A)->plist_in.name
struct
{
char *name;
struct prefix_list *list;
} plist_out;
#define PREFIX_LIST_OUT(A) (A)->plist_out.list
#define PREFIX_NAME_OUT(A) (A)->plist_out.name
/* Shortest Path Tree. */
struct vertex *spf;
/* Threads. */
struct thread *t_stub_router; /* Stub-router timer */
#ifdef HAVE_OPAQUE_LSA
struct thread *t_opaque_lsa_self; /* Type-10 Opaque-LSAs origin. */
#endif /* HAVE_OPAQUE_LSA */
/* Statistics field. */
u_int32_t spf_calculation; /* SPF Calculation Count. */
/* Time stamps. */
struct timeval ts_spf; /* SPF calculation time stamp. */
/* Router count. */
u_int32_t abr_count; /* ABR router in this area. */
u_int32_t asbr_count; /* ASBR router in this area. */
/* Counters. */
u_int32_t act_ints; /* Active interfaces. */
u_int32_t full_nbrs; /* Fully adjacent neighbors. */
u_int32_t full_vls; /* Fully adjacent virtual neighbors. */
};
/* OSPF config network structure. */
struct ospf_network
{
/* Area ID. */
struct in_addr area_id;
int format;
};
/* OSPF NBMA neighbor structure. */
struct ospf_nbr_nbma
{
/* Neighbor IP address. */
struct in_addr addr;
/* OSPF interface. */
struct ospf_interface *oi;
/* OSPF neighbor structure. */
struct ospf_neighbor *nbr;
/* Neighbor priority. */
u_char priority;
/* Poll timer value. */
u_int32_t v_poll;
/* Poll timer thread. */
struct thread *t_poll;
/* State change. */
u_int32_t state_change;
};
/* Macro. */
#define OSPF_AREA_SAME(X,Y) \
(memcmp ((X->area_id), (Y->area_id), IPV4_MAX_BYTELEN) == 0)
#define IS_OSPF_ABR(O) ((O)->flags & OSPF_FLAG_ABR)
#define IS_OSPF_ASBR(O) ((O)->flags & OSPF_FLAG_ASBR)
#define OSPF_IS_AREA_ID_BACKBONE(I) ((I).s_addr == OSPF_AREA_BACKBONE)
#define OSPF_IS_AREA_BACKBONE(A) OSPF_IS_AREA_ID_BACKBONE ((A)->area_id)
#ifdef roundup
# define ROUNDUP(val, gran) roundup(val, gran)
#else /* roundup */
# define ROUNDUP(val, gran) (((val) - 1 | (gran) - 1) + 1)
#endif /* roundup */
#define LSA_OPTIONS_GET(area) \
(((area)->external_routing == OSPF_AREA_DEFAULT) ? OSPF_OPTION_E : 0)
#define LSA_OPTIONS_NSSA_GET(area) \
(((area)->external_routing == OSPF_AREA_NSSA) ? OSPF_OPTION_NP : 0)
#define OSPF_TIMER_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer (master, (F), ospf, (V)); \
} while (0)
#define OSPF_AREA_TIMER_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer (master, (F), area, (V)); \
} while (0)
#define OSPF_POLL_TIMER_ON(T,F,V) \
do { \
if (!(T)) \
(T) = thread_add_timer (master, (F), nbr_nbma, (V)); \
} while (0)
#define OSPF_POLL_TIMER_OFF(X) OSPF_TIMER_OFF((X))
#define OSPF_TIMER_OFF(X) \
do { \
if (X) \
{ \
thread_cancel (X); \
(X) = NULL; \
} \
} while (0)
/* Extern variables. */
extern struct ospf_master *om;
extern const struct message ospf_ism_state_msg[];
extern const struct message ospf_nsm_state_msg[];
extern const struct message ospf_lsa_type_msg[];
extern const struct message ospf_link_state_id_type_msg[];
extern const struct message ospf_network_type_msg[];
extern const int ospf_ism_state_msg_max;
extern const int ospf_nsm_state_msg_max;
extern const int ospf_lsa_type_msg_max;
extern const int ospf_link_state_id_type_msg_max;
extern const int ospf_redistributed_proto_max;
extern const int ospf_network_type_msg_max;
extern struct zclient *zclient;
extern struct thread_master *master;
extern int ospf_zlog;
/* Prototypes. */
extern const char *ospf_redist_string(u_int route_type);
extern struct ospf *ospf_lookup (void);
extern struct ospf *ospf_get (void);
extern void ospf_finish (struct ospf *);
extern void ospf_router_id_update (struct ospf *ospf);
extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *,
struct in_addr);
extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *,
struct in_addr);
extern int ospf_area_stub_set (struct ospf *, struct in_addr);
extern int ospf_area_stub_unset (struct ospf *, struct in_addr);
extern int ospf_area_no_summary_set (struct ospf *, struct in_addr);
extern int ospf_area_no_summary_unset (struct ospf *, struct in_addr);
extern int ospf_area_nssa_set (struct ospf *, struct in_addr);
extern int ospf_area_nssa_unset (struct ospf *, struct in_addr);
extern int ospf_area_nssa_translator_role_set (struct ospf *, struct in_addr,
int);
extern int ospf_area_export_list_set (struct ospf *, struct ospf_area *,
const char *);
extern int ospf_area_export_list_unset (struct ospf *, struct ospf_area *);
extern int ospf_area_import_list_set (struct ospf *, struct ospf_area *,
const char *);
extern int ospf_area_import_list_unset (struct ospf *, struct ospf_area *);
extern int ospf_area_shortcut_set (struct ospf *, struct ospf_area *, int);
extern int ospf_area_shortcut_unset (struct ospf *, struct ospf_area *);
extern int ospf_timers_refresh_set (struct ospf *, int);
extern int ospf_timers_refresh_unset (struct ospf *);
extern int ospf_nbr_nbma_set (struct ospf *, struct in_addr);
extern int ospf_nbr_nbma_unset (struct ospf *, struct in_addr);
extern int ospf_nbr_nbma_priority_set (struct ospf *, struct in_addr, u_char);
extern int ospf_nbr_nbma_priority_unset (struct ospf *, struct in_addr);
extern int ospf_nbr_nbma_poll_interval_set (struct ospf *, struct in_addr,
unsigned int);
extern int ospf_nbr_nbma_poll_interval_unset (struct ospf *, struct in_addr);
extern void ospf_prefix_list_update (struct prefix_list *);
extern void ospf_init (void);
extern void ospf_if_update (struct ospf *, struct interface *);
extern void ospf_ls_upd_queue_empty (struct ospf_interface *);
extern void ospf_terminate (void);
extern void ospf_nbr_nbma_if_update (struct ospf *, struct ospf_interface *);
extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup (struct ospf *,
struct in_addr);
extern struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next (struct ospf *,
struct in_addr *,
int);
extern int ospf_oi_count (struct interface *);
extern struct ospf_area *ospf_area_get (struct ospf *, struct in_addr, int);
extern void ospf_area_check_free (struct ospf *, struct in_addr);
extern struct ospf_area *ospf_area_lookup_by_area_id (struct ospf *,
struct in_addr);
extern void ospf_area_add_if (struct ospf_area *, struct ospf_interface *);
extern void ospf_area_del_if (struct ospf_area *, struct ospf_interface *);
extern void ospf_route_map_init (void);
extern void ospf_snmp_init (void);
extern void ospf_master_init (void);
#endif /* _ZEBRA_OSPFD_H */