Here's a strategy: Use "show run" to identify graph nodes which are active when 
passing traffic. Nodes of interest will have names like "ethernet-input," 
"ip4-input", etc.

Obviously, the string "ethernet-input" string comes from "somewhere". In 
particular:

/* *INDENT-OFF* */
VLIB_REGISTER_NODE (ethernet_input_node) = {
  .name = "ethernet-input",
  /* Takes a vector of packets. */
<snip>
};

You'll find a companion function declaration:

VLIB_NODE_FN (ethernet_input_node) (vlib_main_t * vm,
                          vlib_node_runtime_t * node,
                          vlib_frame_t * frame)
{
  vnet_main_t *vnm = vnet_get_main ();
  u32 *from = vlib_frame_vector_args (frame);
  u32 n_packets = frame->n_vectors;

  ethernet_input_trace (vm, node, frame);

  if (frame->flags & ETH_INPUT_FRAME_F_SINGLE_SW_IF_IDX)
    {
      ethernet_input_frame_t *ef = vlib_frame_scalar_args (frame);
      int ip4_cksum_ok = (frame->flags & ETH_INPUT_FRAME_F_IP4_CKSUM_OK) != 0;
      vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, ef->hw_if_index);
      eth_input_single_int (vm, node, hi, from, n_packets, ip4_cksum_ok);
    }
  else
    ethernet_input_inline (vm, node, from, n_packets,
                    ETHERNET_INPUT_VARIANT_ETHERNET);
  return n_packets;
}

That's the actual graph node dispatch function. At that point, it's a matter of 
"using the Force and reading the Source..."

HTH... Dave


From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of hemant via 
lists.fd.io
Sent: Thursday, September 24, 2020 8:06 PM
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] pkt validation

Does VPP, in its ethernet, IP, and IPv6 input, include stock code to check for 
malformed packet? Any pointer to such code would help so that I can look at 
other code as well.

Thanks,

Hemant
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#17507): https://lists.fd.io/g/vpp-dev/message/17507
Mute This Topic: https://lists.fd.io/mt/77070037/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to