[ovs-dev] [PATCH] ovn-controller: Fix empty address set parsing problem.

2017-09-09 Thread Han Zhou
When an address set is empty, current implementation will generate
an ovs flow that matches random things (and in most cases matching
everything) due to a problem in expression parser of constant set.
This patch fixes it by replacing the expression by a boolean false
when the set is empty, and adds tests cases accordingly.

Reported-by: Guru Shetty 
Reported-at: 
https://mail.openvswitch.org/pipermail/ovs-dev/2017-September/338441.html
Signed-off-by: Han Zhou 
---
 ovn/lib/expr.c   | 4 
 tests/ovn.at | 9 +
 tests/test-ovn.c | 2 ++
 3 files changed, 15 insertions(+)

diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c
index 060e9ee..6a731de 100644
--- a/ovn/lib/expr.c
+++ b/ovn/lib/expr.c
@@ -612,6 +612,10 @@ make_cmp(struct expr_context *ctx,
 }
 }
 
+if (!cs->n_values) {
+e = expr_create_boolean(false);
+goto exit;
+}
 e = make_cmp__(f, r, >values[0]);
 for (size_t i = 1; i < cs->n_values; i++) {
 e = expr_combine(r == EXPR_R_EQ ? EXPR_T_OR : EXPR_T_AND,
diff --git a/tests/ovn.at b/tests/ovn.at
index bbc..5608555 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -623,6 +623,15 @@ dl_src=00:00:00:00:00:02
 dl_src=00:00:00:00:00:03
 dl_src=ba:be:be:ef:de:ad
 ])
+AT_CHECK([expr_to_flow 'ip4.src == {$set4}'], [0], [dnl
+(no flows)
+])
+AT_CHECK([expr_to_flow 'ip4.src == {1.2.3.4, $set4}'], [0], [dnl
+ip,nw_src=1.2.3.4
+])
+AT_CHECK([expr_to_flow 'ip4.src == 1.2.3.4 || ip4.src == {$set4}'], [0], [dnl
+ip,nw_src=1.2.3.4
+])
 AT_CLEANUP
 
 AT_SETUP([ovn -- action parsing])
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 694bc79..148ce12 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -202,10 +202,12 @@ create_addr_sets(struct shash *addr_sets)
 static const char *const addrs3[] = {
 "00:00:00:00:00:01", "00:00:00:00:00:02", "00:00:00:00:00:03",
 };
+static const char *const addrs4[] = {};
 
 expr_addr_sets_add(addr_sets, "set1", addrs1, 3);
 expr_addr_sets_add(addr_sets, "set2", addrs2, 3);
 expr_addr_sets_add(addr_sets, "set3", addrs3, 3);
+expr_addr_sets_add(addr_sets, "set4", addrs4, 0);
 }
 
 static bool
-- 
2.1.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH V2 2/2] tests/odp: Add set vlan test to odp testsuite

2017-09-09 Thread Roi Dayan
From: Paul Blakey 

We support parsing set(vlan(vid,pcp,cfi)) so let's test it.

Signed-off-by: Paul Blakey 
Reviewed-by: Roi Dayan 
Acked-by: Simon Horman 
---
 tests/odp.at | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tests/odp.at b/tests/odp.at
index 0e8cbed..cd01b32 100644
--- a/tests/odp.at
+++ b/tests/odp.at
@@ -294,6 +294,11 @@ set(ipv6(label=0,proto=10,hlimit=128))
 set(ipv6(label=0/0xfff,proto=10,tclass=0x70/0x70))
 set(ipv6(label=0))
 set(icmpv6(type=1,code=2))
+set(vlan(vid=5))
+set(vlan(vid=3,pcp=5))
+set(vlan(vid=3,pcp=5,cfi=0))
+set(vlan(vid=5/0x3))
+set(vlan(vid=5/0x1)),3
 push_vlan(vid=12,pcp=0)
 push_vlan(vid=13,pcp=5,cfi=0)
 push_vlan(tpid=0x9100,vid=13,pcp=5)
-- 
2.7.5

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH V2 0/2] fix odp parsing of set masked action

2017-09-09 Thread Roi Dayan
Hi,

The first commit is a fix for parsing set masked action
and the second commit is adding a test.

Before the fix the addtion of the tests fails with the following:
# make check TESTSUITEFLAGS=436
# ./tests/ovstest test-odp parse-actions < 
./tests/testsuite.dir/0436/actions.txt > outact && diff -up 
./tests/testsuite.dir/0436/actions.txt  outact
--- ./tests/testsuite.dir/0436/actions.txt  2017-08-27 11:12:05.169261080 
+0300
+++ outact  2017-08-27 11:20:21.175169197 +0300
@@ -47,11 +47,11 @@ set(ipv6(label=0,proto=10,hlimit=128))
 set(ipv6(label=0/0xfff,proto=10,tclass=0x70/0x70))
 set(ipv6(label=0))
 set(icmpv6(type=1,code=2))
-set(vlan(vid=5))
+set(vlan(vid=5/0x0))
 set(vlan(vid=3,pcp=5))
 set(vlan(vid=3,pcp=5,cfi=0))
-set(vlan(vid=5/0x3))
-set(vlan(vid=5/0x1)),3
+set(vlan(vid=5/0x0))
+set(vlan(vid=5/0x0)),***6 leftover bytes*** (01000300)
 push_vlan(vid=12,pcp=0)
 push_vlan(vid=13,pcp=5,cfi=0)
 push_vlan(tpid=0x9100,vid=13,pcp=5)

V1->V2:
- Small refactor to comments

Thanks,
Roi


Paul Blakey (2):
  lib/odp: Fix handling of set masked action in parse_odp_action
  tests/odp: Add set vlan test to odp testsuite

 lib/odp-util.c | 9 +
 tests/odp.at   | 5 +
 2 files changed, 14 insertions(+)

-- 
2.7.5

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH V2 1/2] lib/odp: Fix handling of set masked action in parse_odp_action

2017-09-09 Thread Roi Dayan
From: Paul Blakey 

If we find that we need to change from a SET to SET_MASKED action,
then we write the mask to the actions opfbuf. But if there was netlink
pad added to the buffer when writing the key, mask won't follow the
key data as per SET_MASKED spec.

Fix that by removing the padding before writing the mask, and
readding it if needed for alignment.

Fixes: 6d670e7f0d45 ("lib/odp: Masked set action execution and printing.")
Signed-off-by: Paul Blakey 
Reviewed-by: Roi Dayan 
Acked-by: Simon Horman 
---
 lib/odp-util.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 4f1499e..6304b3d 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -1990,8 +1990,17 @@ parse_odp_action(const char *s, const struct simap 
*port_names,
 if (size == nl_attr_get_size(key)) {
 /* Change to masked set action if not fully masked. */
 if (!is_all_ones(mask + 1, size)) {
+/* Remove padding of eariler key payload  */
+actions->size -= NLA_ALIGN(key->nla_len) - key->nla_len;
+
+/* Put mask payload right after key payload */
 key->nla_len += size;
 ofpbuf_put(actions, mask + 1, size);
+
+/* Add new padding as needed */
+ofpbuf_put_zeros(actions, NLA_ALIGN(key->nla_len) -
+  key->nla_len);
+
 /* 'actions' may have been reallocated by ofpbuf_put(). */
 nested = ofpbuf_at_assert(actions, start_ofs, sizeof *nested);
 nested->nla_type = OVS_ACTION_ATTR_SET_MASKED;
-- 
2.7.5

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovsdb-server.1: Fix mention of wrong option.

2017-09-09 Thread Ben Pfaff
On Sat, Sep 09, 2017 at 05:10:48PM -0400, Russell Bryant wrote:
> The man page referenced a "--no-sync" option.  The correct option is
> "--active".
> 
> Signed-off-by: Russell Bryant 

Acked-by: Ben Pfaff 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovsdb-server.1: Fix mention of wrong option.

2017-09-09 Thread Russell Bryant
The man page referenced a "--no-sync" option.  The correct option is
"--active".

Signed-off-by: Russell Bryant 
---
 ovsdb/ovsdb-server.1.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovsdb/ovsdb-server.1.in b/ovsdb/ovsdb-server.1.in
index fd284a0ff..cf3884ccc 100644
--- a/ovsdb/ovsdb-server.1.in
+++ b/ovsdb/ovsdb-server.1.in
@@ -47,7 +47,7 @@ reset, requiring clients to reconnect to the server.
 .PP
 By default, \fBovsdb\-server\fR runs as an active server, except when the
 \fB\-\-sync\-from=\fIserver\fR command line option is specified and without
-the \fB\-\-no\-sync option\fR.  During runtime, \fBovsdb\-server\fR role can 
be switch by using appctl commands.
+the \fB\-\-active\fR option.  During runtime, \fBovsdb\-server\fR role can be 
switch by using appctl commands.
 .PP
 \fBovsdb-server/connect\-active\-ovsdb\-server\fR switches
 \fBovsdb\-server\fR into a backup server, Conversely,
-- 
2.13.5

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] Squid Tubes U10

2017-09-09 Thread Bonesca - Jona
    [ View in browser ]( http://r.newsletter.bonescamail.nl/nru6ry3ioatrf.html 
)   
 
 
 
Special promo :
 
Squid Tubes / Tintenfisch tuben / PijlIntkvis Tubes / 
Calmar Nettoye China
 
10 x 1 kilo / 750 grs netto
 
1 box € 4,45
10 box € 4,25
palet (80) box € 3,95 per kilo      
This email was sent to d...@openvswitch.org
You received this email because you are registered with Bonesca Import en 
Export BV
 
[ Unsubscribe here ]( http://r.newsletter.bonescamail.nl/nru6ry3ioatrg.html )  

Sent by
[  ]( http://r.newsletter.bonescamail.nl/track/click/2n3cr3sdpaoatrd )     
© 2017 Bonesca Import en Export BV  

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev