summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_asbr.c2
-rw-r--r--ospfd/ospf_asbr.h4
-rw-r--r--ospfd/ospf_dump.c2
-rw-r--r--ospfd/ospf_lsa.c2
-rw-r--r--ospfd/ospf_routemap.c89
-rw-r--r--ospfd/ospf_vty.c16
-rw-r--r--ospfd/ospf_zebra.c8
-rw-r--r--ospfd/ospfd.h2
8 files changed, 30 insertions, 95 deletions
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 21f99af12..284c56468 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -137,7 +137,7 @@ ospf_route_map_set_compare (struct route_map_set_values *values1,
struct external_info *
ospf_external_info_add (u_char type, u_short instance, struct prefix_ipv4 p,
ifindex_t ifindex, struct in_addr nexthop,
- u_short tag)
+ route_tag_t tag)
{
struct external_info *new;
struct route_node *rn;
diff --git a/ospfd/ospf_asbr.h b/ospfd/ospf_asbr.h
index 25a53aad4..e2fa36745 100644
--- a/ospfd/ospf_asbr.h
+++ b/ospfd/ospf_asbr.h
@@ -47,7 +47,7 @@ struct external_info
struct in_addr nexthop;
/* Additional Route tag. */
- u_int32_t tag;
+ route_tag_t tag;
struct route_map_set_values route_map_set;
#define ROUTEMAP_METRIC(E) (E)->route_map_set.metric
@@ -65,7 +65,7 @@ extern struct external_info *ospf_external_info_add (u_char, u_short,
struct prefix_ipv4,
ifindex_t,
struct in_addr,
- u_short);
+ route_tag_t);
extern void ospf_external_info_delete (u_char, u_short, struct prefix_ipv4);
extern struct external_info *ospf_external_info_lookup (u_char, u_short,
struct prefix_ipv4 *);
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index a53c72685..8fa2258f4 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -493,7 +493,7 @@ ospf_as_external_lsa_dump (struct stream *s, u_int16_t length)
IS_EXTERNAL_METRIC (al->e[i].tos) ? "E" : "-",
al->e[i].tos & 0x7f, GET_METRIC (al->e[i].metric));
zlog_debug (" Forwarding address %s", inet_ntoa (al->e[i].fwd_addr));
- zlog_debug (" External Route Tag %d", al->e[i].route_tag);
+ zlog_debug (" External Route Tag %"ROUTE_TAG_PRI, al->e[i].route_tag);
}
}
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index b96ed452c..916d4d01c 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -1673,7 +1673,7 @@ ospf_external_lsa_body_set (struct stream *s, struct external_info *ei,
/* Put forwarding address. */
stream_put_ipv4 (s, fwd_addr.s_addr);
- /* Put route tag -- only first 16bits are used for compatibility */
+ /* Put route tag */
stream_putl (s, ei->tag);
}
diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c
index b2f1c6712..6bd853bf8 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -443,7 +443,7 @@ static route_map_result_t
route_match_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct external_info *ei;
if (type == RMAP_OSPF)
@@ -457,45 +457,13 @@ route_match_tag (void *rule, struct prefix *prefix,
return RMAP_NOMATCH;
}
-/* Route map `match tag' match statement. `arg' is TAG value */
-static void *
-route_match_tag_compile (const char *arg)
-{
- u_short *tag;
- u_short tmp;
-
- /* tag value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- tmp = atoi(arg);
- if (tmp < 1)
- return NULL;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-
- if (!tag)
- return tag;
-
- *tag = tmp;
-
- return tag;
-}
-
-/* Free route map's compiled 'match tag' value. */
-static void
-route_match_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag matching. */
-struct route_map_rule_cmd route_match_tag_cmd =
+static struct route_map_rule_cmd route_match_tag_cmd =
{
"tag",
route_match_tag,
- route_match_tag_compile,
- route_match_tag_free,
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
@@ -633,7 +601,7 @@ static route_map_result_t
route_set_tag (void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
{
- u_short *tag;
+ route_tag_t *tag;
struct external_info *ei;
if (type == RMAP_OSPF)
@@ -648,46 +616,13 @@ route_set_tag (void *rule, struct prefix *prefix,
return RMAP_OKAY;
}
-/* Route map `tag' compile function. Given string is converted to u_short. */
-static void *
-route_set_tag_compile (const char *arg)
-{
- u_short *tag;
- u_short tmp;
-
- /* tag value shoud be integer. */
- if (! all_digit (arg))
- return NULL;
-
- tmp = atoi(arg);
-
- if (tmp < 1)
- return NULL;
-
- tag = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (u_short));
-
- if (!tag)
- return tag;
-
- *tag = tmp;
-
- return tag;
-}
-
-/* Free route map's tag value. */
-static void
-route_set_tag_free (void *rule)
-{
- XFREE (MTYPE_ROUTE_MAP_COMPILED, rule);
-}
-
/* Route map commands for tag set. */
-struct route_map_rule_cmd route_set_tag_cmd =
+static struct route_map_rule_cmd route_set_tag_cmd =
{
"tag",
route_set_tag,
- route_set_tag_compile,
- route_set_tag_free,
+ route_map_rule_tag_compile,
+ route_map_rule_tag_free,
};
DEFUN (match_ip_nexthop,
@@ -877,7 +812,7 @@ ALIAS (no_match_interface,
DEFUN (match_tag,
match_tag_cmd,
- "match tag <1-65535>",
+ "match tag <1-4294967295>",
MATCH_STR
"Match tag of route\n"
"Tag value\n")
@@ -900,7 +835,7 @@ DEFUN (no_match_tag,
ALIAS (no_match_tag,
no_match_tag_val_cmd,
- "no match tag <1-65535>",
+ "no match tag <1-4294967295>",
NO_STR
MATCH_STR
"Match tag of route\n"
@@ -977,7 +912,7 @@ ALIAS (no_set_metric_type,
DEFUN (set_tag,
set_tag_cmd,
- "set tag <1-65535>",
+ "set tag <1-4294967295>",
SET_STR
"Tag value for routing protocol\n"
"Tag value\n")
@@ -1000,7 +935,7 @@ DEFUN (no_set_tag,
ALIAS (no_set_tag,
no_set_tag_val_cmd,
- "no set tag <1-65535>",
+ "no set tag <1-4294967295>",
NO_STR
SET_STR
"Tag value for routing protocol\n"
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index d9a4289ed..e76d9d706 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -5350,8 +5350,8 @@ show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
vty_out (vty, " Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
- vty_out (vty, " External Route Tag: %lu%s%s",
- (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
}
return 0;
@@ -5376,8 +5376,8 @@ show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
zlog_debug( " Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), "\n");
- zlog_debug( " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), "\n", "\n");
+ zlog_debug( " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), "\n", "\n");
return 0;
}
@@ -5404,8 +5404,8 @@ show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
vty_out (vty, " NSSA: Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
- vty_out (vty, " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
}
return 0;
@@ -9067,11 +9067,11 @@ show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
switch (er->path_type)
{
case OSPF_PATH_TYPE1_EXTERNAL:
- vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
+ vty_out (vty, "N E1 %-18s [%d] tag: %"ROUTE_TAG_PRI"%s", buf1,
er->cost, er->u.ext.tag, VTY_NEWLINE);
break;
case OSPF_PATH_TYPE2_EXTERNAL:
- vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
+ vty_out (vty, "N E2 %-18s [%d/%d] tag: %"ROUTE_TAG_PRI"%s", buf1, er->cost,
er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
break;
}
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 4458e95ba..b0ff5d0e3 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -379,10 +379,10 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route *or)
if (distance)
SET_FLAG (message, ZAPI_MESSAGE_DISTANCE);
- /* Check if path type is ASE and use only 16bit tags */
+ /* Check if path type is ASE */
if (((or->path_type == OSPF_PATH_TYPE1_EXTERNAL) ||
(or->path_type == OSPF_PATH_TYPE2_EXTERNAL)) &&
- (or->u.ext.tag > 0) && (or->u.ext.tag < UINT16_MAX))
+ (or->u.ext.tag > 0) && (or->u.ext.tag <= ROUTE_TAG_MAX))
SET_FLAG (message, ZAPI_MESSAGE_TAG);
/* Make packet. */
@@ -479,7 +479,7 @@ ospf_zebra_add (struct prefix_ipv4 *p, struct ospf_route *or)
}
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- stream_putw (s, (u_short)or->u.ext.tag);
+ stream_putl (s, or->u.ext.tag);
stream_putw_at (s, 0, stream_get_endp (s));
@@ -1093,7 +1093,7 @@ ospf_zebra_read_ipv4 (int command, struct zclient *zclient,
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_METRIC))
api.metric = stream_getl (s);
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
- api.tag = stream_getw (s);
+ api.tag = stream_getl (s);
else
api.tag = 0;
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index bc4acf993..93b5ab766 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -269,7 +269,7 @@ struct ospf
struct list *redist[ZEBRA_ROUTE_MAX + 1];
/* Redistribute tag info. */
- u_short dtag[ZEBRA_ROUTE_MAX + 1]; //Pending: cant configure as of now
+ route_tag_t dtag[ZEBRA_ROUTE_MAX + 1]; //Pending: cant configure as of now
int default_metric; /* Default metric for redistribute. */