X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Facl%2Ffa_node.c;h=9c3db8d81fd7af6ff857345882890de865681381;hb=47bcca2ec8b3fb21b099a4f19a260a4783068e63;hp=a7e7b056a0b01d66f2a5b792451df1f166c817f5;hpb=69cce166535e138e66d0a95f1cfe6a3591489e10;p=vpp.git diff --git a/src/plugins/acl/fa_node.c b/src/plugins/acl/fa_node.c index a7e7b056a0b..9c3db8d81fd 100644 --- a/src/plugins/acl/fa_node.c +++ b/src/plugins/acl/fa_node.c @@ -39,6 +39,25 @@ typedef struct u8 action; } acl_fa_trace_t; +static u8 * +format_fa_5tuple (u8 * s, va_list * args) +{ + fa_5tuple_t *p5t = va_arg (*args, fa_5tuple_t *); + + return format(s, "%s sw_if_index %d (lsb16 %d) l3 %s%s %U -> %U" + " l4 proto %d l4_valid %d port %d -> %d tcp flags (%s) %02x rsvd %x", + p5t->pkt.is_input ? "input" : "output", + p5t->pkt.sw_if_index, p5t->l4.lsb_of_sw_if_index, p5t->pkt.is_ip6 ? "ip6" : "ip4", + p5t->pkt.is_nonfirst_fragment ? " non-initial fragment" : "", + format_ip46_address, &p5t->addr[0], p5t->pkt.is_ip6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4, + format_ip46_address, &p5t->addr[1], p5t->pkt.is_ip6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4, + p5t->l4.proto, p5t->pkt.l4_valid, + p5t->l4.port[0], p5t->l4.port[1], + p5t->pkt.tcp_flags_valid ? "valid": "invalid", + p5t->pkt.tcp_flags, + p5t->pkt.flags_reserved); +} + /* packet trace format function */ static u8 * format_acl_fa_trace (u8 * s, va_list * args) @@ -55,6 +74,9 @@ format_acl_fa_trace (u8 * s, va_list * args) t->match_rule_index, t->trace_bitmap, t->packet_info[0], t->packet_info[1], t->packet_info[2], t->packet_info[3], t->packet_info[4], t->packet_info[5]); + + /* Now also print out the packet_info in a form usable by humans */ + s = format (s, "\n %U", format_fa_5tuple, t->packet_info); return s; } @@ -332,16 +354,24 @@ static void acl_fill_5tuple (acl_main_t * am, vlib_buffer_t * b0, int is_ip6, int is_input, int is_l2_path, fa_5tuple_t * p5tuple_pkt) { - int l3_offset = ethernet_buffer_header_size(b0); + int l3_offset; int l4_offset; u16 ports[2]; u16 proto; + /* IP4 and IP6 protocol numbers of ICMP */ static u8 icmp_protos[] = { IP_PROTOCOL_ICMP, IP_PROTOCOL_ICMP6 }; - if (is_input && !(is_l2_path)) + if (is_l2_path) { - l3_offset = 0; + l3_offset = ethernet_buffer_header_size(b0); + } + else + { + if (is_input) + l3_offset = 0; + else + l3_offset = vnet_buffer(b0)->ip.save_rewrite_length; } /* key[0..3] contains src/dst address and is cleared/set below */