diff options
author | michele papalini <micpapal@cisco.com> | 2020-01-20 18:09:50 +0100 |
---|---|---|
committer | michele papalini <micpapal@cisco.com> | 2020-01-20 18:11:20 +0100 |
commit | de13ed1c3155f699cb1e322dcd4d64a06ae00bb9 (patch) | |
tree | 8698f1cfaec39b995a33111e6389f952fd20da19 /hicn-light/src/hicn/config/configuration.c | |
parent | 5631ede2129e9926ada6b0c0289838ad567b118b (diff) |
[HICN-480] add related prefixes to the forwarding strategy command
Signed-off-by: michele papalini <micpapal@cisco.com>
Change-Id: Id1bb559351d3f1f8af76326798740d6b13760e55
Signed-off-by: michele papalini <micpapal@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/config/configuration.c')
-rw-r--r-- | hicn-light/src/hicn/config/configuration.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/config/configuration.c b/hicn-light/src/hicn/config/configuration.c index 8f97af3b1..509ad10ba 100644 --- a/hicn-light/src/hicn/config/configuration.c +++ b/hicn-light/src/hicn/config/configuration.c @@ -295,7 +295,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config, if (numberSet_Length(nexthops) > 1) { // payload extended, need reallocate, further entries via nexthops payloadSize = payloadSize + numberSet_Length(nexthops) - 1; - payloadResponse = (uint8_t *)parcMemory_Reallocate( + payloadResponse = (uint8_t *) parcMemory_Reallocate( payloadResponse, sizeof(list_routes_command) * payloadSize); } @@ -1035,10 +1035,25 @@ struct iovec *configuration_SetForwardingStrategy(Configuration *config, _configuration_StoreFwdStrategy(config, prefix, strategy); Name *hicnPrefix = name_CreateFromAddress(control->addressType, control->address, control->len); - forwarder_SetStrategy(config->forwarder, hicnPrefix, strategy); + Name *related_prefixes[MAX_FWD_STRATEGY_RELATED_PREFIXES]; + if(control->related_prefixes != 0){ + for(int i = 0; i < control->related_prefixes; i++){ + related_prefixes[i] = name_CreateFromAddress( + control->addresses_type[i], + control->addresses[i], control->lens[i]); + } + } + forwarder_SetStrategy(config->forwarder, hicnPrefix, strategy, + control->related_prefixes, related_prefixes); name_Release(&hicnPrefix); + if(control->related_prefixes != 0){ + for(int i = 0; i < control->related_prefixes; i++){ + name_Release(&related_prefixes[i]); + } + } } + free((char *) prefix); struct iovec *response = utils_CreateAck(header, control, sizeof(set_strategy_command)); |