X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fmap%2Fmap.h;h=215a832f431739f5ca1489fb4824464617894bdf;hb=e1ab06c14deaff5cc0870f7ec76f36613ffcc2d3;hp=1f51a59aa2ec94e236f16e1f6e2168770dec1b53;hpb=56817e2c486a26167783676774b0dea9c103b200;p=vpp.git diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h index 1f51a59aa2e..215a832f431 100644 --- a/src/plugins/map/map.h +++ b/src/plugins/map/map.h @@ -23,6 +23,7 @@ #include #include "lpm.h" #include +#include #define MAP_SKIP_IP6_LOOKUP 1 @@ -205,37 +206,7 @@ typedef struct uword ip4_sv_reass_custom_next_index; } map_main_t; -/* - * MAP Error counters/messages - */ -#define foreach_map_error \ - /* Must be first. */ \ - _(NONE, "valid MAP packets") \ - _(BAD_PROTOCOL, "bad protocol") \ - _(SEC_CHECK, "security check failed") \ - _(ENCAP_SEC_CHECK, "encap security check failed") \ - _(DECAP_SEC_CHECK, "decap security check failed") \ - _(ICMP, "unable to translate ICMP") \ - _(ICMP_RELAY, "unable to relay ICMP") \ - _(UNKNOWN, "unknown") \ - _(NO_BINDING, "no binding") \ - _(NO_DOMAIN, "no domain") \ - _(FRAGMENTED, "packet is a fragment") \ - _(FRAGMENT_MEMORY, "could not cache fragment") \ - _(FRAGMENT_MALFORMED, "fragment has unexpected format")\ - _(FRAGMENT_DROPPED, "dropped cached fragment") \ - _(MALFORMED, "malformed packet") \ - _(DF_SET, "can't fragment, DF set") \ - _(TIME_EXCEEDED, "time exceeded") \ - -typedef enum -{ -#define _(sym,str) MAP_ERROR_##sym, - foreach_map_error -#undef _ - MAP_N_ERROR, -} map_error_t; - +typedef vl_counter_map_enum_t map_error_t; u64 map_error_counter_get (u32 node_index, map_error_t map_error); typedef struct @@ -494,6 +465,34 @@ map_mss_clamping (tcp_header_t * tcp, ip_csum_t * sum, u16 mss_clamping) } } +static_always_inline bool +ip4_map_ip6_lookup_bypass (vlib_buffer_t * p0, ip4_header_t * ip) +{ +#ifdef MAP_SKIP_IP6_LOOKUP + if (FIB_NODE_INDEX_INVALID != pre_resolved[FIB_PROTOCOL_IP6].fei) + { + vnet_buffer (p0)->ip.adj_index[VLIB_TX] = + pre_resolved[FIB_PROTOCOL_IP6].dpo.dpoi_index; + return (true); + } +#endif + return (false); +} + +static_always_inline bool +ip6_map_ip4_lookup_bypass (vlib_buffer_t * p0, ip4_header_t * ip) +{ +#ifdef MAP_SKIP_IP6_LOOKUP + if (FIB_NODE_INDEX_INVALID != pre_resolved[FIB_PROTOCOL_IP4].fei) + { + vnet_buffer (p0)->ip.adj_index[VLIB_TX] = + pre_resolved[FIB_PROTOCOL_IP4].dpo.dpoi_index; + return (true); + } +#endif + return (false); +} + /* * fd.io coding-style-patch-verification: ON *