From 4c8a45491dc38a1075881be225df3be14801ffe9 Mon Sep 17 00:00:00 2001 From: Gabriel Ganne Date: Tue, 19 Dec 2017 16:13:44 +0100 Subject: fix kubeproxy some tests * NAT46: fix test cleanup, missing del keyword * NAT66: fix kube-proxy vip, is ipv6 * add some missing kp_put_writer_lock * wipe flowtable after each unit test * Add new cli api: "test kube-proxy flowtable flush" to flushes everything * Call this new cli function after the end of each kube-proxy unit test. * same as commit b3d1b203579226ca5136b9d6a2744577d07cfcc6 for the lb plugin Change-Id: I4146f44841328ec96eb66729e3bae3d40f33e4aa Signed-off-by: Gabriel Ganne --- src/plugins/kubeproxy/kp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/kubeproxy/kp.c') diff --git a/src/plugins/kubeproxy/kp.c b/src/plugins/kubeproxy/kp.c index 1a087e82073..b31b3171d90 100644 --- a/src/plugins/kubeproxy/kp.c +++ b/src/plugins/kubeproxy/kp.c @@ -747,8 +747,10 @@ int kp_vip_add(ip46_address_t *prefix, u8 plen, kp_vip_type_t type, if (ip46_prefix_is_ip4(prefix, plen) && (type != KP_VIP_TYPE_IP4_NAT44) && - (type != KP_VIP_TYPE_IP4_NAT46)) + (type != KP_VIP_TYPE_IP4_NAT46)) { + kp_put_writer_lock(); return VNET_API_ERROR_INVALID_ADDRESS_FAMILY; + } //Allocate @@ -785,8 +787,10 @@ int kp_vip_add(ip46_address_t *prefix, u8 plen, kp_vip_type_t type, //Create maping from nodeport to vip_index key = clib_host_to_net_u16(node_port); entry = hash_get_mem (kpm->nodeport_by_key, &key); - if (entry) + if (entry) { + kp_put_writer_lock(); return VNET_API_ERROR_VALUE_EXIST; + } key_copy = clib_mem_alloc (sizeof (*key_copy)); clib_memcpy (key_copy, &key, sizeof (*key_copy)); -- cgit 1.2.3-korg