Compare commits

...

12 Commits

Author SHA1 Message Date
Neale Ranns
235c64f067 FIB memory leaks (VPP-578)
1) vec_free the fe_srcs of a fib_entry_t when the fib_entry_t is itself reed
2) in the load-balance fixup if a drop path is required add this to a new vector of next-hops 'fixed_nhs'. This vector is managed by the load-balance function. The caller continues to manage its own set. The function is now const implying that the caller is safe to assume the next-hops do not change.

Change-Id: I0f29203ee16b9a270f40edf237488fa99ba65320
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-01-04 18:36:46 +00:00
Eyal Bari
cdffe06bab vxlan fix mcast tunnel delete
Change-Id: I15f7ff1e957718e808bfad811895deaacb85d2a3
Signed-off-by: Eyal Bari <ebari@cisco.com>
2017-01-03 20:48:11 +01:00
Filip Tehlar
35dc387354 LISP: fix EID addition (VPP-577)
Change-Id: I32f61ab89598a7911df3d0d8f45de1302af8aa6a
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-01-03 18:23:19 +00:00
Filip Tehlar
c48b58a216 LISP: fix fwd entry addition (VPP-576)
Change-Id: Ibdc9ad21cc53cf0a6d571a3f913038d61d9282a1
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-01-03 18:23:11 +00:00
Andrew Yourtchenko
856ab8aca3 VPP-574: fix the MACIP ACLs blocking ARP traffic
The initial assumption was that the MACIP ACL classifier tables would be applied
after the classification of the traffic based on the ethertype, it turned out
to be untrue, but the fix in the code did not happen.

Add the ethertype to the mask, and the logic to create the ACL classifier tables
permitting the ARP ethertype with the correct payload.

Change-Id: I70236a8a723970c662ddaef6bc9fce93d2e630c1
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-01-03 15:48:39 +00:00
Andrew Yourtchenko
81c09d03d8 VPP-574: fix VPP hang during security group configuration on a suspended VM
The unix connect() in vhost-user driver in VPP is blocking, and
a non-expedient accept() on the other side causes the entire VPP to hang.

Solution: set the nonblocking flag for the socket fd before calling
connect(), and set the socket back to blocking after the accept() succeeds.

Change-Id: I2d535ea9b95a92922d305d79a8d860062c95faf4
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-01-03 15:15:27 +00:00
Matus Fabian
b4f2525866 SNAT: fix out2in ICMP worker lookup
Change-Id: Ifce17a450a06c26670d474b0f774f2504843f221
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2017-01-03 05:07:54 -08:00
Vengada
800429ddef ioam: fix Coverity warning (VPP-570)
Fix Coverity warning of uninitialized variable.
Initialize outer_fib_index to zero (vxlan_gpe_test.c)

Change-Id: If39d48c3906784c43c5af3e9e01ed9a5d5631d6e
Signed-off-by: Vengada <venggovi@cisco.com>
2017-01-02 10:13:43 +00:00
AkshayaNadahalli
e4e9fbbb7c Merging all ioam plugin libraries to single library
Change-Id: I33a646ba45848c7400df4271e4933e28e62c9ad7
Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
2016-12-24 14:11:36 +00:00
Matus Fabian
fe7cdfa629 SNAT: fix 'show snat verbose' bug - format vector as %v
Change-Id: Ia829da43a273c89dee47b32250ab032d992193cd
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2016-12-23 12:04:26 +00:00
Matus Fabian
e73d0a3aab SNAT: Remove the oldest translation fix (VPP-568)
Fixed bug and add test.

Change-Id: I60fbec48abd9d9cb86be1bd1cdbb7d16f9f93c3e
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2016-12-22 02:46:27 -08:00
Damjan Marion
436b319354 Change default branch in .gitreview
Change-Id: I061e4e59698407c9f96930d578cafd552c717861
Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-12-21 19:01:43 +01:00
29 changed files with 327 additions and 250 deletions

View File

@ -2,3 +2,4 @@
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/1701

View File

@ -1044,6 +1044,7 @@ typedef struct
u8 prefix_len;
u32 count;
u32 table_index;
u32 arp_table_index;
} macip_match_type_t;
static u32
@ -1127,6 +1128,34 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
vec_sort_with_function (mvec, match_type_compare);
/* Create the classifier tables */
last_table = ~0;
/* First add ARP tables */
vec_foreach (mt, mvec)
{
int mask_len;
int is6 = mt->is_ipv6;
mt->arp_table_index = ~0;
if (!is6)
{
memset (mask, 0, sizeof (mask));
memcpy (&mask[6], mt->mac_mask, 6);
memset (&mask[12], 0xff, 2); /* ethernet protocol */
memcpy (&mask[14 + 8], mt->mac_mask, 6);
for (i = 0; i < (mt->prefix_len / 8); i++)
mask[14 + 14 + i] = 0xff;
if (mt->prefix_len % 8)
mask[14 + 14 + (mt->prefix_len / 8)] = 0xff - ((1 << (8 - mt->prefix_len % 8)) - 1);
mask_len = ((14 + 14 + ((mt->prefix_len+7) / 8) +
(sizeof (u32x4)-1))/sizeof(u32x4)) * sizeof (u32x4);
acl_classify_add_del_table_small (cm, mask, mask_len, last_table,
(~0 == last_table) ? 0 : ~0, &mt->arp_table_index,
1);
last_table = mt->arp_table_index;
}
}
/* Now add IP[46] tables */
vec_foreach (mt, mvec)
{
int mask_len;
@ -1167,13 +1196,18 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
int l3_src_offs = get_l3_src_offset(is6);
memset (mask, 0, sizeof (mask));
memcpy (&mask[6], a->rules[i].src_mac, 6);
memset (&mask[12], 0xff, 2); /* ethernet protocol */
if (is6)
{
memcpy (&mask[l3_src_offs], &a->rules[i].src_ip_addr.ip6, 16);
mask[12] = 0x86;
mask[13] = 0xdd;
}
else
{
memcpy (&mask[l3_src_offs], &a->rules[i].src_ip_addr.ip4, 4);
mask[12] = 0x08;
mask[13] = 0x00;
}
match_type_index =
macip_find_match_type (mvec, a->rules[i].src_mac_mask,
@ -1183,6 +1217,19 @@ macip_create_classify_tables (acl_main_t * am, u32 macip_acl_index)
vnet_classify_add_del_session (cm, mvec[match_type_index].table_index,
mask, a->rules[i].is_permit ? ~0 : 0, i,
0, action, metadata, 1);
/* add ARP table entry too */
if (!is6 && (mvec[match_type_index].arp_table_index != ~0))
{
memset (mask, 0, sizeof (mask));
memcpy (&mask[6], a->rules[i].src_mac, 6);
mask[12] = 0x08;
mask[13] = 0x06;
memcpy (&mask[14 + 8], a->rules[i].src_mac, 6);
memcpy (&mask[14 + 14], &a->rules[i].src_ip_addr.ip4, 4);
vnet_classify_add_del_session (cm, mvec[match_type_index].arp_table_index,
mask, a->rules[i].is_permit ? ~0 : 0, i,
0, action, metadata, 1);
}
}
return 0;
}

View File

@ -17,20 +17,8 @@ AM_CFLAGS = -Wall
AM_LDFLAGS = -module -shared -avoid-version
########################################
# iOAM Proof of Transit
# iOAM APIs
########################################
ioam_pot_plugin_la_SOURCES = \
ioam/lib-pot/pot_util.c \
ioam/encap/ip6_ioam_pot.c \
ioam/lib-pot/pot_util.h \
ioam/lib-pot/math64.h \
ioam/lib-pot/pot_api.c
BUILT_SOURCES = \
ioam/lib-pot/pot.api.h \
ioam/lib-pot/pot.api.json
SUFFIXES = .api.h .api
%.api.h: %.api
@ -39,129 +27,135 @@ SUFFIXES = .api.h .api
| vppapigen --input - --output $@ --show-name $@
%.api.json: %.api
@echo " JSON APIGEN " $@ ; \
@echo " JSON APIGEN " $@ ; \
mkdir -p `dirname $@` ; \
$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
$(CC) $(CPPFLAGS) -E -P -C -x c $^ \
| vppapigen --input - --json $@
apidir = $(prefix)/ioam/
api_DATA = \
ioam/lib-pot/pot.api.json \
api_DATA = \
ioam/lib-pot/pot.api.json \
ioam/lib-trace/trace.api.json \
ioam/export/ioam_export.api.json
noinst_HEADERS = \
ioam/lib-pot/pot_all_api_h.h \
ioam/lib-pot/pot_msg_enum.h \
ioam/lib-pot/pot.api.h \
ioam/lib-pot/pot_util.h \
ioam/lib-pot/math64.h
########################################
# iOAM Proof of Transit
########################################
ioam_pot_test_plugin_la_SOURCES = \
IOAM_POT_SRC = \
ioam/lib-pot/pot_util.c \
ioam/encap/ip6_ioam_pot.c \
ioam/lib-pot/pot_util.h \
ioam/lib-pot/math64.h \
ioam/lib-pot/pot_api.c
IOAM_POT_BUILT_SRC = \
ioam/lib-pot/pot.api.h \
ioam/lib-pot/pot.api.json
IOAM_POT_NOINST_HDR = \
ioam/lib-pot/pot_all_api_h.h \
ioam/lib-pot/pot_msg_enum.h \
ioam/lib-pot/pot.api.h \
ioam/lib-pot/pot_util.h \
ioam/lib-pot/math64.h
ioam_pot_test_plugin_la_SOURCES = \
ioam/lib-pot/pot_test.c \
ioam/lib-pot/pot_plugin.api.h
vppapitestpluginsdir = ${libdir}/vpp_api_test_plugins
vpppluginsdir = ${libdir}/vpp_plugins
vppapitestplugins_LTLIBRARIES = ioam_pot_test_plugin.la
vppplugins_LTLIBRARIES = ioam_pot_plugin.la
########################################
# iOAM trace export for IPv6
########################################
ioam_export_plugin_la_SOURCES = \
ioam/export/ioam_export.c \
ioam/export/node.c \
ioam/export/ioam_export.api.h \
ioam/export/ioam_export_thread.c
IOAM_EXPORT_SRC = \
ioam/export/ioam_export.c \
ioam/export/node.c \
ioam/export/ioam_export.api.h \
ioam/export/ioam_export_thread.c
BUILT_SOURCES += \
IOAM_EXPORT_BUILT_SRC = \
ioam/export/ioam_export.api.h \
ioam/export/ioam_export.api.json
noinst_HEADERS += \
ioam/export/ioam_export_all_api_h.h \
ioam/export/ioam_export_msg_enum.h \
ioam/export/ioam_export.api.h
IOAM_EXPORT_NOINST_HDR = \
ioam/export/ioam_export_all_api_h.h \
ioam/export/ioam_export_msg_enum.h \
ioam/export/ioam_export.api.h
ioam_export_test_plugin_la_SOURCES = \
ioam/export/ioam_export_test.c \
ioam/export/ioam_export_plugin.api.h
ioam_export_test_plugin_la_SOURCES = \
ioam/export/ioam_export_test.c \
ioam/export/ioam_export_plugin.api.h
vppapitestplugins_LTLIBRARIES += ioam_export_test_plugin.la
vppplugins_LTLIBRARIES += ioam_export_plugin.la
########################################
# iOAM Trace
########################################
libioam_trace_plugin_la_SOURCES = \
IOAM_TRACE_SRC = \
ioam/lib-trace/trace_util.c \
ioam/encap/ip6_ioam_trace.c \
ioam/lib-trace/trace_util.h \
ioam/lib-trace/trace_api.c
BUILT_SOURCES += \
IOAM_TRACE_BUILT_SRC = \
ioam/lib-trace/trace.api.h \
ioam/lib-trace/trace.api.json
noinst_HEADERS += \
IOAM_TRACE_NOINST_HDR = \
ioam/export/ioam_export_all_api_h.h \
ioam/lib-trace/trace_all_api_h.h \
ioam/lib-trace/trace_msg_enum.h \
ioam/lib-trace/trace.api.h \
ioam/lib-trace/trace_all_api_h.h \
ioam/lib-trace/trace_msg_enum.h \
ioam/lib-trace/trace.api.h \
ioam/lib-trace/trace_util.h
ioam_trace_test_plugin_la_SOURCES = \
ioam/lib-trace/trace_test.c \
ioam/lib-trace/trace_test.c \
ioam/lib-trace/trace_plugin.api.h
vppapitestplugins_LTLIBRARIES += ioam_trace_test_plugin.la
vppplugins_LTLIBRARIES += libioam_trace_plugin.la
########################################
# VxLAN-GPE
########################################
libioam_vxlan_gpe_plugin_la_SOURCES = \
ioam/lib-vxlan-gpe/ioam_encap.c \
ioam/lib-vxlan-gpe/ioam_decap.c \
ioam/lib-vxlan-gpe/ioam_transit.c \
ioam/lib-vxlan-gpe/ioam_pop.c \
ioam/lib-vxlan-gpe/vxlan_gpe_api.c \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c \
ioam/export-vxlan-gpe/vxlan_gpe_node.c \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h\
IOAM_VXLAN_GPE_SRC = \
ioam/lib-vxlan-gpe/ioam_encap.c \
ioam/lib-vxlan-gpe/ioam_decap.c \
ioam/lib-vxlan-gpe/ioam_transit.c \
ioam/lib-vxlan-gpe/ioam_pop.c \
ioam/lib-vxlan-gpe/vxlan_gpe_api.c \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam.c \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.c \
ioam/export-vxlan-gpe/vxlan_gpe_node.c \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_thread.c
BUILT_SOURCES += \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
ioam/lib-vxlan-gpe/vxlan_gpe.api.json \
IOAM_VXLAN_GPE_BUILT_SRC = \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
ioam/lib-vxlan-gpe/vxlan_gpe.api.json \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.json
noinst_HEADERS += \
ioam/export/ioam_export_all_api_h.h \
ioam/lib-vxlan-gpe/vxlan_gpe_all_api_h.h \
ioam/lib-vxlan-gpe/vxlan_gpe_msg_enum.h \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_util.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_packet.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_all_api_h.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_msg_enum.h \
IOAM_VXLAN_GPE_NOINST_HDR = \
ioam/export/ioam_export_all_api_h.h \
ioam/lib-vxlan-gpe/vxlan_gpe_all_api_h.h \
ioam/lib-vxlan-gpe/vxlan_gpe_msg_enum.h \
ioam/lib-vxlan-gpe/vxlan_gpe.api.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_util.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam_packet.h \
ioam/lib-vxlan-gpe/vxlan_gpe_ioam.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_all_api_h.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_msg_enum.h \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export.api.h
ioam_vxlan_gpe_test_plugin_la_SOURCES = \
ioam_vxlan_gpe_test_plugin_la_SOURCES = \
ioam/lib-vxlan-gpe/vxlan_gpe_test.c \
ioam/lib-vxlan-gpe/vxlan_gpe_plugin.api.h
libioam_vxlan_gpe_plugin_la_LIBADD = libioam_trace_plugin.la
vppapitestplugins_LTLIBRARIES += ioam_vxlan_gpe_test_plugin.la
vppplugins_LTLIBRARIES += libioam_vxlan_gpe_plugin.la
vxlan_gpe_ioam_export_test_plugin_la_SOURCES = \
ioam/export-vxlan-gpe/vxlan_gpe_ioam_export_test.c \
@ -170,26 +164,53 @@ vxlan_gpe_ioam_export_test_plugin_la_SOURCES = \
vppapitestplugins_LTLIBRARIES += vxlan_gpe_ioam_export_test_plugin.la
########################################
# iOAM E2E plugin
# iOAM E2E
########################################
ioam_e2e_plugin_la_SOURCES = \
IOAM_E2E_SRC = \
ioam/encap/ip6_ioam_e2e.c \
ioam/encap/ip6_ioam_seqno.c \
ioam/encap/ip6_ioam_seqno_analyse.c
noinst_HEADERS += \
ioam/encap/ip6_ioam_e2e.h \
IOAM_E2E_BUILT_SRC = \
ioam/encap/ip6_ioam_e2e.h \
ioam/encap/ip6_ioam_seqno.h
vppplugins_LTLIBRARIES += ioam_e2e_plugin.la
########################################
# iOAM plugins
########################################
vppapitestpluginsdir = ${libdir}/vpp_api_test_plugins
vpppluginsdir = ${libdir}/vpp_plugins
ioam_plugin_la_SOURCES = \
$(IOAM_POT_SRC) \
$(IOAM_EXPORT_SRC) \
$(IOAM_TRACE_SRC) \
$(IOAM_VXLAN_GPE_SRC) \
$(IOAM_E2E_SRC)
BUILT_SOURCES = \
$(IOAM_POT_BUILT_SRC) \
$(IOAM_EXPORT_BUILT_SRC) \
$(IOAM_TRACE_BUILT_SRC) \
$(IOAM_VXLAN_GPE_BUILT_SRC) \
$(IOAM_E2E_BUILT_SRC)
noinst_HEADERS = \
$(IOAM_POT_NOINST_HDR) \
$(IOAM_EXPORT_NOINST_HDR) \
$(IOAM_TRACE_NOINST_HDR) \
$(IOAM_VXLAN_GPE_NOINST_HDR) \
$(IOAM_E2E_NOINST_HDR)
vppplugins_LTLIBRARIES = ioam_plugin.la
# Remove *.la files
install-data-hook:
@(cd $(vpppluginsdir) && $(RM) $(vppplugins_LTLIBRARIES))
@(cd $(vppapitestpluginsdir) && $(RM) $(vppapitestplugins_LTLIBRARIES))
#
# Java code generation
#

View File

@ -25,8 +25,6 @@
#include <vppinfra/elog.h>
#include <vnet/ip/ip6_hop_by_hop.h>
#include <vnet/plugin/plugin.h>
#include "ip6_ioam_e2e.h"
ioam_e2e_main_t ioam_e2e_main;
@ -166,23 +164,6 @@ VLIB_CLI_COMMAND (ioam_show_e2e_cmd, static) = {
.function = ioam_show_e2e_cmd_fn,
};
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
clib_error_t * error = 0;
ioam_e2e_main.vlib_main = vm;
ioam_e2e_main.vnet_main = h->vnet_main;
return error;
}
/*
* Init handler E2E headet handling.
* Init hanlder registers encap, decap, trace and Rewrite handlers.
@ -222,6 +203,9 @@ ioam_e2e_init (vlib_main_t * vm)
"HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE Flow handler failed"));
}
ioam_e2e_main.vlib_main = vm;
ioam_e2e_main.vnet_main = vnet_get_main();
return (0);
}

View File

@ -24,6 +24,7 @@
#include <vppinfra/hash.h>
#include <vppinfra/error.h>
#include <vppinfra/elog.h>
#include <vnet/plugin/plugin.h>
#include <ioam/lib-trace/trace_util.h>
@ -348,6 +349,18 @@ VLIB_CLI_COMMAND (ip6_show_ioam_trace_cmd, static) = {
};
/* *INDENT-ON* */
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
return 0;
}
static clib_error_t *
ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm)

View File

@ -76,7 +76,8 @@ typedef struct
ioam_export_main_t ioam_export_main;
ioam_export_main_t vxlan_gpe_ioam_export_main;
vlib_node_registration_t export_node;
extern vlib_node_registration_t export_node;
extern vlib_node_registration_t vxlan_export_node;
#define DEFAULT_EXPORT_SIZE (3 * CLIB_CACHE_LINE_BYTES)
/*

View File

@ -92,7 +92,7 @@ vxlan_gpe_ioam_export_enable_disable (ioam_export_main_t * em,
ip4_address_t * src_address)
{
vlib_main_t *vm = em->vlib_main;
u32 node_index = export_node.index;
u32 node_index = vxlan_export_node.index;
vlib_node_t *vxlan_gpe_decap_ioam_node = NULL;
if (is_disable == 0)

View File

@ -40,7 +40,7 @@ format_export_trace (u8 * s, va_list * args)
return s;
}
vlib_node_registration_t export_node;
vlib_node_registration_t vxlan_export_node;
#define foreach_export_error \
_(RECORDED, "Packets recorded for export")
@ -137,7 +137,7 @@ vxlan_gpe_export_node_fn (vlib_main_t * vm,
* Node for VXLAN-GPE export
*/
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (export_node) =
VLIB_REGISTER_NODE (vxlan_export_node) =
{
.function = vxlan_gpe_export_node_fn,
.name = "vxlan-gpe-ioam-export",

View File

@ -81,26 +81,6 @@ do { \
#define foreach_ioam_export_plugin_api_msg \
_(IOAM_EXPORT_IP6_ENABLE_DISABLE, ioam_export_ip6_enable_disable)
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
ioam_export_main_t *em = &ioam_export_main;
clib_error_t *error = 0;
em->vlib_main = vm;
em->vnet_main = h->vnet_main;
return error;
}
/* Action function shared between message handler and debug CLI */
int
@ -250,6 +230,9 @@ ioam_export_init (vlib_main_t * vm)
u32 node_index = export_node.index;
vlib_node_t *ip6_hbyh_node = NULL;
em->vlib_main = vm;
em->vnet_main = vnet_get_main ();
name = format (0, "ioam_export_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */

View File

@ -213,26 +213,6 @@ static void vl_api_pot_profile_del_t_handler
REPLY_MACRO(VL_API_POT_PROFILE_DEL_REPLY);
}
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
pot_main_t * sm = &pot_main;
clib_error_t * error = 0;
sm->vlib_main = vm;
sm->vnet_main = h->vnet_main;
return error;
}
/* Set up the API message handling tables */
static clib_error_t *
pot_plugin_api_hookup (vlib_main_t *vm)
@ -273,6 +253,10 @@ static clib_error_t * pot_init (vlib_main_t * vm)
bzero(sm, sizeof(pot_main));
(void)pot_util_init();
sm->vlib_main = vm;
sm->vnet_main = vnet_get_main();
name = format (0, "ioam_pot_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */

View File

@ -165,25 +165,6 @@ static void vl_api_trace_profile_show_config_t_handler
}
}
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
trace_main_t *sm = &trace_main;
clib_error_t *error = 0;
sm->vlib_main = vm;
sm->vnet_main = h->vnet_main;
return error;
}
/* Set up the API message handling tables */
static clib_error_t *
trace_plugin_api_hookup (vlib_main_t * vm)
@ -225,6 +206,10 @@ trace_init (vlib_main_t * vm)
bzero (sm, sizeof (trace_main));
(void) trace_util_init ();
sm->vlib_main = vm;
sm->vnet_main = vnet_get_main ();
name = format (0, "ioam_trace_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */

View File

@ -284,28 +284,6 @@ static void vl_api_vxlan_gpe_ioam_transit_disable_t_handler
VXLAN_GPE_REPLY_MACRO (VL_API_VXLAN_GPE_IOAM_TRANSIT_DISABLE_REPLY);
}
/*
* This routine exists to convince the vlib plugin framework that
* we haven't accidentally copied a random .dll into the plugin directory.
*
* Also collects global variable pointers passed from the vpp engine
*/
clib_error_t *
vlib_plugin_register (vlib_main_t * vm, vnet_plugin_handoff_t * h,
int from_early_init)
{
vxlan_gpe_ioam_main_t *sm = &vxlan_gpe_ioam_main;
clib_error_t *error = 0;
sm->vlib_main = vm;
sm->vnet_main = h->vnet_main;
sm->unix_time_0 = (u32) time (0); /* Store starting time */
sm->vlib_time_0 = vlib_time_now (vm);
return error;
}
/* Set up the API message handling tables */
static clib_error_t *
vxlan_gpe_plugin_api_hookup (vlib_main_t * vm)
@ -337,6 +315,11 @@ vxlan_gpe_init (vlib_main_t * vm)
vlib_node_t *vxlan_gpe_decap_node = NULL;
uword next_node = 0;
sm->vlib_main = vm;
sm->vnet_main = vnet_get_main ();
sm->unix_time_0 = (u32) time (0); /* Store starting time */
sm->vlib_time_0 = vlib_time_now (vm);
name = format (0, "ioam_vxlan_gpe_%08x%c", api_version, 0);
/* Ask for a correctly-sized block of API message decode slots */

View File

@ -466,7 +466,7 @@ api_vxlan_gpe_ioam_transit_disable (vat_main_t * vam)
ip6_address_t local6;
u8 ipv4_set = 0, ipv6_set = 0;
u8 local_set = 0;
u32 outer_fib_index;
u32 outer_fib_index = 0;
f64 timeout;

View File

@ -203,7 +203,7 @@ static u32 slow_path (snat_main_t *sm, vlib_buffer_t *b0,
/* Get the session */
s = pool_elt_at_index (sm->per_thread_data[cpu_index].sessions,
session_index);
} while (!snat_is_session_static (s));
} while (snat_is_session_static (s));
/* Remove in2out, out2in keys */
kv0.key = s->in2out.as_u64;

View File

@ -872,6 +872,13 @@ snat_out2in_worker_handoff_fn (vlib_main_t * vm,
key0.port = udp0->dst_port;
key0.fib_index = rx_fib_index0;
if (PREDICT_FALSE(ip0->protocol == IP_PROTOCOL_ICMP))
{
icmp46_header_t * icmp0 = (icmp46_header_t *) udp0;
icmp_echo_header_t *echo0 = (icmp_echo_header_t *)(icmp0+1);
key0.port = echo0->identifier;
}
kv0.key = key0.as_u64;
/* Ever heard of of the "user" before? */

View File

@ -974,13 +974,13 @@ vl_api_snat_show_config_t_handler
REPLY_MACRO2(VL_API_SNAT_SHOW_CONFIG_REPLY,
({
rmp->translation_buckets = htons (sm->translation_buckets);
rmp->translation_memory_size = htons (sm->translation_memory_size);
rmp->user_buckets = htons (sm->user_buckets);
rmp->user_memory_size = htons (sm->user_memory_size);
rmp->max_translations_per_user = htons (sm->max_translations_per_user);
rmp->outside_vrf_id = htons (sm->outside_vrf_id);
rmp->inside_vrf_id = htons (sm->inside_vrf_id);
rmp->translation_buckets = htonl (sm->translation_buckets);
rmp->translation_memory_size = htonl (sm->translation_memory_size);
rmp->user_buckets = htonl (sm->user_buckets);
rmp->user_memory_size = htonl (sm->user_memory_size);
rmp->max_translations_per_user = htonl (sm->max_translations_per_user);
rmp->outside_vrf_id = htonl (sm->outside_vrf_id);
rmp->inside_vrf_id = htonl (sm->inside_vrf_id);
rmp->static_mapping_only = sm->static_mapping_only;
rmp->static_mapping_connection_tracking =
sm->static_mapping_connection_tracking;
@ -1860,7 +1860,7 @@ show_snat_command_fn (vlib_main_t * vm,
({
s = format (s, " %d", j);
}));
vlib_cli_output (vm, " %d busy ports:%s", ap->busy_ports, s);
vlib_cli_output (vm, " %d busy ports:%v", ap->busy_ports, s);
}
}
@ -1873,7 +1873,7 @@ show_snat_command_fn (vlib_main_t * vm,
{
vlib_worker_thread_t *w =
vlib_worker_threads + *worker + sm->first_worker_index;
vlib_cli_output (vm, " %s", w->name);
vlib_cli_output (vm, " %v", w->name);
}
}
}
@ -1924,7 +1924,7 @@ show_snat_command_fn (vlib_main_t * vm,
continue;
vlib_worker_thread_t *w = vlib_worker_threads + j;
vlib_cli_output (vm, "Thread %d (%s at lcore %u):", j, w->name,
vlib_cli_output (vm, "Thread %d (%v at lcore %u):", j, w->name,
w->lcore_id);
vlib_cli_output (vm, " %d list pool elements",
pool_elts (tsm->list_pool));

View File

@ -589,6 +589,33 @@ class TestSNAT(VppTestCase):
self.logger.error(ppp("Unexpected or invalid packet:"), p)
raise
def test_max_translations_per_user(self):
""" MAX translations per user - recycle the least recently used """
self.snat_add_address(self.snat_addr)
self.vapi.snat_interface_add_del_feature(self.pg0.sw_if_index)
self.vapi.snat_interface_add_del_feature(self.pg1.sw_if_index,
is_inside=0)
# get maximum number of translations per user
snat_config = self.vapi.snat_show_config()
# send more than maximum number of translations per user packets
pkts_num = snat_config.max_translations_per_user + 5
pkts = []
for port in range(0, pkts_num):
p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4) /
TCP(sport=1025 + port))
pkts.append(p)
self.pg0.add_stream(pkts)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
# verify number of translated packet
capture = self.pg1.get_capture()
self.assertEqual(pkts_num, len(capture))
def tearDown(self):
super(TestSNAT, self).tearDown()
if not self.vpp_dead:

View File

@ -842,6 +842,12 @@ class VppPapiProvider(object):
"""
return self.api(self.papi.snat_static_mapping_dump, {})
def snat_show_config(self):
"""Show S-NAT config
:return: S-NAT config parameters
"""
return self.api(self.papi.snat_show_config, {})
def control_ping(self):
self.api(self.papi.control_ping)

View File

@ -2325,9 +2325,13 @@ vhost_user_process (vlib_main_t * vm,
strncpy (sun.sun_path, (char *) vui->sock_filename,
sizeof (sun.sun_path) - 1);
/* Avoid hanging VPP if the other end does not accept */
fcntl(sockfd, F_SETFL, O_NONBLOCK);
if (connect (sockfd, (struct sockaddr *) &sun,
sizeof (struct sockaddr_un)) == 0)
{
/* Set the socket to blocking as it was before */
fcntl(sockfd, F_SETFL, 0);
vui->sock_errno = 0;
template.file_descriptor = sockfd;
template.private_data =

View File

@ -279,8 +279,8 @@ load_balance_get_bucket (index_t lbi,
}
static int
next_hop_sort_by_weight (load_balance_path_t * n1,
load_balance_path_t * n2)
next_hop_sort_by_weight (const load_balance_path_t * n1,
const load_balance_path_t * n2)
{
return ((int) n1->path_weight - (int) n2->path_weight);
}
@ -289,7 +289,7 @@ next_hop_sort_by_weight (load_balance_path_t * n1,
with weights corresponding to the number of adjacencies for each next hop.
Returns number of adjacencies in block. */
u32
ip_multipath_normalize_next_hops (load_balance_path_t * raw_next_hops,
ip_multipath_normalize_next_hops (const load_balance_path_t * raw_next_hops,
load_balance_path_t ** normalized_next_hops,
u32 *sum_weight_in,
f64 multipath_next_hop_error_tolerance)
@ -409,23 +409,25 @@ done:
}
static load_balance_path_t *
load_balance_multipath_next_hop_fixup (load_balance_path_t *nhs,
load_balance_multipath_next_hop_fixup (const load_balance_path_t *nhs,
dpo_proto_t drop_proto)
{
if (0 == vec_len(nhs))
{
load_balance_path_t *nh;
load_balance_path_t *new_nhs = NULL, *nh;
/*
* we need something for the load-balance. so use the drop
*/
vec_add2(nhs, nh, 1);
vec_add2(new_nhs, nh, 1);
nh->path_weight = 1;
dpo_copy(&nh->path_dpo, drop_dpo_get(drop_proto));
return (new_nhs);
}
return (nhs);
return (NULL);
}
/*
@ -467,11 +469,11 @@ load_balance_set_n_buckets (load_balance_t *lb,
void
load_balance_multipath_update (const dpo_id_t *dpo,
load_balance_path_t * raw_next_hops,
const load_balance_path_t * raw_nhs,
load_balance_flags_t flags)
{
u32 sum_of_weights,n_buckets, ii;
load_balance_path_t * nh, * nhs;
load_balance_path_t *nh, *nhs, *fixed_nhs;
u32 sum_of_weights, n_buckets, ii;
index_t lbmi, old_lbmi;
load_balance_t *lb;
dpo_id_t *tmp_dpo;
@ -480,16 +482,16 @@ load_balance_multipath_update (const dpo_id_t *dpo,
ASSERT(DPO_LOAD_BALANCE == dpo->dpoi_type);
lb = load_balance_get(dpo->dpoi_index);
raw_next_hops =
load_balance_multipath_next_hop_fixup(raw_next_hops,
lb->lb_proto);
fixed_nhs = load_balance_multipath_next_hop_fixup(raw_nhs, lb->lb_proto);
n_buckets =
ip_multipath_normalize_next_hops(raw_next_hops,
ip_multipath_normalize_next_hops((NULL == fixed_nhs ?
raw_nhs :
fixed_nhs),
&nhs,
&sum_of_weights,
multipath_next_hop_error_tolerance);
ASSERT (n_buckets >= vec_len (raw_next_hops));
ASSERT (n_buckets >= vec_len (raw_nhs));
/*
* Save the old load-balance map used, and get a new one if required.
@ -694,6 +696,7 @@ load_balance_multipath_update (const dpo_id_t *dpo,
dpo_reset(&nh->path_dpo);
}
vec_free(nhs);
vec_free(fixed_nhs);
load_balance_map_unlock(old_lbmi);
}

View File

@ -159,7 +159,7 @@ extern index_t load_balance_create(u32 num_buckets,
flow_hash_config_t fhc);
extern void load_balance_multipath_update(
const dpo_id_t *dpo,
load_balance_path_t * raw_next_hops,
const load_balance_path_t * raw_next_hops,
load_balance_flags_t flags);
extern void load_balance_set_bucket(index_t lbi,

View File

@ -230,6 +230,7 @@ fib_entry_last_lock_gone (fib_node_t *node)
ASSERT(0 == vec_len(fib_entry->fe_delegates));
vec_free(fib_entry->fe_delegates);
vec_free(fib_entry->fe_srcs);
pool_put(fib_entry_pool, fib_entry);
}

View File

@ -382,6 +382,14 @@ fib_entry_src_mk_lb (fib_entry_t *fib_entry,
.fct = fct,
};
/*
* As an optimisation we allocate the vector of next-hops to be sized
* equal to the maximum nuber of paths we will need, which is also the
* most likely number we will need, since in most cases the paths are 'up'.
*/
vec_validate(ctx.next_hops, fib_path_list_get_n_paths(esrc->fes_pl));
vec_reset_length(ctx.next_hops);
lb_proto = fib_proto_to_dpo(fib_entry->fe_prefix.fp_proto);
fib_path_list_walk(esrc->fes_pl,

View File

@ -365,10 +365,10 @@ fib_path_list_mk_lb (fib_path_list_t *path_list,
fib_forward_chain_type_t fct,
dpo_id_t *dpo)
{
load_balance_path_t *hash_key;
load_balance_path_t *nhs;
fib_node_index_t *path_index;
hash_key = NULL;
nhs = NULL;
if (!dpo_id_is_valid(dpo))
{
@ -388,21 +388,20 @@ fib_path_list_mk_lb (fib_path_list_t *path_list,
*/
vec_foreach (path_index, path_list->fpl_paths)
{
hash_key = fib_path_append_nh_for_multipath_hash(
*path_index,
fct,
hash_key);
nhs = fib_path_append_nh_for_multipath_hash(*path_index,
fct,
nhs);
}
/*
* Path-list load-balances, which if used, would be shared and hence
* never need a load-balance map.
*/
load_balance_multipath_update(dpo, hash_key, LOAD_BALANCE_FLAG_NONE);
load_balance_multipath_update(dpo, nhs, LOAD_BALANCE_FLAG_NONE);
FIB_PATH_LIST_DBG(path_list, "mk lb: %d", dpo->dpoi_index);
vec_free(hash_key);
vec_free(nhs);
}
/**
@ -591,6 +590,17 @@ fib_path_list_resolve (fib_path_list_t *path_list)
return (path_list);
}
u32
fib_path_list_get_n_paths (fib_node_index_t path_list_index)
{
fib_path_list_t *path_list;
path_list = fib_path_list_get(path_list_index);
return (vec_len(path_list->fpl_paths));
}
u32
fib_path_list_get_resolving_interface (fib_node_index_t path_list_index)
{

View File

@ -104,6 +104,8 @@ extern fib_node_index_t fib_path_list_copy_and_path_remove(
fib_node_index_t pl_index,
fib_path_list_flags_t flags,
const fib_route_path_t *path);
extern u32 fib_path_list_get_n_paths(fib_node_index_t pl_index);
extern void fib_path_list_contribute_forwarding(fib_node_index_t path_list_index,
fib_forward_chain_type_t type,
dpo_id_t *dpo);

View File

@ -512,7 +512,7 @@ dp_add_fwd_entry (lisp_cp_main_t * lcm, u32 src_map_index, u32 dst_map_index)
pool_get (lcm->fwd_entry_pool, fe);
fe->locator_pairs = a->locator_pairs;
gid_address_copy (&fe->reid, &a->rmt_eid);
gid_address_copy (&fe->leid, &src_map->eid);
gid_address_copy (&fe->leid, &a->lcl_eid);
fe->is_src_dst = is_src_dst;
hash_set (lcm->fwd_entry_by_mapping_index, dst_map_index,
fe - lcm->fwd_entry_pool);

View File

@ -1440,8 +1440,11 @@ gid_address_cmp (gid_address_t * a1, gid_address_t * a2)
return -1;
if (gid_address_vni (a1) != gid_address_vni (a2))
return -1;
if (gid_address_vni_mask (a1) != gid_address_vni_mask (a2))
return -1;
/* TODO vni mask is not supported, disable comparing for now
if (gid_address_vni_mask (a1) != gid_address_vni_mask (a2))
return -1;
*/
switch (gid_address_type (a1))
{

View File

@ -296,7 +296,7 @@ vtep_addr_ref(ip46_address_t *ip)
return 1; /* always create */
uword *pvtep = hash_get (vxlan_main.vtep4, ip->ip4.as_u32);
if (pvtep)
return ++pvtep[0];
return ++(*pvtep);
hash_set (vxlan_main.vtep4, ip->ip4.as_u32, 1);
return 1;
}
@ -308,9 +308,12 @@ vtep_addr_unref(ip46_address_t *ip)
return 0; /* alwways destroy */
uword *pvtep = hash_get (vxlan_main.vtep4, ip->ip4.as_u32);
ASSERT(pvtep);
if (!(--pvtep[0]))
if (--(*pvtep) == 0)
{
hash_unset (vxlan_main.vtep4, ip->ip4.as_u32);
return pvtep[0];
return 0;
}
return *pvtep;
}
static
@ -330,13 +333,13 @@ mcast_ep_add(mcast_remote_t * new_ep)
pool_get_aligned (vxlan_main.mcast_eps, ep, CLIB_CACHE_LINE_BYTES);
*ep = *new_ep;
hash_set_mem (vxlan_main.mcast_ep_by_ip, &ep->ip, ep - vxlan_main.mcast_eps);
hash_set_mem (vxlan_main.mcast_ep_by_ip, ep->ip, ep - vxlan_main.mcast_eps);
}
static void
mcast_ep_remove(mcast_remote_t * ep)
{
hash_unset_mem (vxlan_main.mcast_ep_by_ip, &ep->ip);
hash_unset_mem (vxlan_main.mcast_ep_by_ip, ep->ip);
pool_put (vxlan_main.mcast_eps, ep);
}
@ -397,17 +400,6 @@ int vnet_vxlan_add_del_tunnel
#define _(x) t->x = a->x;
foreach_copy_field;
#undef _
/* copy the key */
if (is_ip6)
{
t->key6 = clib_mem_alloc (sizeof(vxlan6_tunnel_key_t));
clib_memcpy (t->key6, &key6, sizeof(key6));
}
else
{
t->key4 = 0; /* not yet used */
}
if (!is_ip6)
rv = vxlan4_rewrite (t);
@ -420,10 +412,18 @@ int vnet_vxlan_add_del_tunnel
return rv;
}
if (!is_ip6)
hash_set (vxm->vxlan4_tunnel_by_key, key4.as_u64, t - vxm->tunnels);
/* copy the key */
if (is_ip6)
{
t->key6 = clib_mem_alloc (sizeof(vxlan6_tunnel_key_t));
clib_memcpy (t->key6, &key6, sizeof(key6));
hash_set_mem (vxm->vxlan6_tunnel_by_key, t->key6, t - vxm->tunnels);
}
else
hash_set_mem (vxm->vxlan6_tunnel_by_key, t->key6, t - vxm->tunnels);
{
t->key4 = 0; /* not yet used */
hash_set (vxm->vxlan4_tunnel_by_key, key4.as_u64, t - vxm->tunnels);
}
vnet_hw_interface_t * hi;
if (vec_len (vxm->free_vxlan_tunnel_hw_if_indices) > 0)
@ -509,8 +509,10 @@ int vnet_vxlan_add_del_tunnel
ip46_multicast_ethernet_address(mcast_mac, &t->dst);
receive_dpo_add_or_lock(dproto, ~0, NULL, &dpo);
ip46_address_t * dst_copy = clib_mem_alloc (sizeof(ip46_address_t));
*dst_copy = t->dst;
mcast_remote_t new_ep = {
.ip = t->dst,
.ip = dst_copy,
.mcast_adj_index = adj_rewrite_add_and_lock
(fp, fib_proto_to_link(fp), a->mcast_sw_if_index, mcast_mac),
/* Add VRF local mcast adj. */
@ -559,16 +561,18 @@ int vnet_vxlan_add_del_tunnel
if (!ip46_address_is_multicast(&t->dst))
{
vtep_addr_unref(&a->src);
vtep_addr_unref(&t->src);
fib_entry_child_remove(t->fib_entry_index, t->sibling_index);
fib_table_entry_delete_index(t->fib_entry_index, FIB_SOURCE_RR);
}
else if (vtep_addr_unref(&t->dst) == 0)
{
mcast_remote_t* ep = mcast_ep_get(&t->dst);
mcast_remote_t * ep = mcast_ep_get(&t->dst);
ip46_address_t * ip = ep->ip;
adj_unlock(ep->mcast_adj_index);
fib_table_entry_delete_index(ep->fib_entry_index, FIB_SOURCE_SPECIAL);
mcast_ep_remove(ep);
clib_mem_free(ip);
}
fib_node_deinit(&t->node);

View File

@ -138,7 +138,7 @@ typedef enum {
} vxlan_input_error_t;
typedef struct {
ip46_address_t ip;
ip46_address_t * ip;
fib_node_index_t fib_entry_index;
adj_index_t mcast_adj_index;
} mcast_remote_t;