Then you're going to have to work harder since miniflow_extract() is
what initializes the L4 header pointer.

On Sat, Feb 16, 2019 at 08:39:08AM +0800, Krish wrote:
> I am sorry, but I am trying not to use extracted flow.  I want to use this
> information before it goes to EMC.
> 
> 
> 
> On Sat, Feb 16, 2019, 03:44 Ben Pfaff <b...@ovn.org> wrote:
> 
> > On Fri, Feb 15, 2019 at 03:48:22PM +0800, Krish wrote:
> > > 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.
> >
> > I'd just get it from the extracted flow instead of inventing new code to
> > extract it.
> >
_______________________________________________
discuss mailing list
disc...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to