X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fct6%2Fct6_in2out.c;h=ed7d59060f1acf19ddd8af843ac11275ac41c26e;hb=0426185e65f4f1e001e62375c819fc8ed49a544d;hp=b28d349dd2979440615cd37b7417fb5247f38451;hpb=a55df1081762b4e40698ef7d9196551851be646a;p=vpp.git diff --git a/src/plugins/ct6/ct6_in2out.c b/src/plugins/ct6/ct6_in2out.c index b28d349dd29..ed7d59060f1 100644 --- a/src/plugins/ct6/ct6_in2out.c +++ b/src/plugins/ct6/ct6_in2out.c @@ -90,11 +90,11 @@ ct6_create_or_recycle_session (ct6_main_t * cmp, s0 = pool_elt_at_index (cmp->sessions[my_thread_index], cmp->last_index[my_thread_index]); - if (s0->expires < now) + if (CLIB_DEBUG > 0 && s0->expires < now) clib_warning ("session %d expired %.2f time now %.2f", s0 - cmp->sessions[my_thread_index], s0->expires, now); - if (pool_elts (cmp->sessions[my_thread_index]) >= + if (CLIB_DEBUG > 0 && pool_elts (cmp->sessions[my_thread_index]) >= cmp->max_sessions_per_worker) clib_warning ("recycle session %d have %d max %d", s0 - cmp->sessions[my_thread_index], @@ -123,7 +123,7 @@ ct6_create_or_recycle_session (ct6_main_t * cmp, *createp += 1; } - /* Sesison setup */ + /* Session setup */ memset (s0, 0, sizeof (*s0)); clib_memcpy_fast (s0, kvpp, sizeof (ct6_session_key_t)); s0->thread_index = my_thread_index; @@ -235,7 +235,10 @@ ct6_in2out_inline (vlib_main_t * vm, /* * This is an output feature which runs at the last possible - * moment. Assume an ethernet header. + * moment. Assume an ethernet header. Make sure the packet is + * actually ipv6 before we do anything else. + * + * Unfortunately, we have to re-parse the L2 header. */ e0 = vlib_buffer_get_current (b[0]); @@ -245,6 +248,18 @@ ct6_in2out_inline (vlib_main_t * vm, delta0 += (e0->type == clib_net_to_host_u16 (ETHERNET_TYPE_DOT1AD)) ? 8 : 0; + if (PREDICT_TRUE (delta0 == sizeof (*e0))) + { + if (e0->type != clib_host_to_net_u16 (ETHERNET_TYPE_IP6)) + goto trace0; + } + else + { + u16 *tagged_etype_ptr = vlib_buffer_get_current (b[0]) + delta0 - 2; + if (*tagged_etype_ptr != clib_host_to_net_u16 (ETHERNET_TYPE_IP6)) + goto trace0; + } + ip0 = (ip6_header_t *) (vlib_buffer_get_current (b[0]) + delta0); /* @@ -252,7 +267,7 @@ ct6_in2out_inline (vlib_main_t * vm, */ if (PREDICT_FALSE (!ip6_address_is_global_unicast (&ip0->src_address) || - !ip6_address_is_global_unicast (&ip0->src_address))) + !ip6_address_is_global_unicast (&ip0->dst_address))) goto trace0; /* Pass non-udp, non-tcp traffic */ if (PREDICT_FALSE (ip0->protocol != IP_PROTOCOL_TCP &&