*: Widen width of Zserv routing tag field.
* lib/zebra.h: Introduce a route_tag_t type for route tags generally,
and make it 4 bytes wide - so it can directly hold things like an ASN, or
the OSPF ASE-LSA tag.
* zebra/rib.h: Use route_tag_t instead of u_short.
* *: Update 'u_short (*)?(tag|tmp)' to use route_tag_t instead of u_short.
Update stream_{get,put} to l instead of w.
* ospf_zebra.c: (ospf_zebra_add) test OSPF tag within range of ROUTE_TAG_MAX.
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index 4b53690..0a411e4 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -136,7 +136,7 @@
struct external_info *
ospf_external_info_add (u_char type, 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 2709a6c..bc41a14 100644
--- a/ospfd/ospf_asbr.h
+++ b/ospfd/ospf_asbr.h
@@ -63,7 +63,7 @@
struct prefix_ipv4,
ifindex_t,
struct in_addr,
- u_short);
+ route_tag_t);
extern void ospf_external_info_delete (u_char, struct prefix_ipv4);
extern struct external_info *ospf_external_info_lookup (u_char,
struct prefix_ipv4 *);
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 4341cd9..d795439 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -1649,7 +1649,7 @@
/* 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 7bd6c3d..f044e38 100644
--- a/ospfd/ospf_routemap.c
+++ b/ospfd/ospf_routemap.c
@@ -422,7 +422,7 @@
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)
@@ -440,8 +440,8 @@
static void *
route_match_tag_compile (const char *arg)
{
- u_short *tag;
- u_short tmp;
+ route_tag_t *tag;
+ route_tag_t tmp;
/* tag value shoud be integer. */
if (! all_digit (arg))
@@ -596,7 +596,7 @@
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)
@@ -615,8 +615,8 @@
static void *
route_set_tag_compile (const char *arg)
{
- u_short *tag;
- u_short tmp;
+ route_tag_t *tag;
+ route_tag_t tmp;
/* tag value shoud be integer. */
if (! all_digit (arg))
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index ce268cd..60d9852 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -370,10 +370,10 @@
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. */
@@ -444,7 +444,7 @@
}
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));
@@ -900,7 +900,7 @@
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 4181d11..0315164 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -239,7 +239,7 @@
} dmetric [ZEBRA_ROUTE_MAX + 1];
/* Redistribute tag info. */
- u_short dtag [ZEBRA_ROUTE_MAX + 1];
+ route_tag_t dtag [ZEBRA_ROUTE_MAX + 1];
/* For redistribute route map. */
struct