aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authoracompagn <acompagn@cisco.com>2020-03-20 14:21:22 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2020-03-20 14:29:17 +0100
commitd0ebc1438a58b108f8d1509356bfabeaf95000fa (patch)
tree9021a9597fd864a0b81d93521932c166fcf6a1b4 /hicn-plugin/src
parentcea861e99637525358c1908485304d78282816be (diff)
[HICN-573] Fixed match of data packet in the producer app face
- Now the match honor the prefix length specified in the producer app face Signed-off-by: acompagn <acompagn@cisco.com> Change-Id: Icdd80b02603bb79ceeb0ab14e2da51328c0f9b74
Diffstat (limited to 'hicn-plugin/src')
-rw-r--r--hicn-plugin/src/faces/app/face_prod.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hicn-plugin/src/faces/app/face_prod.c b/hicn-plugin/src/faces/app/face_prod.c
index c183d6589..ae59719ce 100644
--- a/hicn-plugin/src/faces/app/face_prod.c
+++ b/hicn-plugin/src/faces/app/face_prod.c
@@ -271,6 +271,24 @@ hicn_face_prod_add (fib_prefix_t * prefix, u32 sw_if, u32 * cs_reserved,
if (ret == HICN_ERROR_NONE
&& hicn_face_prod_set_lru_max (*faceid, cs_reserved) == HICN_ERROR_NONE)
{
+ if (ip46_address_is_ip4(&(prefix->fp_addr)))
+ {
+ ip4_address_t mask;
+ ip4_preflen_to_mask (prefix->fp_len, &mask);
+ prefix->fp_addr.ip4.as_u32 = prefix->fp_addr.ip4.as_u32 & mask.as_u32;
+ prefix->fp_proto = FIB_PROTOCOL_IP4;
+ }
+ else
+ {
+ ip6_address_t mask;
+ ip6_preflen_to_mask (prefix->fp_len, &mask);
+ prefix->fp_addr.ip6.as_u64[0] =
+ prefix->fp_addr.ip6.as_u64[0] & mask.as_u64[0];
+ prefix->fp_addr.ip6.as_u64[1] =
+ prefix->fp_addr.ip6.as_u64[1] & mask.as_u64[1];
+ prefix->fp_proto = FIB_PROTOCOL_IP6;
+ }
+
hicn_app_state_create (sw_if, prefix);
ret = hicn_route_add (faceid, 1, prefix);
}