[ovs-discuss] [openvswitch 2.9.90] Unable to use literal in nested output of learn action

Flavio Fernandes flavio at flaviof.com
Fri Apr 6 21:57:14 UTC 2018


Heh, after sending that msg, I did a little digging in the code [1] and doc and it seems clear that
integer literals are just not supported as a value for the output action name.

I imagine that in order to handle that, that code section would need to be extended to perform
a "parse_int_string(value,...)" and etc.

All in all, I convinced myself that this is a FAD. One can easily load a literal
integer into a REG and use that as output [2] anyways. So, that is plenty good.

Thanks and sorry for the noise,

-- flaviof


[1]: https://github.com/openvswitch/ovs/blob/a045e4b03d7603572ae0d503762c52dc40bf6f23/lib/learn.c#L371

[2]: load:0x1->NXM_NX_REG1[] ... output:NXM_NX_REG1[]



> On Apr 6, 2018, at 4:18 PM, Flavio Fernandes <flavio at flaviof.com> wrote:
> 
> Dear OVS Gurus:
> 
> I came across something simple and silly, which is making me think it is actually a bug.
> 
> In a nutshell, I'm trying to use a literal with the action output nested in a learn().
> If I use a fancier (and more common) notation:
> 
>   output:NXM_OF_IN_PORT[]
> 
> that works fine. However, if I try to use a literal such as:
> 
>   output:2
> 
> I get:
> 
>   ovs-ofctl: 2: unknown field `2'
> 
> 
> Here is a set of steps I use from a sandbox session:
> 
>   $ ./boot.sh ; ./configure ; make -j4 ; \
>     make sandbox
> 
>   $ ovs-vsctl add-br br0 \
>         -- add-port br0 p1 -- set interface p1 ofport_request=1 \
>         -- add-port br0 p2 -- set interface p2 ofport_request=2 \
>         -- set Bridge br0 fail-mode=secure
> 
>   # this works just fine
>   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
>         in_port=1, \
>         NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
>         output:NXM_OF_IN_PORT[]), \
>         resubmit(,1)"
> 
>   $ ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood"
> 
>   $ ovs-ofctl -OOpenFlow13 --names --no-stat dump-flows br0
>     reset_counts actions=learn(table=1,hard_timeout=600,in_port=p1,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[]),resubmit(,1)
>     table=1, reset_counts priority=0 actions=FLOOD
> 
>   # very similar to the learn action done above, except I'm attempting to hard code an output value
>   $ ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=600, \
>         in_port=2, \
>         NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \
>         output:2), \
>         resubmit(,1)"
>   ovs-ofctl: 2: unknown field `2'
> 
>   $ echo $?
>   1
> 
> I also played a little bit with the parser test to reproduce this behavior. See below.
> 
> So... bug or FAD? If you think BUG, I can dig a little more to learn what is going on.
> It has been a while, so chances are that most of you will have this fixed before I manage
> to blink. :)
> 
> Best,
> 
> -- flaviof
> 
> 
> 
> 
> $ make check TESTSUITEFLAGS=--list 2>/dev/null | grep -m1 -i learn
> 454: learn.at:3         learning action - parsing and formatting
> 
> 
> $ git diff
> diff --git a/tests/learn.at b/tests/learn.at
> index 5f1d6df..eaf1147 100644
> --- a/tests/learn.at
> +++ b/tests/learn.at
> @@ -7,6 +7,7 @@ actions=learn(send_flow_rem)
> actions=learn(delete_learned)
> actions=learn(send_flow_rem,delete_learned)
> actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], output:NXM_OF_IN_PORT[], load:10->NXM_NX_REG0[5..10])
> +actions=learn(NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], output:99)
> actions=learn(table=1,idle_timeout=10, hard_timeout=20, fin_idle_timeout=5, fin_hard_timeout=10, priority=10, cookie=0xfedcba9876543210, in_port=99,eth_dst=eth_src,load:in_port->reg1[16..31])
> actions=learn(limit=4096)
> actions=learn(limit=4096,result_dst=reg0[0])
> 
> 
> $ make check TESTSUITEFLAGS='454'
> ...
> 454: learning action - parsing and formatting        FAILED (learn.at:15)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.openvswitch.org/pipermail/ovs-discuss/attachments/20180406/772268cc/attachment-0001.sig>


More information about the discuss mailing list