summaryrefslogtreecommitdiffstats
path: root/src/vnet/tcp/tcp_api.c
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2020-01-03 10:02:32 +0100
committerOle Trøan <otroan@employees.org>2020-01-03 13:14:47 +0000
commit956819afa9a7150a05239432289a881898dae138 (patch)
tree116552f4164f725719f304bec48cb9361047db94 /src/vnet/tcp/tcp_api.c
parent99c7b395e9cb72667b2cb8ffd7c987d42b48ea13 (diff)
tcp: api clenup
Use consistent API types. Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I48f08cc657c28ad1eef50c917a560425137bb70e Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp_api.c')
-rw-r--r--src/vnet/tcp/tcp_api.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/vnet/tcp/tcp_api.c b/src/vnet/tcp/tcp_api.c
index db488e1c52a..ac4314f0e83 100644
--- a/src/vnet/tcp/tcp_api.c
+++ b/src/vnet/tcp/tcp_api.c
@@ -22,6 +22,8 @@
#include <vnet/tcp/tcp.h>
+#include <vnet/ip/ip_types_api.h>
+
#include <vnet/vnet_msg_enum.h>
#define vl_typedefs /* define message structures */
@@ -51,20 +53,28 @@ static void
vl_api_tcp_configure_src_addresses_reply_t *rmp;
u32 vrf_id;
int rv;
+ ip46_address_t first_address, last_address;
+ ip46_type_t fa_af, la_af;
vrf_id = clib_net_to_host_u32 (mp->vrf_id);
- if (mp->is_ipv6)
+ fa_af = ip_address_decode (&mp->first_address, &first_address);
+ la_af = ip_address_decode (&mp->last_address, &last_address);
+
+ if (fa_af != la_af)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto error;
+ }
+
+ if (fa_af == IP46_TYPE_IP6)
rv = tcp_configure_v6_source_address_range
- (vm,
- (ip6_address_t *) mp->first_address,
- (ip6_address_t *) mp->last_address, vrf_id);
+ (vm, &first_address.ip6, &last_address.ip6, vrf_id);
else
rv = tcp_configure_v4_source_address_range
- (vm,
- (ip4_address_t *) mp->first_address,
- (ip4_address_t *) mp->last_address, vrf_id);
+ (vm, &first_address.ip4, &last_address.ip4, vrf_id);
+error:
REPLY_MACRO (VL_API_TCP_CONFIGURE_SRC_ADDRESSES_REPLY);
}