[ovs-discuss] How to store the tcp_src or tcp_dst field value in a variable and then print in vlogs?
Krish
attkillrocks at gmail.com
Fri Feb 15 07:48:22 UTC 2019
Hi
I want to store tcp_src, dst port in a variable.
This is what I am doing:
1. Retrieve packet from dp_packet_batch one by one.
2. Retrieving field values by extracting packets headers:
struct ip_header *ip = dp_packet_l3(packet);
nw_proto = ip->ip_proto;
if(nw_proto == 6)
{
struct tcp_header *th = dp_packet_l4(packet);
// The following are the 2 different ways I am trying to print the tcp_src.
I have tried it 1 and 2 separately not at the same time.
//1 . Ovs crash at the below statement
uint16_t src = (uint16_t) ntohs(th->tcp_src);
VLOG_DBG( "tcp_src ---> %d", src );
//2. When I enable logging ovs crashes at this point
VLOG_DBG( "tcp_src ---> %d", ntohs(th->tcp_src) );
}
Can anyone please help how to store tcp_src port value in a variable and
print it in vlogs?
Statement 2 is working fine if vlogs are disabled, but I want the port
value to be stored in a variable and then print.
Thanks
Krish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20190215/2bbd2502/attachment.html>
More information about the discuss
mailing list