aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-08-01 11:40:03 -0700
committerFlorin Coras <florin.coras@gmail.com>2017-08-01 21:50:15 +0000
commita0a908f1dfb679c384ab34ee3c1a2a63ba2448df (patch)
tree4fe1128725998ecde799c6ec063094ae7791d163
parent42e6b097e02b80779213aa5c14a5202ecd5913e5 (diff)
FIB path weight incorrect in dump (VPP-922)
Change-Id: I655f41878ca3595681d0255782b0faba01c9824b Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/vnet/fib/fib_path.c5
-rw-r--r--src/vnet/fib/fib_test.c2
-rw-r--r--src/vnet/fib/fib_types.h4
-rw-r--r--src/vnet/ip/ip_api.c8
-rw-r--r--src/vnet/mpls/mpls.api3
-rw-r--r--src/vnet/mpls/mpls_api.c6
6 files changed, 17 insertions, 11 deletions
diff --git a/src/vnet/fib/fib_path.c b/src/vnet/fib/fib_path.c
index 00a3fa63d44..3a67a544eca 100644
--- a/src/vnet/fib/fib_path.c
+++ b/src/vnet/fib/fib_path.c
@@ -198,13 +198,14 @@ typedef struct fib_path_t_ {
/**
* UCMP [unnormalised] weigth
*/
- u16 fp_weight;
+ u8 fp_weight;
+
/**
* A path preference. 0 is the best.
* Only paths of the best preference, that are 'up', are considered
* for forwarding.
*/
- u16 fp_preference;
+ u8 fp_preference;
/**
* per-type union of the data required to resolve the path
diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c
index 720f54e7039..4c89166761c 100644
--- a/src/vnet/fib/fib_test.c
+++ b/src/vnet/fib/fib_test.c
@@ -5919,7 +5919,7 @@ fib_test_pref (void)
.frp_sw_if_index = ~0,
.frp_fib_index = 0,
.frp_weight = 1,
- .frp_preference = 1000,
+ .frp_preference = 255,
.frp_flags = FIB_ROUTE_PATH_RESOLVE_VIA_HOST,
.frp_addr = pfx_1_1_1_3_s_32.fp_addr,
};
diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h
index a7a23d74add..a209ff3c2a3 100644
--- a/src/vnet/fib/fib_types.h
+++ b/src/vnet/fib/fib_types.h
@@ -380,13 +380,13 @@ typedef struct fib_route_path_t_ {
/**
* [un]equal cost path weight
*/
- u16 frp_weight;
+ u8 frp_weight;
/**
* A path preference. 0 is the best.
* Only paths of the best preference, that are 'up', are considered
* for forwarding.
*/
- u16 frp_preference;
+ u8 frp_preference;
/**
* flags on the path
*/
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index d00ae76cfe8..4cbf75a3883 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -231,7 +231,8 @@ send_ip_fib_details (vpe_api_main_t * am,
default:
break;
}
- fp->weight = htonl (api_rpath->rpath.frp_weight);
+ fp->weight = api_rpath->rpath.frp_weight;
+ fp->preference = api_rpath->rpath.frp_preference;
fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
copy_fib_next_hop (api_rpath, fp);
fp++;
@@ -357,8 +358,9 @@ send_ip6_fib_details (vpe_api_main_t * am,
default:
break;
}
- fp->weight = htonl (api_rpath->rpath.frp_weight);
- fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
+ fp->weight = api_rpath->rpath.frp_weight;
+ fp->preference = api_rpath->rpath.frp_preference;
+ fp->sw_if_index = api_rpath->rpath.frp_sw_if_index;
copy_fib_next_hop (api_rpath, fp);
fp++;
}
diff --git a/src/vnet/mpls/mpls.api b/src/vnet/mpls/mpls.api
index 61d7fe6c303..67f1045d57a 100644
--- a/src/vnet/mpls/mpls.api
+++ b/src/vnet/mpls/mpls.api
@@ -112,7 +112,8 @@ define mpls_tunnel_dump
typeonly manual_print manual_endian define fib_path2
{
u32 sw_if_index;
- u32 weight;
+ u8 weight;
+ u8 preference;
u8 is_local;
u8 is_drop;
u8 is_unreach;
diff --git a/src/vnet/mpls/mpls_api.c b/src/vnet/mpls/mpls_api.c
index 22fb7d43a31..92fb24a6e88 100644
--- a/src/vnet/mpls/mpls_api.c
+++ b/src/vnet/mpls/mpls_api.c
@@ -334,7 +334,8 @@ send_mpls_tunnel_entry (u32 mti, void *arg)
{
memset (fp, 0, sizeof (*fp));
- fp->weight = htonl (api_rpath->rpath.frp_weight);
+ fp->weight = api_rpath->rpath.frp_weight;
+ fp->preference = api_rpath->rpath.frp_preference;
fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
copy_fib_next_hop (api_rpath, fp);
fp++;
@@ -393,7 +394,8 @@ send_mpls_fib_details (vpe_api_main_t * am,
vec_foreach (api_rpath, api_rpaths)
{
memset (fp, 0, sizeof (*fp));
- fp->weight = htonl (api_rpath->rpath.frp_weight);
+ fp->weight = api_rpath->rpath.frp_weight;
+ fp->preference = api_rpath->rpath.frp_preference;
fp->sw_if_index = htonl (api_rpath->rpath.frp_sw_if_index);
copy_fib_next_hop (api_rpath, fp);
fp++;