summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Cmarada <michal.cmarada@pantheon.tech>2018-05-03 09:42:34 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-05-03 08:31:54 +0000
commit7f65e3e6e35dafca1fd7e386c62d0c8e76a21484 (patch)
tree09ae1fa2df10b9513cfdb1fd535dc2963e01fbe4
parent493da31bc6f605d5a68b1810df4a8ca6326eb889 (diff)
HC2VPP-314 - fix for IPV6 routes with 128 subnet prefix
VPP uses byte in range of 0 to 255 but when jni is used and this type is converted to java byte which has range of -128 to 127 it will convert it to negative value. It then fails to create Ip6Prefix from this value. Change-Id: Ic18686959682c153da2e4ee4a7f7841c9b56e5d3 Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java2
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java2
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java2
3 files changed, 3 insertions, 3 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
index a58051b63..abb48618c 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
@@ -60,7 +60,7 @@ public final class Ipv6RouteNamesFactory implements RouteMapper {
public String uniqueRouteName(@Nonnull final Ip6FibDetails details, @Nonnull final MappingContext mappingContext) {
return bindName(routingProtocolContext.getName(details.tableId, mappingContext),
doubleDotlessAddress(details.address),
- String.valueOf(details.addressLength));
+ String.valueOf(Byte.toUnsignedInt(details.addressLength)));
}
public String uniqueRouteHopName(
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
index 80b4b8f79..97adb3589 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
@@ -63,7 +63,7 @@ public interface RouteRequestProducer extends ByteDataTranslator, AddressTransla
checkArgument(
allowedPrefixPatterns.stream().anyMatch(pattern -> Pattern.compile(pattern).matcher(value).matches()),
"%s is not a valid Ip-prefix value");
- return Byte.valueOf(value.substring(value.indexOf("/") + 1));
+ return Integer.valueOf(value.substring(value.indexOf("/") + 1)).byteValue();
}
default boolean classifyTablePresent(final String classifyTableName,
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
index 6d939af07..dbfe81d6c 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/Ipv6Translator.java
@@ -60,7 +60,7 @@ public interface Ipv6Translator extends ByteDataTranslator {
default byte extractPrefix(Ipv6Prefix data) {
checkNotNull(data, "Cannot extract from null");
- return Byte.valueOf(data.getValue().substring(data.getValue().indexOf('/') + 1));
+ return Integer.valueOf(data.getValue().substring(data.getValue().indexOf('/') + 1)).byteValue();
}
/**