Re: [vpp-dev] pkt validation

2020-09-25 Thread hemant via lists.fd.io
Dave,

 

Yes, that helps totally.

 

Thanks!

 

Hemant

 

From: Dave Barach (dbarach)  
Sent: Friday, September 25, 2020 6:36 AM
To: hem...@mnkcg.com; vpp-dev@lists.fd.io
Subject: RE: [vpp-dev] pkt validation

 

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. */



};

 

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 <mailto:vpp-dev@lists.fd.io>  mailto: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 <mailto: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



smime.p7s
Description: S/MIME cryptographic signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#17509): https://lists.fd.io/g/vpp-dev/message/17509
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]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] pkt validation

2020-09-25 Thread Dave Barach via lists.fd.io
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. */

};

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  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]
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev] pkt validation

2020-09-24 Thread hemant via lists.fd.io
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



smime.p7s
Description: S/MIME cryptographic signature

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#17505): https://lists.fd.io/g/vpp-dev/message/17505
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]
-=-=-=-=-=-=-=-=-=-=-=-