*: 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/zebra/rib.h b/zebra/rib.h
index d31db55..0191f57 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -23,6 +23,7 @@
#ifndef _ZEBRA_RIB_H
#define _ZEBRA_RIB_H
+#include "zebra.h"
#include "linklist.h"
#include "prefix.h"
#include "table.h"
@@ -43,6 +44,9 @@
/* Refrence count. */
unsigned long refcnt;
+ /* Tag */
+ route_tag_t tag;
+
/* Uptime. */
time_t uptime;
@@ -65,9 +69,6 @@
/* Distance. */
u_char distance;
- /* Tag */
- u_short tag;
-
/* Flags of this route.
* This flag's definition is in lib/zebra.h ZEBRA_FLAG_* and is exposed
* to clients via Zserv
@@ -182,7 +183,7 @@
u_char distance;
/* Tag */
- u_short tag;
+ route_tag_t tag;
/* Flag for this static route's type. */
u_char type;
@@ -450,11 +451,12 @@
extern int
static_add_ipv4_safi (safi_t safi, struct prefix *p, struct in_addr *gate,
- const char *ifname, u_char flags, u_short tag, u_char distance,
- vrf_id_t vrf_id);
+ const char *ifname, u_char flags, route_tag_t,
+ u_char distance, vrf_id_t vrf_id);
extern int
static_delete_ipv4_safi (safi_t safi, struct prefix *p, struct in_addr *gate,
- const char *ifname, u_short tag, u_char distance, vrf_id_t vrf_id);
+ const char *ifname, route_tag_t tag, u_char distance,
+ vrf_id_t vrf_id);
extern int
rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
@@ -474,15 +476,16 @@
extern int
static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
- const char *ifname, u_char flags, u_short tag, u_char distance,
- vrf_id_t vrf_id);
+ const char *ifname, u_char flags, route_tag_t,
+ u_char distance, vrf_id_t vrf_id);
extern int
rib_add_ipv6_multipath (struct prefix_ipv6 *, struct rib *, safi_t);
extern int
static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
- const char *ifname, u_short tag, u_char distance, vrf_id_t vrf_id);
+ const char *ifname, route_tag_t, u_char distance,
+ vrf_id_t vrf_id);
extern int rib_gc_dest (struct route_node *rn);
extern struct route_table *rib_tables_iter_next (rib_tables_iter_t *iter);
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index e57d1af..405528c 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2314,8 +2314,8 @@
int
static_add_ipv4_safi (safi_t safi, struct prefix *p, struct in_addr *gate,
- const char *ifname, u_char flags, u_short tag, u_char distance,
- vrf_id_t vrf_id)
+ const char *ifname, u_char flags, route_tag_t tag,
+ u_char distance, vrf_id_t vrf_id)
{
u_char type = 0;
struct route_node *rn;
@@ -2411,7 +2411,8 @@
int
static_delete_ipv4_safi (safi_t safi, struct prefix *p, struct in_addr *gate,
- const char *ifname, u_short tag, u_char distance, vrf_id_t vrf_id)
+ const char *ifname, route_tag_t tag, u_char distance,
+ vrf_id_t vrf_id)
{
u_char type = 0;
struct route_node *rn;
@@ -2797,7 +2798,7 @@
/* Add static route into static route configuration. */
int
static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
- const char *ifname, u_char flags, u_short tag,
+ const char *ifname, u_char flags, route_tag_t tag,
u_char distance, vrf_id_t vrf_id)
{
struct route_node *rn;
@@ -2895,7 +2896,8 @@
/* Delete static route from static route configuration. */
int
static_delete_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
- const char *ifname, u_short tag, u_char distance, vrf_id_t vrf_id)
+ const char *ifname, route_tag_t tag, u_char distance,
+ vrf_id_t vrf_id)
{
struct route_node *rn;
struct static_route *si;
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index a14f68b..38f61e9 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -54,7 +54,7 @@
struct in_addr mask;
const char *ifname;
u_char flag = 0;
- u_short tag = 0;
+ route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
ret = str2prefix (dest_str, &p);
@@ -2451,7 +2451,7 @@
struct route_node *rn;
struct rib *rib;
int first = 1;
- u_short tag = 0;
+ route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
if (argv[0])
@@ -3386,7 +3386,7 @@
u_char type = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
u_char flag = 0;
- u_short tag = 0;
+ route_tag_t tag = 0;
ret = str2prefix (dest_str, &p);
if (ret <= 0)
@@ -4496,7 +4496,7 @@
struct route_node *rn;
struct rib *rib;
int first = 1;
- u_short tag = 0;
+ route_tag_t tag = 0;
vrf_id_t vrf_id = VRF_DEFAULT;
if (argv[0])
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 89232c2..2319a06 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -498,7 +498,7 @@
if (rib->tag)
{
SET_FLAG(zapi_flags, ZAPI_MESSAGE_TAG);
- stream_putw(s, rib->tag);
+ stream_putl (s, rib->tag);
}
}
@@ -1011,7 +1011,7 @@
rib->mtu = stream_getl (s);
/* Tag */
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- rib->tag = stream_getw (s);
+ rib->tag = stream_getl (s);
/* Table */
rib->table=zebrad.rtm_table_default;
@@ -1098,7 +1098,7 @@
/* tag */
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
- api.tag = stream_getw (s);
+ api.tag = stream_getl (s);
else
api.tag = 0;
@@ -1251,7 +1251,7 @@
/* Tag */
if (CHECK_FLAG (message, ZAPI_MESSAGE_TAG))
- rib->tag = stream_getw (s);
+ rib->tag = stream_getl (s);
/* Table */
rib->table=zebrad.rtm_table_default;
@@ -1322,7 +1322,7 @@
/* tag */
if (CHECK_FLAG (api.message, ZAPI_MESSAGE_TAG))
- api.tag = stream_getw (s);
+ api.tag = stream_getl (s);
else
api.tag = 0;