#ifndef _ZEBRA_OSPFD_H
#define _ZEBRA_OSPFD_H
+#include <zebra.h>
+#include "libospf.h"
+
#include "filter.h"
#include "log.h"
-#define OSPF_VERSION 2
-
-/* Default protocol, port number. */
-#ifndef IPPROTO_OSPFIGP
-#define IPPROTO_OSPFIGP 89
-#endif /* IPPROTO_OSPFIGP */
+#include "ospf_memory.h"
+#include "ospf_dump_api.h"
-/* IP precedence. */
-#ifndef IPTOS_PREC_INTERNETCONTROL
-#define IPTOS_PREC_INTERNETCONTROL 0xC0
-#endif /* IPTOS_PREC_INTERNETCONTROL */
+#define OSPF_VERSION 2
/* VTY port number. */
#define OSPF_VTY_PORT 2604
/* Default configuration file name for ospfd. */
#define OSPF_DEFAULT_CONFIG "ospfd.conf"
-/* Architectual Constants */
-#ifdef DEBUG
-#define OSPF_LS_REFRESH_TIME 60
-#else
-#define OSPF_LS_REFRESH_TIME 1800
-#endif
-#define OSPF_MIN_LS_INTERVAL 5
-#define OSPF_MIN_LS_ARRIVAL 1
-#define OSPF_LSA_MAXAGE 3600
-#define OSPF_CHECK_AGE 300
-#define OSPF_LSA_MAXAGE_DIFF 900
-#define OSPF_LS_INFINITY 0xffffff
-#define OSPF_DEFAULT_DESTINATION 0x00000000 /* 0.0.0.0 */
-#define OSPF_INITIAL_SEQUENCE_NUMBER 0x80000001
-#define OSPF_MAX_SEQUENCE_NUMBER 0x7fffffff
-
-#define OSPF_LSA_MAXAGE_CHECK_INTERVAL 30
#define OSPF_NSSA_TRANS_STABLE_DEFAULT 40
#define OSPF_ALLSPFROUTERS 0xe0000005 /* 224.0.0.5 */
#define OSPF_ALLDROUTERS 0xe0000006 /* 224.0.0.6 */
-/* XXX Where is this used? And why it was used only if compiled with
- * NSSA support. */
-#define OSPF_LOOPer 0x7f000000 /* 127.0.0.0 */
-
-#define OSPF_AREA_BACKBONE 0x00000000 /* 0.0.0.0 */
/* OSPF Authentication Type. */
#define OSPF_AUTH_NULL 0
been given or not in VLink command handlers */
#define OSPF_AUTH_CMD_NOTSEEN -2
-/* OSPF SPF timer values. */
-#define OSPF_SPF_DELAY_DEFAULT 200
-#define OSPF_SPF_HOLDTIME_DEFAULT 1000
-#define OSPF_SPF_MAX_HOLDTIME_DEFAULT 10000
-
-/* OSPF interface default values. */
-#define OSPF_OUTPUT_COST_DEFAULT 10
-#define OSPF_OUTPUT_COST_INFINITE UINT16_MAX
-#define OSPF_ROUTER_DEAD_INTERVAL_DEFAULT 40
-#define OSPF_ROUTER_DEAD_INTERVAL_MINIMAL 1
-#define OSPF_HELLO_INTERVAL_DEFAULT 10
-#define OSPF_ROUTER_PRIORITY_DEFAULT 1
-#define OSPF_RETRANSMIT_INTERVAL_DEFAULT 5
-#define OSPF_TRANSMIT_DELAY_DEFAULT 1
-#define OSPF_DEFAULT_BANDWIDTH 10000 /* Kbps */
-
-#define OSPF_DEFAULT_REF_BANDWIDTH 100000 /* Kbps */
-
-#define OSPF_POLL_INTERVAL_DEFAULT 60
-#define OSPF_NEIGHBOR_PRIORITY_DEFAULT 0
-
-#define OSPF_MTU_IGNORE_DEFAULT 0
-#define OSPF_FAST_HELLO_DEFAULT 0
-
/* OSPF options. */
-#define OSPF_OPTION_T 0x01 /* TOS. */
+#define OSPF_OPTION_MT 0x01 /* M/T */
#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
+#define OSPF_OPTION_DN 0x80
/* OSPF Database Description flags. */
#define OSPF_DD_FLAG_MS 0x01
#define OSPF_LS_REFRESH_SHIFT (60 * 15)
#define OSPF_LS_REFRESH_JITTER 60
+struct ospf_external
+{
+ u_short instance;
+ struct route_table *external_info;
+};
+
/* OSPF master for system wide configuration and variables. */
struct ospf_master
{
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;
+ struct list *external[ZEBRA_ROUTE_MAX + 1];
+#define EXTERNAL_INFO(E) (E->external_info)
/* Various OSPF global configuration. */
u_char options;
#define OSPF_MASTER_SHUTDOWN (1 << 0) /* deferred-shutdown */
};
+struct ospf_redist
+{
+ u_short instance;
+
+ /* 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;
+
+ /* For redistribute route map. */
+ struct
+ {
+ char *name;
+ struct route_map *map;
+ } route_map; /* +1 is for default-information */
+#define ROUTEMAP_NAME(R) (R->route_map.name)
+#define ROUTEMAP(R) (R->route_map.map)
+};
+
/* OSPF instance structure. */
struct ospf
{
+ /* OSPF's running state based on the '[no] router ospf [<instance>]' config. */
+ u_char oi_running;
+
+ /* OSPF instance ID */
+ u_short instance;
+
/* OSPF Router ID. */
struct in_addr router_id; /* Configured automatically. */
struct in_addr router_id_static; /* Configured manually. */
#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
+
+ /* LSA timers */
+ unsigned int min_ls_interval; /* minimum delay between LSAs (in msec) */
+ unsigned int min_ls_arrival; /* minimum interarrival time between LSAs (in msec) */
/* SPF parameters */
unsigned int spf_delay; /* SPF delay time. */
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 *external_lsas; /* Database of external LSAs,
prefix is LSA's adv. network*/
- /* Time stamps. */
+ /* Time stamps */
struct timeval ts_spf; /* SPF calculation time stamp. */
+ struct timeval ts_spf_duration; /* Execution time of last SPF */
- struct list *maxage_lsa; /* List of MaxAge LSA for deletion. */
+ struct route_table *maxage_lsa; /* List of MaxAge LSA for deletion. */
int redistribute; /* Num of redistributed protocols. */
/* Threads. */
- struct thread *t_router_lsa_update; /* router-LSA update timer. */
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;
+#define OSPF_WRITE_INTERFACE_COUNT_DEFAULT 20
+ int write_oi_count; /* Num of packets sent per thread invocation */
struct thread *t_read;
int fd;
- int maxsndbuflen;
struct stream *ibuf;
struct list *oi_write_q;
#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];
+ /* OSPF redistribute configuration */
+ struct list *redist[ZEBRA_ROUTE_MAX + 1];
+
+ /* Redistribute tag info. */
+ route_tag_t dtag[ZEBRA_ROUTE_MAX + 1]; //Pending: cant configure as of now
- /* 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)
+ OSPF_LS_REFRESH_SHIFT)/OSPF_LSA_REFRESHER_GRANULARITY + 1)
struct
{
u_int16_t index;
/* Statistics for LSA used for new instantiation. */
u_int32_t rx_lsa_count;
+ /* Counter of "ip ospf area x.x.x.x" */
+ u_int32_t if_ospf_cli_count;
+
struct route_table *distance_table;
};
/* 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
/* 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
struct vertex *spf;
/* Threads. */
- struct thread *t_router_lsa_self;/* Self-originated router-LSA timer. */
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. */
/* Extern variables. */
extern struct ospf_master *om;
-extern struct message ospf_ism_state_msg[];
-extern struct message ospf_nsm_state_msg[];
-extern struct message ospf_lsa_type_msg[];
-extern struct message ospf_link_state_id_type_msg[];
-extern struct message ospf_network_type_msg[];
-extern int ospf_ism_state_msg_max;
-extern int ospf_nsm_state_msg_max;
-extern int ospf_lsa_type_msg_max;
-extern int ospf_link_state_id_type_msg_max;
-extern int ospf_redistributed_proto_max;
-extern int ospf_network_type_msg_max;
+extern const int ospf_redistributed_proto_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_lookup_instance (u_short);
extern struct ospf *ospf_get (void);
+extern struct ospf *ospf_get_instance (u_short);
extern void ospf_finish (struct ospf *);
extern void ospf_router_id_update (struct ospf *ospf);
-extern int ospf_network_match_iface (struct connected *, struct prefix *);
extern int ospf_network_set (struct ospf *, struct prefix_ipv4 *,
struct in_addr);
extern int ospf_network_unset (struct ospf *, struct prefix_ipv4 *,
extern void ospf_master_init (void);
+extern int ospf_interface_set (struct interface *ifp, struct in_addr area_id);
+extern int ospf_interface_unset (struct interface *ifp);
#endif /* _ZEBRA_OSPFD_H */