X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fstn%2Fstn.c;h=241f7169e8baba41481a70546b20cd5e93af4309;hb=a4ba8da26f053db714d77943c01090e968724273;hp=9368e1c573e51013ab30984dd4c0505152f2a8e0;hpb=ca07219df974d2d3d49cca37400924af848f2389;p=vpp.git diff --git a/src/plugins/stn/stn.c b/src/plugins/stn/stn.c index 9368e1c573e..241f7169e8b 100644 --- a/src/plugins/stn/stn.c +++ b/src/plugins/stn/stn.c @@ -18,9 +18,8 @@ #include #include #include +#include #include -#include -#include stn_main_t stn_main; static vlib_node_registration_t stn_ip4_punt; @@ -141,13 +140,13 @@ stn_ip46_punt_fn (vlib_main_t * vm, vlib_buffer_advance(p0, -sizeof(*eth)); eth = (ethernet_header_t *) vlib_buffer_get_current(p0); if (is_ipv4) - clib_memcpy(eth, &stn_ip4_ethernet_header, sizeof(*eth)); + clib_memcpy_fast(eth, &stn_ip4_ethernet_header, sizeof(*eth)); else - clib_memcpy(eth, &stn_ip6_ethernet_header, sizeof(*eth)); + clib_memcpy_fast(eth, &stn_ip6_ethernet_header, sizeof(*eth)); } else { - vnet_feature_next (0, &next0, p0); + vnet_feature_next (&next0, p0); } if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED)) @@ -261,12 +260,12 @@ stn_init (vlib_main_t * vm) clib_bihash_init_16_8(&stn->rule_by_address_table, "stn addresses", 1024, 1<<20); - clib_memcpy(stn_ip4_ethernet_header.dst_address, stn_hw_addr_dst, 6); - clib_memcpy(stn_ip4_ethernet_header.src_address, stn_hw_addr_local, 6); + clib_memcpy_fast(stn_ip4_ethernet_header.dst_address, stn_hw_addr_dst, 6); + clib_memcpy_fast(stn_ip4_ethernet_header.src_address, stn_hw_addr_local, 6); stn_ip4_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP4); - clib_memcpy(stn_ip6_ethernet_header.dst_address, stn_hw_addr_dst, 6); - clib_memcpy(stn_ip6_ethernet_header.src_address, stn_hw_addr_local, 6); + clib_memcpy_fast(stn_ip6_ethernet_header.dst_address, stn_hw_addr_dst, 6); + clib_memcpy_fast(stn_ip6_ethernet_header.src_address, stn_hw_addr_local, 6); stn_ip6_ethernet_header.type = clib_host_to_net_u16(ETHERNET_TYPE_IP6); return stn_api_init (vm, stn); @@ -279,7 +278,7 @@ VLIB_INIT_FUNCTION (stn_init); /* *INDENT-OFF* */ VLIB_PLUGIN_REGISTER () = { .version = VPP_BUILD_VER, - .description = "VPP Steals the NIC for Container integration", + .description = "VPP Steals the NIC (STN) for Container Integration", }; /* *INDENT-ON* */ @@ -313,10 +312,23 @@ int stn_rule_add_del (stn_rule_add_del_args_t *args) vnet_feature_enable_disable("ip4-punt", "stn-ip4-punt", 0, 1, 0, 0); - udp_punt_unknown(vm, 0, 1); - udp_punt_unknown(vm, 1, 1); - tcp_punt_unknown(vm, 0, 1); - tcp_punt_unknown(vm, 1, 1); + punt_reg_t pr = { + .punt = { + .l4 = { + .af = AF_IP4, + .port = ~0, + .protocol = IP_PROTOCOL_UDP, + }, + }, + .type = PUNT_TYPE_L4, + }; + vnet_punt_add_del (vm, &pr, 1 /* is_add */); + pr.punt.l4.af = AF_IP6; + vnet_punt_add_del (vm, &pr, 1 /* is_add */); + pr.punt.l4.protocol = IP_PROTOCOL_TCP; + vnet_punt_add_del (vm, &pr, 1 /* is_add */); + pr.punt.l4.af = AF_IP4; + vnet_punt_add_del (vm, &pr, 1 /* is_add */); } } @@ -366,9 +378,9 @@ show_stn_rules_fn (vlib_main_t * vm, stn_main_t *stn = &stn_main; u8 *s = 0; stn_rule_t *rule; - pool_foreach(rule, stn->rules, { + pool_foreach (rule, stn->rules) { s = format (s, "- %U\n", format_stn_rule, rule); - }); + } vlib_cli_output(vm, "%v", s);