summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_abr.c6
-rw-r--r--ospf6d/ospf6_area.c1
-rw-r--r--ospf6d/ospf6_area.h2
-rw-r--r--ospf6d/ospf6_asbr.c4
-rw-r--r--ospf6d/ospf6_flood.c8
-rw-r--r--ospf6d/ospf6_interface.c6
-rw-r--r--ospf6d/ospf6_lsa.c32
-rw-r--r--ospf6d/ospf6_lsa.h2
-rw-r--r--ospf6d/ospf6_lsdb.c2
-rw-r--r--ospf6d/ospf6_message.c2
-rw-r--r--ospf6d/ospf6_network.c1
-rw-r--r--ospf6d/ospf6_proto.h21
-rw-r--r--ospf6d/ospf6d.h3
13 files changed, 36 insertions, 54 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index c3a63fe6..3277e7d8 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -253,7 +253,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
}
/* do not generate if the route cost is greater or equal to LSInfinity */
- if (route->path.cost >= LS_INFINITY)
+ if (route->path.cost >= OSPF_LS_INFINITY)
{
if (is_debug)
zlog_debug ("The cost exceeds LSInfinity, withdraw");
@@ -296,7 +296,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
/* ranges are ignored when originate backbone routes to transit area.
Otherwise, if ranges are configured, the route is suppressed. */
if (range && ! CHECK_FLAG (range->flag, OSPF6_ROUTE_REMOVE) &&
- (route->path.area_id != BACKBONE_AREA_ID ||
+ (route->path.area_id != OSPF_AREA_BACKBONE ||
! IS_AREA_TRANSIT (area)))
{
if (is_debug)
@@ -604,7 +604,7 @@ ospf6_abr_examin_summary (struct ospf6_lsa *lsa, struct ospf6_area *oa)
}
/* (1) if cost == LSInfinity or if the LSA is MaxAge */
- if (cost == LS_INFINITY)
+ if (cost == OSPF_LS_INFINITY)
{
if (is_debug)
zlog_debug ("cost is LS_INFINITY, ignore");
diff --git a/ospf6d/ospf6_area.c b/ospf6d/ospf6_area.c
index 9934e6b9..2d20e625 100644
--- a/ospf6d/ospf6_area.c
+++ b/ospf6d/ospf6_area.c
@@ -401,6 +401,7 @@ DEFUN (no_area_range,
}
ospf6_route_remove (range, oa->range_table);
+
return CMD_SUCCESS;
}
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h
index e8a4fbd8..655967a9 100644
--- a/ospf6d/ospf6_area.h
+++ b/ospf6d/ospf6_area.h
@@ -105,8 +105,6 @@ struct ospf6_area
#define OSPF6_AREA_TRANSIT 0x04 /* TransitCapability */
#define OSPF6_AREA_STUB 0x08
-#define BACKBONE_AREA_ID (htonl (0))
-#define IS_AREA_BACKBONE(oa) ((oa)->area_id == BACKBONE_AREA_ID)
#define IS_AREA_ENABLED(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ENABLE))
#define IS_AREA_ACTIVE(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_ACTIVE))
#define IS_AREA_TRANSIT(oa) (CHECK_FLAG ((oa)->flag, OSPF6_AREA_TRANSIT))
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index ae0a286d..1a0634ed 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -174,7 +174,7 @@ ospf6_asbr_lsa_add (struct ospf6_lsa *lsa)
return;
}
- if (OSPF6_ASBR_METRIC (external) == LS_INFINITY)
+ if (OSPF6_ASBR_METRIC (external) == OSPF_LS_INFINITY)
{
if (IS_OSPF6_DEBUG_EXAMIN (AS_EXTERNAL))
zlog_debug ("Ignore LSA with LSInfinity Metric");
@@ -890,7 +890,7 @@ ospf6_routemap_rule_set_metric_compile (const char *arg)
u_int32_t metric;
char *endp;
metric = strtoul (arg, &endp, 0);
- if (metric > LS_INFINITY || *endp != '\0')
+ if (metric > OSPF_LS_INFINITY || *endp != '\0')
return NULL;
return XSTRDUP (MTYPE_ROUTE_MAP_COMPILED, arg);
}
diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c
index b8159729..3a9af01d 100644
--- a/ospf6d/ospf6_flood.c
+++ b/ospf6d/ospf6_flood.c
@@ -113,7 +113,7 @@ ospf6_lsa_originate (struct ospf6_lsa *lsa)
ospf6_lsdb_add (ospf6_lsa_copy (lsa), lsdb_self);
lsa->refresh = thread_add_timer (master, ospf6_lsa_refresh, lsa,
- LS_REFRESH_TIME);
+ OSPF_LS_REFRESH_TIME);
if (IS_OSPF6_DEBUG_LSA_TYPE (lsa->header->type) ||
IS_OSPF6_DEBUG_ORIGINATE_TYPE (lsa->header->type))
@@ -228,7 +228,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa)
quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
if (! OSPF6_LSA_IS_MAXAGE (lsa))
lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa,
- MAXAGE + lsa->birth.tv_sec - now.tv_sec);
+ OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec);
else
lsa->expire = NULL;
@@ -837,7 +837,7 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
struct timeval now, res;
quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &old->installed, &res);
- if (res.tv_sec < MIN_LS_ARRIVAL)
+ if (res.tv_sec < OSPF_MIN_LS_ARRIVAL)
{
if (is_debug)
zlog_debug ("LSA can't be updated within MinLSArrival, discard");
@@ -944,7 +944,7 @@ ospf6_receive_lsa (struct ospf6_neighbor *from,
/* If database copy is in 'Seqnumber Wrapping',
simply discard the received LSA */
if (OSPF6_LSA_IS_MAXAGE (old) &&
- old->header->seqnum == htonl (MAX_SEQUENCE_NUMBER))
+ old->header->seqnum == htonl (OSPF_MAX_SEQUENCE_NUMBER))
{
if (is_debug)
{
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 40cda246..467479b1 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -112,9 +112,9 @@ ospf6_interface_create (struct interface *ifp)
oi->transdelay = OSPF6_INTERFACE_TRANSDELAY;
oi->priority = OSPF6_INTERFACE_PRIORITY;
- oi->hello_interval = OSPF6_INTERFACE_HELLO_INTERVAL;
- oi->dead_interval = OSPF6_INTERFACE_DEAD_INTERVAL;
- oi->rxmt_interval = OSPF6_INTERFACE_RXMT_INTERVAL;
+ oi->hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
+ oi->dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
+ oi->rxmt_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
oi->cost = OSPF6_INTERFACE_COST;
oi->state = OSPF6_INTERFACE_DOWN;
oi->flag = 0;
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index ff061dfb..7dbd303f 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -139,11 +139,11 @@ ospf6_lsa_is_differ (struct ospf6_lsa *lsa1,
ospf6_lsa_age_current (lsa1);
ospf6_lsa_age_current (lsa2);
- if (ntohs (lsa1->header->age) == MAXAGE &&
- ntohs (lsa2->header->age) != MAXAGE)
+ if (ntohs (lsa1->header->age) == OSPF_LSA_MAXAGE &&
+ ntohs (lsa2->header->age) != OSPF_LSA_MAXAGE)
return 1;
- if (ntohs (lsa1->header->age) != MAXAGE &&
- ntohs (lsa2->header->age) == MAXAGE)
+ if (ntohs (lsa1->header->age) != OSPF_LSA_MAXAGE &&
+ ntohs (lsa2->header->age) == OSPF_LSA_MAXAGE)
return 1;
/* compare body */
@@ -218,19 +218,19 @@ ospf6_lsa_age_current (struct ospf6_lsa *lsa)
zlog_warn ("LSA: quagga_gettime failed, may fail LSA AGEs: %s",
safe_strerror (errno));
- if (ntohs (lsa->header->age) >= MAXAGE)
+ if (ntohs (lsa->header->age) >= OSPF_LSA_MAXAGE)
{
/* ospf6_lsa_premature_aging () sets age to MAXAGE; when using
relative time, we cannot compare against lsa birth time, so
we catch this special case here. */
- lsa->header->age = htons (MAXAGE);
- return MAXAGE;
+ lsa->header->age = htons (OSPF_LSA_MAXAGE);
+ return OSPF_LSA_MAXAGE;
}
/* calculate age */
ulage = now.tv_sec - lsa->birth.tv_sec;
/* if over MAXAGE, set to it */
- age = (ulage > MAXAGE ? MAXAGE : ulage);
+ age = (ulage > OSPF_LSA_MAXAGE ? OSPF_LSA_MAXAGE : ulage);
lsa->header->age = htons (age);
return age;
@@ -243,8 +243,8 @@ ospf6_lsa_age_update_to_send (struct ospf6_lsa *lsa, u_int32_t transdelay)
unsigned short age;
age = ospf6_lsa_age_current (lsa) + transdelay;
- if (age > MAXAGE)
- age = MAXAGE;
+ if (age > OSPF_LSA_MAXAGE)
+ age = OSPF_LSA_MAXAGE;
lsa->header->age = htons (age);
}
@@ -258,7 +258,7 @@ ospf6_lsa_premature_aging (struct ospf6_lsa *lsa)
THREAD_OFF (lsa->expire);
THREAD_OFF (lsa->refresh);
- lsa->header->age = htons (MAXAGE);
+ lsa->header->age = htons (OSPF_LSA_MAXAGE);
thread_execute (master, ospf6_lsa_expire, lsa, 0);
}
@@ -297,15 +297,15 @@ ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
ageb = ospf6_lsa_age_current (b);
/* MaxAge check */
- if (agea == MAXAGE && ageb != MAXAGE)
+ if (agea == OSPF_LSA_MAXAGE && ageb != OSPF_LSA_MAXAGE)
return -1;
- else if (agea != MAXAGE && ageb == MAXAGE)
+ else if (agea != OSPF_LSA_MAXAGE && ageb == OSPF_LSA_MAXAGE)
return 1;
/* Age check */
- if (agea > ageb && agea - ageb >= MAX_AGE_DIFF)
+ if (agea > ageb && agea - ageb >= OSPF_LSA_MAXAGE_DIFF)
return 1;
- else if (agea < ageb && ageb - agea >= MAX_AGE_DIFF)
+ else if (agea < ageb && ageb - agea >= OSPF_LSA_MAXAGE_DIFF)
return -1;
/* neither recent */
@@ -653,7 +653,7 @@ ospf6_lsa_refresh (struct thread *thread)
new = ospf6_lsa_create (self->header);
new->lsdb = old->lsdb;
new->refresh = thread_add_timer (master, ospf6_lsa_refresh, new,
- LS_REFRESH_TIME);
+ OSPF_LS_REFRESH_TIME);
/* store it in the LSDB for self-originated LSAs */
ospf6_lsdb_add (ospf6_lsa_copy (new), lsdb_self);
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index 263411fc..f10ee671 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -107,7 +107,7 @@ struct ospf6_lsa_header
((L)->header->adv_router == (a) && (L)->header->id == (i) && \
(L)->header->type == (t))
#define OSPF6_LSA_IS_DIFFER(L1, L2) ospf6_lsa_is_differ (L1, L2)
-#define OSPF6_LSA_IS_MAXAGE(L) (ospf6_lsa_age_current (L) == MAXAGE)
+#define OSPF6_LSA_IS_MAXAGE(L) (ospf6_lsa_age_current (L) == OSPF_LSA_MAXAGE)
#define OSPF6_LSA_IS_CHANGED(L1, L2) ospf6_lsa_is_changed (L1, L2)
struct ospf6_lsa
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 280bdf95..7455d835 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -572,7 +572,7 @@ ospf6_new_ls_seqnum (u_int16_t type, u_int32_t id, u_int32_t adv_router,
/* if current database copy not found, return InitialSequenceNumber */
lsa = ospf6_lsdb_lookup (type, id, adv_router, lsdb);
if (lsa == NULL)
- seqnum = INITIAL_SEQUENCE_NUMBER;
+ seqnum = OSPF_INITIAL_SEQUENCE_NUMBER;
else
seqnum = (signed long) ntohl (lsa->header->seqnum) + 1;
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index 5edb70ce..b35aa1ac 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1282,7 +1282,7 @@ ospf6_rxpacket_examin (struct ospf6_interface *oi, struct ospf6_header *oh, cons
{
if (IS_OSPF6_DEBUG_MESSAGE (oh->type, RECV))
{
- if (oh->area_id == BACKBONE_AREA_ID)
+ if (oh->area_id == OSPF_AREA_BACKBONE)
zlog_debug ("%s: Message may be via Virtual Link: not supported", __func__);
else
zlog_debug
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index e5a1436c..eed7f9d6 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -27,6 +27,7 @@
#include "sockopt.h"
#include "privs.h"
+#include "libospf.h"
#include "ospf6_proto.h"
#include "ospf6_network.h"
diff --git a/ospf6d/ospf6_proto.h b/ospf6d/ospf6_proto.h
index 64625004..af60eb92 100644
--- a/ospf6d/ospf6_proto.h
+++ b/ospf6d/ospf6_proto.h
@@ -26,33 +26,12 @@
/* OSPF protocol version */
#define OSPFV3_VERSION 3
-/* OSPF protocol number. */
-#ifndef IPPROTO_OSPFIGP
-#define IPPROTO_OSPFIGP 89
-#endif
-
/* TOS field normaly null */
#define DEFAULT_TOS_VALUE 0x0
-/* Architectural Constants */
-#define LS_REFRESH_TIME 1800 /* 30 min */
-#define MIN_LS_INTERVAL 5
-#define MIN_LS_ARRIVAL 1
-#define MAXAGE 3600 /* 1 hour */
-#define CHECK_AGE 300 /* 5 min */
-#define MAX_AGE_DIFF 900 /* 15 min */
-#define LS_INFINITY 0xffffff /* 24-bit binary value */
-#define INITIAL_SEQUENCE_NUMBER 0x80000001 /* signed 32-bit integer */
-#define MAX_SEQUENCE_NUMBER 0x7fffffff /* signed 32-bit integer */
-
#define ALLSPFROUTERS6 "ff02::5"
#define ALLDROUTERS6 "ff02::6"
-/* Configurable Constants */
-
-#define DEFAULT_HELLO_INTERVAL 10
-#define DEFAULT_ROUTER_DEAD_INTERVAL 40
-
#define OSPF6_ROUTER_BIT_W (1 << 3)
#define OSPF6_ROUTER_BIT_V (1 << 2)
#define OSPF6_ROUTER_BIT_E (1 << 1)
diff --git a/ospf6d/ospf6d.h b/ospf6d/ospf6d.h
index 2ac6300e..13699d61 100644
--- a/ospf6d/ospf6d.h
+++ b/ospf6d/ospf6d.h
@@ -24,6 +24,9 @@
#define OSPF6_DAEMON_VERSION "0.9.7r"
+#include "libospf.h"
+#include "thread.h"
+
/* global variables */
extern struct thread_master *master;