summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_abr.c8
-rw-r--r--ospf6d/ospf6_asbr.c6
-rw-r--r--ospf6d/ospf6_intra.c10
-rw-r--r--ospf6d/ospf6_route.c10
-rw-r--r--ospf6d/ospf6_route.h24
-rw-r--r--ospf6d/ospf6_snmp.c11
-rw-r--r--ospf6d/ospf6_spf.c8
-rw-r--r--ospf6d/ospf6_top.c4
-rw-r--r--ospf6d/ospf6d.c4
9 files changed, 45 insertions, 40 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index d38ef21a..e03ec842 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -162,7 +162,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
if (IS_OSPF6_DEBUG_ABR || IS_OSPF6_DEBUG_ORIGINATE (INTER_ROUTER))
{
is_debug++;
- inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (&route->prefix)),
+ inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (route->prefix)),
buf, sizeof (buf));
zlog_debug ("Originating summary in area %s for ASBR %s",
area->name, buf);
@@ -355,7 +355,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
{
if (is_debug)
{
- inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (&route->prefix)),
+ inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (route->prefix)),
buf, sizeof(buf));
zlog_debug ("prefix %s was denied by export list", buf);
}
@@ -376,7 +376,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
{
if (is_debug)
{
- inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (&route->prefix)),
+ inet_ntop (AF_INET, &(ADV_ROUTER_IN_PREFIX (route->prefix)),
buf, sizeof (buf));
zlog_debug ("prefix %s was denied by filter-list out", buf);
}
@@ -430,7 +430,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route,
router_lsa->options[1] = route->path.options[1];
router_lsa->options[2] = route->path.options[2];
OSPF6_ABR_SUMMARY_METRIC_SET (router_lsa, route->path.cost);
- router_lsa->router_id = ADV_ROUTER_IN_PREFIX (&route->prefix);
+ router_lsa->router_id = ADV_ROUTER_IN_PREFIX (route->prefix);
type = htons (OSPF6_LSTYPE_INTER_ROUTER);
}
else
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 685b147c..1bf98559 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -302,14 +302,14 @@ ospf6_asbr_lsentry_add (struct ospf6_route *asbr_entry)
if (! CHECK_FLAG (asbr_entry->flag, OSPF6_ROUTE_BEST))
{
char buf[16];
- inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (&asbr_entry->prefix),
+ inet_ntop (AF_INET, &ADV_ROUTER_IN_PREFIX (asbr_entry->prefix),
buf, sizeof (buf));
zlog_info ("ignore non-best path: lsentry %s add", buf);
return;
}
type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
- router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix);
+ router = ospf6_linkstate_prefix_adv_router (asbr_entry->prefix);
for (lsa = ospf6_lsdb_type_router_head (type, router, ospf6->lsdb); lsa;
lsa = ospf6_lsdb_type_router_next (type, router, lsa))
{
@@ -326,7 +326,7 @@ ospf6_asbr_lsentry_remove (struct ospf6_route *asbr_entry)
u_int32_t router;
type = htons (OSPF6_LSTYPE_AS_EXTERNAL);
- router = ospf6_linkstate_prefix_adv_router (&asbr_entry->prefix);
+ router = ospf6_linkstate_prefix_adv_router (asbr_entry->prefix);
for (lsa = ospf6_lsdb_type_router_head (type, router, ospf6->lsdb);
lsa; lsa = ospf6_lsdb_type_router_next (type, router, lsa))
ospf6_asbr_lsa_remove (lsa);
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 05b11ba3..b30398f0 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1250,7 +1250,7 @@ ospf6_brouter_debug_print (struct ospf6_route *brouter)
char id[16], adv_router[16];
char capa[16], options[16];
- brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
+ brouter_id = ADV_ROUTER_IN_PREFIX (brouter->prefix);
inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
inet_ntop (AF_INET, &brouter->path.area_id, area_name, sizeof (area_name));
ospf6_linkstate_prefix2str (&brouter->prefix, destination,
@@ -1311,7 +1311,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
for (brouter = ospf6_route_head (oa->ospf6->brouter_table); brouter;
brouter = ospf6_route_next (brouter))
{
- brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
+ brouter_id = ADV_ROUTER_IN_PREFIX (brouter->prefix);
inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
if (brouter->path.area_id != oa->area_id)
continue;
@@ -1329,12 +1329,12 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
for (brouter = ospf6_route_head (oa->spf_table); brouter;
brouter = ospf6_route_next (brouter))
{
- brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
+ brouter_id = ADV_ROUTER_IN_PREFIX (brouter->prefix);
inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
if (brouter->type != OSPF6_DEST_TYPE_LINKSTATE)
continue;
- if (ospf6_linkstate_prefix_id (&brouter->prefix) != htonl (0))
+ if (ospf6_linkstate_prefix_id (brouter->prefix) != htonl (0))
continue;
if (! CHECK_FLAG (brouter->path.router_bits, OSPF6_ROUTER_BIT_E) &&
! CHECK_FLAG (brouter->path.router_bits, OSPF6_ROUTER_BIT_B))
@@ -1360,7 +1360,7 @@ ospf6_intra_brouter_calculation (struct ospf6_area *oa)
for (brouter = ospf6_route_head (oa->ospf6->brouter_table); brouter;
brouter = ospf6_route_next (brouter))
{
- brouter_id = ADV_ROUTER_IN_PREFIX (&brouter->prefix);
+ brouter_id = ADV_ROUTER_IN_PREFIX (brouter->prefix);
inet_ntop (AF_INET, &brouter_id, brouter_name, sizeof (brouter_name));
if (brouter->path.area_id != oa->area_id)
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 1e1f4fb5..8c1746c7 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -1070,7 +1070,7 @@ ospf6_route_show_table (struct vty *vty, int detail,
}
int
-ospf6_route_table_show (struct vty *vty, int argc, const char *argv[],
+ospf6_route_table_show (struct vty *vty, int argc, argv_t argv,
struct ospf6_route_table *table)
{
int summary = 0;
@@ -1183,9 +1183,9 @@ ospf6_linkstate_show (struct vty *vty, struct ospf6_route *route)
u_int32_t router, id;
char routername[16], idname[16], rbits[16], options[16];
- router = ospf6_linkstate_prefix_adv_router (&route->prefix);
+ router = ospf6_linkstate_prefix_adv_router (route->prefix);
inet_ntop (AF_INET, &router, routername, sizeof (routername));
- id = ospf6_linkstate_prefix_id (&route->prefix);
+ id = ospf6_linkstate_prefix_id (route->prefix);
inet_ntop (AF_INET, &id, idname, sizeof (idname));
ospf6_capability_printbuf (route->path.router_bits, rbits, sizeof (rbits));
@@ -1245,7 +1245,7 @@ ospf6_linkstate_show_table (struct vty *vty, int detail,
}
int
-ospf6_linkstate_table_show (struct vty *vty, int argc, const char *argv[],
+ospf6_linkstate_table_show (struct vty *vty, int argc, argv_t argv,
struct ospf6_route_table *table)
{
int detail = 0;
@@ -1320,7 +1320,7 @@ ospf6_brouter_show (struct vty *vty, struct ospf6_route *route)
u_int32_t adv_router;
char adv[16], rbits[16], options[16], area[16];
- adv_router = ospf6_linkstate_prefix_adv_router (&route->prefix);
+ adv_router = ospf6_linkstate_prefix_adv_router (route->prefix);
inet_ntop (AF_INET, &adv_router, adv, sizeof (adv));
ospf6_capability_printbuf (route->path.router_bits, rbits, sizeof (rbits));
ospf6_options_printbuf (route->path.options, options, sizeof (options));
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index 8dcc877f..22ecd3ff 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -235,17 +235,21 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX];
sizeof (struct ospf6_nexthop) * OSPF6_MULTI_PATH_LIMIT) == 0)
#define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST))
-#define ospf6_linkstate_prefix_adv_router(x) \
- (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
-#define ospf6_linkstate_prefix_id(x) \
- (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
+#ifdef s6_addr32
+#define OSPF6_PREFIX_PART(x, n) ((x).u.prefix6.s6_addr32[n])
+#else
+#define OSPF6_PREFIX_PART(x, n) ( ( (uint32_t*)((x).u.prefix6.s6_addr) )[n] )
+#endif
-#define ADV_ROUTER_IN_PREFIX(x) \
- (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[0]))
-#define ID_IN_PREFIX(x) \
- (*(u_int32_t *)(&(x)->u.prefix6.s6_addr[4]))
+#define ospf6_linkstate_prefix_adv_router(x) OSPF6_PREFIX_PART(x, 0)
+#define ospf6_linkstate_prefix_id(x) OSPF6_PREFIX_PART(x, 1)
+
+#define ADV_ROUTER_IN_PREFIX(x) OSPF6_PREFIX_PART(x, 0)
+#define ID_IN_PREFIX(x) OSPF6_PREFIX_PART(x, 1)
/* Function prototype */
+#include "command.h"
+
extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id,
struct prefix *prefix);
extern void ospf6_linkstate_prefix2str (struct prefix *prefix, char *buf,
@@ -288,10 +292,10 @@ extern void ospf6_route_dump (struct ospf6_route_table *table);
extern void ospf6_route_show (struct vty *vty, struct ospf6_route *route);
extern void ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route);
-extern int ospf6_route_table_show (struct vty *, int, const char *[],
+extern int ospf6_route_table_show (struct vty *, int, argv_t,
struct ospf6_route_table *);
extern int ospf6_linkstate_table_show (struct vty *vty, int argc,
- const char *argv[],
+ argv_t argv,
struct ospf6_route_table *table);
extern void ospf6_brouter_show_header (struct vty *vty);
diff --git a/ospf6d/ospf6_snmp.c b/ospf6d/ospf6_snmp.c
index 5ac7846d..25572a7c 100644
--- a/ospf6d/ospf6_snmp.c
+++ b/ospf6d/ospf6_snmp.c
@@ -306,6 +306,7 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
{
struct ospf6_area *oa, *area = NULL;
u_int32_t area_id = 0;
+ struct in_addr in_area_id ;
struct listnode *node;
unsigned int len;
@@ -319,9 +320,9 @@ ospfv3AreaEntry (struct variable *v, oid *name, size_t *length,
if (len)
oid2in_addr (name + v->namelen, len, (struct in_addr *) &area_id);
+ in_area_id.s_addr = area_id ;
zlog_debug ("SNMP access by area: %s, exact=%d len=%d length=%lu",
- inet_ntoa (* (struct in_addr *) &area_id),
- exact, len, (u_long)*length);
+ inet_ntoa (in_area_id), exact, len, (u_long)*length);
for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, node, oa))
{
@@ -398,7 +399,7 @@ ospfv3AreaLsdbEntry (struct variable *v, oid *name, size_t *length,
return NULL;
/* Parse area-id */
- len = (offsetlen < IN_ADDR_SIZE ? offsetlen : IN_ADDR_SIZE);
+ len = (offsetlen < (int)IN_ADDR_SIZE ? offsetlen : (int)IN_ADDR_SIZE);
if (len)
oid2in_addr (offset, len, &area_id);
offset += len;
@@ -412,14 +413,14 @@ ospfv3AreaLsdbEntry (struct variable *v, oid *name, size_t *length,
offsetlen -= len;
/* Parse Router-ID */
- len = (offsetlen < IN_ADDR_SIZE ? offsetlen : IN_ADDR_SIZE);
+ len = (offsetlen < (int)IN_ADDR_SIZE ? offsetlen : (int)IN_ADDR_SIZE);
if (len)
oid2in_addr (offset, len, &adv_router);
offset += len;
offsetlen -= len;
/* Parse LS-ID */
- len = (offsetlen < IN_ADDR_SIZE ? offsetlen : IN_ADDR_SIZE);
+ len = (offsetlen < (int)IN_ADDR_SIZE ? offsetlen : (int)IN_ADDR_SIZE);
if (len)
oid2in_addr (offset, len, &id);
offset += len;
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index bfb6df2e..767f5255 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -60,13 +60,13 @@ ospf6_vertex_id_cmp (void *a, void *b)
struct ospf6_vertex *vb = (struct ospf6_vertex *) b;
int ret = 0;
- ret = ntohl (ospf6_linkstate_prefix_adv_router (&va->vertex_id)) -
- ntohl (ospf6_linkstate_prefix_adv_router (&vb->vertex_id));
+ ret = ntohl (ospf6_linkstate_prefix_adv_router (va->vertex_id)) -
+ ntohl (ospf6_linkstate_prefix_adv_router (vb->vertex_id));
if (ret)
return ret;
- ret = ntohl (ospf6_linkstate_prefix_id (&va->vertex_id)) -
- ntohl (ospf6_linkstate_prefix_id (&vb->vertex_id));
+ ret = ntohl (ospf6_linkstate_prefix_id (va->vertex_id)) -
+ ntohl (ospf6_linkstate_prefix_id (vb->vertex_id));
return ret;
}
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 65a184fb..9305b23f 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -96,7 +96,7 @@ ospf6_top_route_hook_remove (struct ospf6_route *route)
static void
ospf6_top_brouter_hook_add (struct ospf6_route *route)
{
- ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
+ ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (route->prefix));
ospf6_asbr_lsentry_add (route);
ospf6_abr_originate_summary (route);
}
@@ -104,7 +104,7 @@ ospf6_top_brouter_hook_add (struct ospf6_route *route)
static void
ospf6_top_brouter_hook_remove (struct ospf6_route *route)
{
- ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
+ ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (route->prefix));
ospf6_asbr_lsentry_remove (route);
ospf6_abr_originate_summary (route);
}
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index 837a718e..0b7a1ff5 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -125,7 +125,7 @@ config_write_ospf6_debug (struct vty *vty)
"%s AS Scoped Link State Database%s%s"
static int
-parse_show_level (int argc, const char *argv[])
+parse_show_level (int argc, argv_t argv)
{
int level = 0;
if (argc)
@@ -143,7 +143,7 @@ parse_show_level (int argc, const char *argv[])
}
static u_int16_t
-parse_type_spec (int argc, const char *argv[])
+parse_type_spec (int argc, argv_t argv)
{
u_int16_t type = 0;
assert (argc);