Skip to content

Instantly share code, notes, and snippets.

/-

Created April 6, 2016 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1a20998546d7464fa548be54061460b5 to your computer and use it in GitHub Desktop.
Save anonymous/1a20998546d7464fa548be54061460b5 to your computer and use it in GitHub Desktop.
host
ip netns exec vpp1 ping -c3 172.16.2.2
vpp
trace add af-packet-input 10
show trace
macswap enable-disable ?
show inter
macswap enable-disable host-vpp1
show vlib graph
<find “macswap”>
clear trace
<goto host and ping again>
show trace
<lets note the sw_if_index (6) and the next_index (0)>
show inter
Output: host-vpp1 6
show vlib graph
<find “macswap”>
Output: macswap interface-output [0]
show trace
Output: note: host-vpp1-output which is “interface-output”
typedef struct {
 u8 src[6];
 u8 dst[6];
 u32 next_index;
 u32 sw_if_index;
} macswap_trace_t;
/* packet trace format function */
static u8 * format_macswap_trace (u8 * s, va_list * args)
{
 CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
 CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
 macswap_trace_t * t = va_arg (*args, macswap_trace_t *);
 s = format (s, "MACSWAP: sw_if_index %d, next index %d src=%U dst=%U",
             t->sw_if_index, t->next_index, format_ethernet_address, t->src,
             format_ethernet_address, t->dst);
 return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment