aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api/java/japi
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/java/japi')
-rw-r--r--vpp-api/java/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java10
-rw-r--r--vpp-api/java/japi/vppjni.c60
-rw-r--r--vpp-api/java/japi/vppjni.h5
3 files changed, 64 insertions, 11 deletions
diff --git a/vpp-api/java/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java b/vpp-api/java/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java
index dd81e98cf27..fe3d0bca067 100644
--- a/vpp-api/java/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java
+++ b/vpp-api/java/japi/org/openvpp/vppjapi/vppVxlanTunnelDetails.java
@@ -16,18 +16,20 @@
package org.openvpp.vppjapi;
public final class vppVxlanTunnelDetails {
- public final int srcAddress;
- public final int dstAddress;
+ public final byte[] srcAddress;
+ public final byte[] dstAddress;
public final int encapVrfId;
public final int vni;
public final int decapNextIndex;
+ public final boolean isIpv6;
- public vppVxlanTunnelDetails(int srcAddress, int dstAddress,
- int encapVrfId, int vni, int decapNextIndex) {
+ public vppVxlanTunnelDetails(byte[] srcAddress, byte[] dstAddress,
+ int encapVrfId, int vni, int decapNextIndex, boolean isIpv6) {
this.srcAddress = srcAddress;
this.dstAddress = dstAddress;
this.encapVrfId = encapVrfId;
this.vni = vni;
this.decapNextIndex = decapNextIndex;
+ this.isIpv6 = isIpv6;
}
}
diff --git a/vpp-api/java/japi/vppjni.c b/vpp-api/java/japi/vppjni.c
index c3a1078b7b7..5645263aef8 100644
--- a/vpp-api/java/japi/vppjni.c
+++ b/vpp-api/java/japi/vppjni.c
@@ -1471,14 +1471,24 @@ JNIEXPORT jobjectArray JNICALL Java_org_openvpp_vppjapi_vppConn_vxlanTunnelDump0
for (i = 0; i < count; i++) {
vxlan_tunnel_details_t *details = &jm->vxlan_tunnel_details[i];
- jint src_address = details->src_address;
- jint dst_address = details->dst_address;
+
+ /* This interface to support both v4 and v6 addresses is nasty */
+ jbyteArray src_address = (*env)->NewByteArray(env, 16);
+ (*env)->SetByteArrayRegion(env, src_address, 0, 16,
+ (signed char*)details->src_address);
+
+ jbyteArray dst_address = (*env)->NewByteArray(env, 16);
+ (*env)->SetByteArrayRegion(env, dst_address, 0, 16,
+ (signed char*)details->dst_address);
+
jint encap_vrf_id = details->encap_vrf_id;
jint vni = details->vni;
jint decap_next_index = details->decap_next_index;
+ jboolean is_ipv6 = details->is_ipv6 ? 1 : 0;
jobject vxlanTunnelDetailsObj = vppVxlanTunnelDetailsObject(env,
- src_address, dst_address, encap_vrf_id, vni, decap_next_index);
+ src_address, dst_address, encap_vrf_id, vni,
+ decap_next_index, is_ipv6);
(*env)->SetObjectArrayElement(env, vxlanTunnelDetailsArray, i,
vxlanTunnelDetailsObj);
@@ -1498,11 +1508,51 @@ static void vl_api_vxlan_tunnel_details_t_handler
vxlan_tunnel_details_t *tunnel_details;
vec_add2(jm->vxlan_tunnel_details, tunnel_details, 1);
- tunnel_details->src_address = ntohl(mp->src_address);
- tunnel_details->dst_address = ntohl(mp->dst_address);
+ if (mp->is_ipv6){
+ u64 *s, *d;
+
+ /* this is ugly - why is this in host order at all? -cluke */
+ /* Per notes from Ole, Maros and Keith, this should all be
+ * superceded with a new api builder soon, so this interface will
+ * be short lived -cluke */
+ s = (void *)mp->src_address;
+ d = (void *)tunnel_details->src_address;
+#if CLIB_ARCH_IS_LITTLE_ENDIAN
+ d[0] = clib_net_to_host_u64(s[1]);
+ d[1] = clib_net_to_host_u64(s[0]);
+#else /* big endian */
+ d[0] = s[0];
+ d[1] = s[1];
+#endif
+
+ s = (void *)mp->dst_address;
+ d = (void *)tunnel_details->dst_address;
+#if CLIB_ARCH_IS_LITTLE_ENDIAN
+ d[0] = clib_net_to_host_u64(s[1]);
+ d[1] = clib_net_to_host_u64(s[0]);
+#else /* big endian */
+ d[0] = s[0];
+ d[1] = s[1];
+#endif
+ } else {
+ u32 *s, *d;
+
+ /* the type changed from a u32 to u8[16] - this does
+ * the same as dst = ntohl(src) with the u32 of a v4
+ * address in the first 32 bits */
+
+ s = (void *)mp->src_address;
+ d = (void *)tunnel_details->src_address;
+ d[0] = ntohl(s[0]);
+
+ s = (void *)mp->dst_address;
+ d = (void *)tunnel_details->dst_address;
+ d[0] = ntohl(s[0]);
+ }
tunnel_details->encap_vrf_id = ntohl(mp->encap_vrf_id);
tunnel_details->vni = ntohl(mp->vni);
tunnel_details->decap_next_index = ntohl(mp->decap_next_index);
+ tunnel_details->is_ipv6 = mp->is_ipv6;
}
/* cleanup handler for RX thread */
diff --git a/vpp-api/java/japi/vppjni.h b/vpp-api/java/japi/vppjni.h
index bd0683ae2c5..bc738367bcf 100644
--- a/vpp-api/java/japi/vppjni.h
+++ b/vpp-api/java/japi/vppjni.h
@@ -124,11 +124,12 @@ typedef struct {
} sw_interface_stats_t;
typedef struct {
- u32 src_address;
- u32 dst_address;
+ u8 src_address[16];
+ u8 dst_address[16];
u32 encap_vrf_id;
u32 vni;
u32 decap_next_index;
+ u8 is_ipv6;
} vxlan_tunnel_details_t;