[ovs-discuss] Adding a new header field for flow matching and Set-Field action

Ben Pfaff blp at ovn.org
Tue Mar 22 15:39:15 UTC 2016


Thanks, I've sent out a patch for the FAQ.

On Tue, Mar 22, 2016 at 11:09:54AM +0300, Enas Ahmad wrote:
> I am posting here so if someone else is trying to add a new field to ovs
> maybe this can help and save their time.
> After debugging I solved my issue by adding the following to nx_put_raw()
> in nx-match.c:
> 
> if( match->wc.masks.iot_addr){
>     nxm_put_32m(b, MFF_IOT_ADDR, oxm,
>     htonl(flow->iot_addr), match->wc.masks.iot_addr);
> }
> 
> otherwise my field was not added to ofpbuf buffer. If correct maybe it can
> be added to the FAQ.
> 
> Best,
> Enas
> 
> On Fri, Mar 18, 2016 at 6:50 AM, Ben Pfaff <blp at ovn.org> wrote:
> 
> > I'm always frankly puzzled by this kind of message that says "I made
> > some changes to OVS and they didn't work."  The answer is that you need
> > to debug your changes.
> >
> > On Thu, Mar 17, 2016 at 06:17:10PM +0300, Enas Ahmad wrote:
> > > Hi,
> > > I am still having a problem in successfully defining a new field. My
> > field
> > > name is iot_addr. I define it in the meta-flow.h file as the following:
> > >
> > >   /* "iot_addr".
> > >     *
> > >     * IoT address
> > >     *
> > >     * Type: be32.
> > >     * Maskable: bitwise.
> > >     * Formatting: decimal.
> > >     * Prerequisites: UDP.
> > >     * Access: read/write.
> > >     * NXM: none.
> > >              * OXM: NXOXM_ET_IOT_ADDR(1) since OF1.5 and v2.5.
> > >          */
> > >     MFF_IOT_ADDR,
> > >
> > > When I try to create a new flow entry using ovs-ofctl:
> > >
> > > sudo ovs-ofctl add-flow s1
> > >
> > priority=65534,dl_type=0x0800,nw_proto=17,tp_dst=9999,iot_addr=1234567890,actions=output:2
> > >
> > > the iot_addr is correctly set in the flow-mod msg.
> > >
> > > I also debugged the miniflow_extract() and any incoming packet is being
> > > correctly parsed and the value is set in iot_addr.
> > >
> > > However, when sending packets the rule of iot_addr is not applied (i.e.
> > all
> > > UDP packets on port 9999 are accepted regardless of the iot_addr value).
> > >
> > > When I dump the flows on s1 it does not return the iot_addr part of the
> > > rule (checked by debugging). So it seems that the switch didn't accept my
> > > new field and created the table entry without it, therefore iot_addr is
> > not
> > > being matched against when a packet arrives.
> > >
> > > I made sure that the switch is running the OpenFlow15 version using the
> > -O
> > > command.
> > >
> > > Is there something I am missing ?
> > >
> > >
> > >
> > > On Sun, Mar 13, 2016 at 7:16 PM, Ben Pfaff <blp at ovn.org> wrote:
> > >
> > > > On Sun, Mar 13, 2016 at 05:32:45PM +0300, Enas Ahmad wrote:
> > > > > Thanks Ben for the useful answer, following these directions I was
> > able
> > > > to
> > > > > add a new field and was able to successfully create a table entry
> > > > > specifying a value for that filed.
> > > > >
> > > > > However, now I need to verify the packet extraction process done in
> > > > > miniflow_extract(). My question is: how can I debug this method ?
> > > > > flow.c does not import openvswitch/vlog.h, is there a reason for
> > that ?
> > > > > should I just add support for logging in flow.c or is there another
> > way
> > > > to
> > > > > debug it ?
> > > >
> > > > Just add logging to flow.c
> > > >
> > >
> > > --
> > >
> > > ------------------------------
> > > This message and its contents, including attachments are intended solely
> > > for the original recipient. If you are not the intended recipient or have
> > > received this message in error, please notify me immediately and delete
> > > this message from your computer system. Any unauthorized use or
> > > distribution is prohibited. Please consider the environment before
> > printing
> > > this email.
> >
> 
> -- 
> 
> ------------------------------
> This message and its contents, including attachments are intended solely 
> for the original recipient. If you are not the intended recipient or have 
> received this message in error, please notify me immediately and delete 
> this message from your computer system. Any unauthorized use or 
> distribution is prohibited. Please consider the environment before printing 
> this email.



More information about the discuss mailing list