Re: [ovs-dev] ossfuzz: Additions for new ODP parser target

2018-10-02 Thread 0-day Robot
Bleep bloop.  Greetings Bhargava Shastry, I am a robot and I have tried out 
your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


build:
  > utilities/ovs-lib.tmp
mv utilities/ovs-lib.tmp utilities/ovs-lib
:;{ \
  echo '# Signature of the current package.' && \
  echo 'm4_define([AT_PACKAGE_NAME],  [openvswitch])' && \
  echo 'm4_define([AT_PACKAGE_TARNAME],   [openvswitch])' && \
  echo 'm4_define([AT_PACKAGE_VERSION],   [2.10.90])' && \
  echo 'm4_define([AT_PACKAGE_STRING],[openvswitch 2.10.90])' && \
  echo 'm4_define([AT_PACKAGE_BUGREPORT], [b...@openvswitch.org])'; \
} >'./package.m4'
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/testsuite.tmp tests/testsuite.at
mv tests/testsuite.tmp tests/testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-kmod-testsuite.tmp 
tests/system-kmod-testsuite.at
mv tests/system-kmod-testsuite.tmp tests/system-kmod-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-userspace-testsuite.tmp 
tests/system-userspace-testsuite.at
mv tests/system-userspace-testsuite.tmp tests/system-userspace-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-offloads-testsuite.tmp 
tests/system-offloads-testsuite.at
mv tests/system-offloads-testsuite.tmp tests/system-offloads-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-dpdk-testsuite.tmp 
tests/system-dpdk-testsuite.at
mv tests/system-dpdk-testsuite.tmp tests/system-dpdk-testsuite
make[2]: *** No rule to make target `tests/oss-fuzz/config/odp_target.options', 
needed by `all-am'.  Stop.
make[2]: Leaving directory 
`/var/lib/jenkins/jobs/upstream_build_from_pw/workspace'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory 
`/var/lib/jenkins/jobs/upstream_build_from_pw/workspace'
make: *** [all] Error 2


Please check this out.  If you feel there has been an error, please email 
acon...@bytheb.org

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] ossfuzz: Add new target for ODP parsing

2018-10-02 Thread 0-day Robot
Bleep bloop.  Greetings Bhargava Shastry, I am a robot and I have tried out 
your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


build:
  > utilities/ovs-lib.tmp
mv utilities/ovs-lib.tmp utilities/ovs-lib
:;{ \
  echo '# Signature of the current package.' && \
  echo 'm4_define([AT_PACKAGE_NAME],  [openvswitch])' && \
  echo 'm4_define([AT_PACKAGE_TARNAME],   [openvswitch])' && \
  echo 'm4_define([AT_PACKAGE_VERSION],   [2.10.90])' && \
  echo 'm4_define([AT_PACKAGE_STRING],[openvswitch 2.10.90])' && \
  echo 'm4_define([AT_PACKAGE_BUGREPORT], [b...@openvswitch.org])'; \
} >'./package.m4'
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/testsuite.tmp tests/testsuite.at
mv tests/testsuite.tmp tests/testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-kmod-testsuite.tmp 
tests/system-kmod-testsuite.at
mv tests/system-kmod-testsuite.tmp tests/system-kmod-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-userspace-testsuite.tmp 
tests/system-userspace-testsuite.at
mv tests/system-userspace-testsuite.tmp tests/system-userspace-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-offloads-testsuite.tmp 
tests/system-offloads-testsuite.at
mv tests/system-offloads-testsuite.tmp tests/system-offloads-testsuite
/bin/sh 
/var/lib/jenkins/jobs/upstream_build_from_pw/workspace/build-aux/missing 
autom4te --language=autotest -I '.' -o tests/system-dpdk-testsuite.tmp 
tests/system-dpdk-testsuite.at
mv tests/system-dpdk-testsuite.tmp tests/system-dpdk-testsuite
make[2]: *** No rule to make target `tests/oss-fuzz/config/odp_target.options', 
needed by `all-am'.  Stop.
make[2]: Leaving directory 
`/var/lib/jenkins/jobs/upstream_build_from_pw/workspace'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory 
`/var/lib/jenkins/jobs/upstream_build_from_pw/workspace'
make: *** [all] Error 2


Please check this out.  If you feel there has been an error, please email 
acon...@bytheb.org

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] Revert "bridge: Fix ovs-appctl qos/show repeated queue information"

2018-10-02 Thread Flavio Leitner
On Tue, Oct 02, 2018 at 04:03:00PM -0700, Ben Pfaff wrote:
> This reverts commit 6b4d0211e84a ("bridge: Fix ovs-appctl qos/show
> repeated queue information"), which is no longer necessary now that
> commit 65f3c34c7417 ("netdev: Properly clear 'details' when iterating
> in NETDEV_QOS_FOR_EACH.") has been applied.  The former commit fixed
> a symptom of the root cause fixed by the latter.
> 
> Signed-off-by: Ben Pfaff 
> ---

LGTM
Acked-by: Flavio Leitner 


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


Re: [ovs-dev] [PATCH 1/2] netdev: Properly clear 'details' when iterating in NETDEV_QOS_FOR_EACH.

2018-10-02 Thread Flavio Leitner
On Tue, Oct 02, 2018 at 04:02:59PM -0700, Ben Pfaff wrote:
> The function comment for netdev_queue_dump_next() said that it cleared its
> 'detail' argument, but it didn't actually do that, which meant that details
> could be incorrectly carried along from one queue to the next.
> 
> Reported-by: Flavio Leitner 
> Signed-off-by: Ben Pfaff 
> ---

Acked-by: Flavio Leitner 
Thanks Ben!
fbl

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


[ovs-dev] [PATCH v2 3/3] ossfuzz: ODP test harness

2018-10-02 Thread bshastry
From: Bhargava Shastry 

This commit adds the ODP parser test harness for
 oss-fuzz.

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/odp_target.c | 147 
 1 file changed, 147 insertions(+)
 create mode 100644 tests/oss-fuzz/odp_target.c

diff --git a/tests/oss-fuzz/odp_target.c b/tests/oss-fuzz/odp_target.c
new file mode 100644
index 0..93231bde3
--- /dev/null
+++ b/tests/oss-fuzz/odp_target.c
@@ -0,0 +1,147 @@
+#include 
+#include "fuzzer.h"
+#undef NDEBUG
+#include "odp-util.h"
+#include 
+#include "openvswitch/dynamic-string.h"
+#include "flow.h"
+#include "openvswitch/match.h"
+#include "openvswitch/ofpbuf.h"
+#include "util.h"
+#include "openvswitch/ofp-flow.h"
+#include "openvswitch/vlog.h"
+
+static int
+parse_keys(bool wc_keys, const char *in)
+{
+int exit_code = 0;
+
+enum odp_key_fitness fitness;
+struct ofpbuf odp_key;
+struct ofpbuf odp_mask;
+struct flow flow;
+struct ds out;
+int error;
+
+/* Convert string to OVS DP key. */
+ofpbuf_init(_key, 0);
+ofpbuf_init(_mask, 0);
+error = odp_flow_from_string(in, NULL,
+ _key, _mask);
+if (error) {
+printf("odp_flow_from_string: error\n");
+goto next;
+}
+
+if (!wc_keys) {
+struct odp_flow_key_parms odp_parms = {
+.flow = ,
+.support = {
+.recirc = true,
+.ct_state = true,
+.ct_zone = true,
+.ct_mark = true,
+.ct_label = true,
+.max_vlan_headers = SIZE_MAX,
+},
+};
+
+/* Convert odp_key to flow. */
+fitness = odp_flow_key_to_flow(odp_key.data, odp_key.size, );
+switch (fitness) {
+case ODP_FIT_PERFECT:
+break;
+
+case ODP_FIT_TOO_LITTLE:
+printf("ODP_FIT_TOO_LITTLE: ");
+break;
+
+case ODP_FIT_TOO_MUCH:
+printf("ODP_FIT_TOO_MUCH: ");
+break;
+
+case ODP_FIT_ERROR:
+printf("odp_flow_key_to_flow: error\n");
+goto next;
+}
+/* Convert cls_rule back to odp_key. */
+ofpbuf_uninit(_key);
+ofpbuf_init(_key, 0);
+odp_flow_key_from_flow(_parms, _key);
+
+if (odp_key.size > ODPUTIL_FLOW_KEY_BYTES) {
+printf ("too long: %"PRIu32" > %d\n",
+odp_key.size, ODPUTIL_FLOW_KEY_BYTES);
+exit_code = 1;
+}
+}
+
+/* Convert odp_key to string. */
+ds_init();
+if (wc_keys) {
+odp_flow_format(odp_key.data, odp_key.size,
+odp_mask.data, odp_mask.size, NULL, , false);
+} else {
+odp_flow_key_format(odp_key.data, odp_key.size, );
+}
+puts(ds_cstr());
+ds_destroy();
+
+next:
+ofpbuf_uninit(_key);
+ofpbuf_uninit(_mask);
+
+return exit_code;
+}
+
+static int
+parse_actions(const char *in)
+{
+struct ofpbuf odp_actions;
+struct ds out;
+int error;
+
+/* Convert string to OVS DP actions. */
+ofpbuf_init(_actions, 0);
+error = odp_actions_from_string(in, NULL, _actions);
+if (error) {
+printf("odp_actions_from_string: error\n");
+goto next;
+}
+
+/* Convert odp_actions back to string. */
+ds_init();
+format_odp_actions(, odp_actions.data, odp_actions.size, NULL);
+puts(ds_cstr());
+ds_destroy();
+
+next:
+ofpbuf_uninit(_actions);
+return 0;
+}
+
+int
+LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+/* Bail out if we cannot construct at least a 1 char string. */
+const char *input = (const char *) data;
+if (size < 2 || input[size - 1] != '\0' || strchr(input, '\n')) {
+return 0;
+}
+
+/* Disable logging to avoid write to disk. */
+static bool isInit = false;
+if (!isInit) {
+vlog_set_verbosity("off");
+isInit = true;
+}
+
+/* Parse keys and wc keys. */
+parse_keys(false, input);
+parse_keys(true, input);
+
+/* Parse actions. */
+parse_actions(input);
+
+return 0;
+}
-- 
2.17.1

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


[ovs-dev] [PATCH v2 2/3] ossfuzz: ODP target fuzzing dictionary and

2018-10-02 Thread bshastry
From: Bhargava Shastry 

This patch adds a fuzzing dictionary, and a fuzzer
 config file for  the ODP parser oss-fuzz target.

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/config/odp.dict   | 170 +++
 tests/oss-fuzz/config/odp_target.options |   3 +
 2 files changed, 173 insertions(+)
 create mode 100644 tests/oss-fuzz/config/odp.dict
 create mode 100644 tests/oss-fuzz/config/odp_target.options

diff --git a/tests/oss-fuzz/config/odp.dict b/tests/oss-fuzz/config/odp.dict
new file mode 100644
index 0..a9bdd3e99
--- /dev/null
+++ b/tests/oss-fuzz/config/odp.dict
@@ -0,0 +1,170 @@
+"("
+")"
+","
+"/0x"
+"0x"
+": "
+"="
+"=r"
+"action"
+"arp"
+"bfd"
+"bos"
+"c1"
+"c2"
+"c3"
+"c4"
+"cc"
+"cfi"
+"cfm"
+"class"
+"clone"
+"code"
+"commit,"
+"crit,"
+"csum"
+"ct"
+"ct(error)"
+"ct_clear"
+"ct_label"
+"ct_mark"
+"ct_state"
+"ct_tuple4"
+"ct_tuple6"
+"ct_zone"
+"dir"
+"dl_type"
+"dnat"
+"dp_hash"
+"drop"
+"dst"
+"dst_port"
+"egress"
+"encap"
+"error"
+"erspan"
+"erspan(ver=1,sid=0x,dir=,idx=0x)"
+"est"
+"eth"
+"eth_type"
+"eth_type(0/)"
+"first"
+"flags"
+"force_commit,"
+"frag"
+"gbp("
+"geneve"
+"gre((flags=0x,proto=0x)"
+"hash,"
+"helper"
+"hlimit"
+"hwid"
+"icmp"
+"icmpv6"
+"id"
+"idx="
+"in_port"
+"ingress"
+"inv"
+"ip6erspan"
+"ipfix(output_port="
+"ipv4"
+"ipv6"
+"ipv6_dst"
+"ipv6_src"
+"l4()"
+"label"
+"lacp"
+"later"
+"len"
+"lldp"
+"mark=/,"
+"match"
+"md2"
+"mdtype"
+"meter()"
+"mpls"
+"nat"
+"nd"
+"new"
+"no"
+"np"
+"ns"
+"nsh"
+"oam,"
+"op"
+"options("
+"out_port("
+"packet_type"
+"pcp="
+"persistent,"
+"pop_eth"
+"pop_mpls(eth_type=0x)"
+"pop_nsh()"
+"pop_vlan"
+"proto"
+"push_eth(src=:,dst=:,type=)"
+"push_mpls("
+"push_nsh("
+"push_vlan("
+"push_vlan(tpid=,vid=,pcp=,cfi=)"
+"random,"
+"recirc()"
+"recirc_id"
+"rel"
+"rpl"
+"sFlow(vid=,pcp=,output=)"
+"sample"
+"sctp"
+"seq=0x"
+"set("
+"set(nsh("
+"sha"
+"si"
+"sip"
+"skb_mark"
+"skb_priority"
+"sll"
+"slow_path"
+"snat"
+"spi"
+"src"
+"src_port"
+"stp"
+"sym_l4()"
+"target"
+"tc="
+"tclass"
+"tcp"
+"tcp_flags"
+"tha"
+"tip"
+"tll"
+"tnl_pop("
+"tnl_push(tnl_port("
+"too_little"
+"too_much"
+"tos"
+"tp_dst"
+"tp_src"
+"tpid=0x"
+"trk"
+"trunc()"
+"ttl"
+"tun_id"
+"tunnel"
+"tunnel_out_port"
+"type"
+"udp"
+"unspec"
+"userdata"
+"userspace("
+"userspace(error)"
+"userspace(pid"
+"ver"
+"vid"
+"vlan"
+"vxlan"
+"vxlan(flags=0x,vni=0x)"
+"vxlan(gbp("
+"zone"
diff --git a/tests/oss-fuzz/config/odp_target.options 
b/tests/oss-fuzz/config/odp_target.options
new file mode 100644
index 0..41821b8c1
--- /dev/null
+++ b/tests/oss-fuzz/config/odp_target.options
@@ -0,0 +1,3 @@
+[libfuzzer]
+close_fd_mask = 3
+dict = odp.dict
-- 
2.17.1

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


[ovs-dev] [PATCH v2 1/3] ossfuzz: Additions for new ODP parser target

2018-10-02 Thread bshastry
From: Bhargava Shastry 

This patch adds a new oss-fuzz target for the ODP
 parser. The target harness has been adapted from test-odp.c. Prominently, it
 leaves out "parse_filter" due to an  unresolvable bug in that code at the
 time of writing.

It also includes the following:
  - a fuzzing dictionary
  - fuzzing config
  - some automake additions for the new target

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/automake.mk | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/oss-fuzz/automake.mk b/tests/oss-fuzz/automake.mk
index 3e3ac2f9c..4fbdb4c2b 100644
--- a/tests/oss-fuzz/automake.mk
+++ b/tests/oss-fuzz/automake.mk
@@ -2,7 +2,8 @@ OSS_FUZZ_TARGETS = \
tests/oss-fuzz/flow_extract_target \
tests/oss-fuzz/json_parser_target \
tests/oss-fuzz/ofp_print_target \
-   tests/oss-fuzz/expr_parse_target
+   tests/oss-fuzz/expr_parse_target \
+   tests/oss-fuzz/odp_target
 EXTRA_PROGRAMS += $(OSS_FUZZ_TARGETS)
 oss-fuzz-targets: $(OSS_FUZZ_TARGETS)
 
@@ -31,10 +32,18 @@ tests_oss_fuzz_expr_parse_target_LDADD = 
lib/libopenvswitch.la \
  ovn/lib/libovn.la
 tests_oss_fuzz_expr_parse_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++
 
+tests_oss_fuzz_odp_target_SOURCES = \
+tests/oss-fuzz/odp_target.c \
+tests/oss-fuzz/fuzzer.h
+tests_oss_fuzz_odp_target_LDADD = lib/libopenvswitch.la
+tests_oss_fuzz_odp_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++
+
 EXTRA_DIST += \
tests/oss-fuzz/config/flow_extract_target.options \
tests/oss-fuzz/config/json_parser_target.options \
tests/oss-fuzz/config/ofp_print_target.options \
tests/oss-fuzz/config/expr_parse_target.options \
+   tests/oss-fuzz/config/odp_target.options \
tests/oss-fuzz/config/ovs.dict \
-   tests/oss-fuzz/config/expr.dict
+   tests/oss-fuzz/config/expr.dict \
+   tests/oss-fuzz/config/odp.dict
-- 
2.17.1

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


[ovs-dev] [PATCH] ossfuzz: Add new target for ODP parsing

2018-10-02 Thread bshastry
From: Bhargava Shastry 

This patch adds a new oss-fuzz target for the ODP parser. The
 target harness has been adapted from test-odp.c. Prominently, it leaves out
 "parse_filter" due to an  unresolvable bug in that code at the time of
 writing.

It also includes the following:
  - a fuzzing dictionary
  - fuzzing config
  - some automake additions for the new target

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/automake.mk | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/oss-fuzz/automake.mk b/tests/oss-fuzz/automake.mk
index 3e3ac2f9c..4fbdb4c2b 100644
--- a/tests/oss-fuzz/automake.mk
+++ b/tests/oss-fuzz/automake.mk
@@ -2,7 +2,8 @@ OSS_FUZZ_TARGETS = \
tests/oss-fuzz/flow_extract_target \
tests/oss-fuzz/json_parser_target \
tests/oss-fuzz/ofp_print_target \
-   tests/oss-fuzz/expr_parse_target
+   tests/oss-fuzz/expr_parse_target \
+   tests/oss-fuzz/odp_target
 EXTRA_PROGRAMS += $(OSS_FUZZ_TARGETS)
 oss-fuzz-targets: $(OSS_FUZZ_TARGETS)
 
@@ -31,10 +32,18 @@ tests_oss_fuzz_expr_parse_target_LDADD = 
lib/libopenvswitch.la \
  ovn/lib/libovn.la
 tests_oss_fuzz_expr_parse_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++
 
+tests_oss_fuzz_odp_target_SOURCES = \
+tests/oss-fuzz/odp_target.c \
+tests/oss-fuzz/fuzzer.h
+tests_oss_fuzz_odp_target_LDADD = lib/libopenvswitch.la
+tests_oss_fuzz_odp_target_LDFLAGS = $(LIB_FUZZING_ENGINE) -lc++
+
 EXTRA_DIST += \
tests/oss-fuzz/config/flow_extract_target.options \
tests/oss-fuzz/config/json_parser_target.options \
tests/oss-fuzz/config/ofp_print_target.options \
tests/oss-fuzz/config/expr_parse_target.options \
+   tests/oss-fuzz/config/odp_target.options \
tests/oss-fuzz/config/ovs.dict \
-   tests/oss-fuzz/config/expr.dict
+   tests/oss-fuzz/config/expr.dict \
+   tests/oss-fuzz/config/odp.dict
-- 
2.17.1

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


Re: [ovs-dev] [PATCH] bridge: Fix ovs-appctl qos/show repeated queue information

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 03:55:24PM -0700, Ben Pfaff wrote:
> On Tue, Oct 02, 2018 at 07:35:27PM -0300, Flavio Leitner wrote:
> > On Tue, Oct 02, 2018 at 08:51:05AM -0400, Eelco Chaudron wrote:
> > > The patch below would stop qos/show to repeat information from the 
> > > previous queues.
> > > See below an example before and after the fix:
> > > 
> > > Before:
> > > 
> > >   $ ovs-appctl qos/show p5p2
> > >   QoS: p5p2 linux-htb
> > >   max-rate: 2428800
> > > 
> > >   Default:
> > > burst: 12512
> > > min-rate: 12000
> > > max-rate: 2428800
> > > tx_packets: 0
> > > tx_bytes: 0
> > > tx_errors: 0
> > > 
> > >   Queue 20:
> > > burst: 12512
> > > burst: 12512
> > > min-rate: 12000
> > > min-rate: 12000
> > > max-rate: 607200
> > > max-rate: 2428800
> > > tx_packets: 28780
> > > tx_bytes: 43572920
> > > tx_errors: 17611
> > > 
> > >   Queue 10:
> > > burst: 12512
> > > burst: 12512
> > > burst: 12512
> > > max-rate: 2428800
> > > max-rate: 607200
> > > max-rate: 2428800
> > > min-rate: 12000
> > > min-rate: 12000
> > > min-rate: 12000
> > > tx_packets: 71751
> > > tx_bytes: 108631014
> > > tx_errors: 18503
> > > 
> > > After:
> > > 
> > >   $ ovs-appctl qos/show p5p2
> > >   QoS: p5p2 linux-htb
> > >   max-rate: 2428800
> > > 
> > >   Default:
> > > burst: 12512
> > > min-rate: 12000
> > > max-rate: 2428800
> > > tx_packets: 0
> > > tx_bytes: 0
> > > tx_errors: 0
> > > 
> > >   Queue 20:
> > > burst: 12512
> > > min-rate: 12000
> > > max-rate: 607200
> > > tx_packets: 28780
> > > tx_bytes: 43572920
> > > tx_errors: 17611
> > > 
> > >   Queue 10:
> > > burst: 12512
> > > min-rate: 12000
> > > max-rate: 2428800
> > > tx_packets: 71751
> > > tx_bytes: 108631014
> > > tx_errors: 18503
> > > 
> > > Signed-off-by: Eelco Chaudron 
> > > ---
> > >  vswitchd/bridge.c |1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> > > index 706a07c..875bb60 100644
> > > --- a/vswitchd/bridge.c
> > > +++ b/vswitchd/bridge.c
> > > @@ -3235,6 +3235,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int 
> > > argc OVS_UNUSED,
> > >  smap_init();
> > >  NETDEV_QUEUE_FOR_EACH (_id, , , 
> > > iface->netdev) {
> > >  qos_unixctl_show_queue(queue_id, , iface, );
> > > +smap_clear();
> > >  }
> > >  smap_destroy();
> > 
> > Shouldn't that be part of NETDEV_QUEUE_FOR_EACH()?
> > It looks like ovn/controller/binding.c: setup_qos() might have the
> > same bug.
> 
> Thanks for pointing that out.  Fix coming up.

I sent a 2-patch series: 
https://patchwork.ozlabs.org/project/openvswitch/list/?series=68724
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 2/2] Revert "bridge: Fix ovs-appctl qos/show repeated queue information"

2018-10-02 Thread Ben Pfaff
This reverts commit 6b4d0211e84a ("bridge: Fix ovs-appctl qos/show
repeated queue information"), which is no longer necessary now that
commit 65f3c34c7417 ("netdev: Properly clear 'details' when iterating
in NETDEV_QOS_FOR_EACH.") has been applied.  The former commit fixed
a symptom of the root cause fixed by the latter.

Signed-off-by: Ben Pfaff 
---
 vswitchd/bridge.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 875bb607c603..706a07cc6fb9 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3235,7 +3235,6 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
 smap_init();
 NETDEV_QUEUE_FOR_EACH (_id, , , iface->netdev) {
 qos_unixctl_show_queue(queue_id, , iface, );
-smap_clear();
 }
 smap_destroy();
 
-- 
2.16.1

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


[ovs-dev] [PATCH 1/2] netdev: Properly clear 'details' when iterating in NETDEV_QOS_FOR_EACH.

2018-10-02 Thread Ben Pfaff
The function comment for netdev_queue_dump_next() said that it cleared its
'detail' argument, but it didn't actually do that, which meant that details
could be incorrectly carried along from one queue to the next.

Reported-by: Flavio Leitner 
Signed-off-by: Ben Pfaff 
---
 lib/netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/netdev.c b/lib/netdev.c
index 690d284092d4..722ea89bfeba 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -1801,8 +1801,9 @@ bool
 netdev_queue_dump_next(struct netdev_queue_dump *dump,
unsigned int *queue_id, struct smap *details)
 {
-const struct netdev *netdev = dump->netdev;
+smap_clear(details);
 
+const struct netdev *netdev = dump->netdev;
 if (dump->error) {
 return false;
 }
-- 
2.16.1

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


[ovs-dev] [PATCH RFC] datapath-windows: Remove neighbor entries when Iphelper instance is deleted

2018-10-02 Thread Anand Kumar
'OVS_IPHELPER_INSTANCE' is linked to ovsSortedIPNeighList.
So when an Iphelper instance is deleted, also delete the ip
neighboring entries associated with that instance.

Also fix accessing Iphelper instance without acquiring thelock.

Signed-off-by: Anand Kumar 
---
 datapath-windows/ovsext/IpHelper.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/datapath-windows/ovsext/IpHelper.c 
b/datapath-windows/ovsext/IpHelper.c
index 6bbd096..581be61 100644
--- a/datapath-windows/ovsext/IpHelper.c
+++ b/datapath-windows/ovsext/IpHelper.c
@@ -1446,6 +1446,17 @@ static VOID
 OvsIpHelperDeleteInstance(POVS_IPHELPER_INSTANCE instance)
 {
 if (instance) {
+if (ovsNumFwdEntries) {
+POVS_IPNEIGH_ENTRY ipn;
+PLIST_ENTRY link, next;
+LIST_FORALL_SAFE(, link, next) {
+ipn = CONTAINING_RECORD(link, OVS_IPNEIGH_ENTRY, slink);
+POVS_IPHELPER_INSTANCE ipnInstance = 
(POVS_IPHELPER_INSTANCE)ipn->context;
+if (ipnInstance == instance) {
+OvsRemoveIPNeighEntry(ipn);
+}
+}
+}
 ExDeleteResourceLite(>lock);
 OvsFreeMemoryWithTag(instance, OVS_IPHELPER_POOL_TAG);
 }
@@ -1942,13 +1953,13 @@ OvsStartIpHelper(PVOID data)
 NTSTATUS status;
 POVS_IPHELPER_INSTANCE instance = 
(POVS_IPHELPER_INSTANCE)ipn->context;
 NdisReleaseSpinLock();
-ExAcquireResourceExclusiveLite(, TRUE);
+ExAcquireResourceExclusiveLite(>lock, TRUE);
 
 status = OvsGetOrResolveIPNeigh(>internalRow,
 ipAddr, );
 OvsUpdateIPNeighEntry(ipAddr, , status);
 
-ExReleaseResourceLite();
+ExReleaseResourceLite(>lock);
 
 NdisAcquireSpinLock();
 }
@@ -2098,11 +2109,10 @@ OvsCleanupIpHelper(VOID)
 OvsFreeMemoryWithTag(ovsFwdHashTable, OVS_IPHELPER_POOL_TAG);
 OvsFreeMemoryWithTag(ovsRouteHashTable, OVS_IPHELPER_POOL_TAG);
 OvsFreeMemoryWithTag(ovsNeighHashTable, OVS_IPHELPER_POOL_TAG);
-
+OvsIpHelperDeleteAllInstances();
 NdisFreeRWLock(ovsTableLock);
 NdisFreeSpinLock();
 
-OvsIpHelperDeleteAllInstances();
 ExDeleteResourceLite();
 }
 
-- 
2.9.3.windows.1

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


Re: [ovs-dev] [PATCH] bridge: Fix ovs-appctl qos/show repeated queue information

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 07:35:27PM -0300, Flavio Leitner wrote:
> On Tue, Oct 02, 2018 at 08:51:05AM -0400, Eelco Chaudron wrote:
> > The patch below would stop qos/show to repeat information from the previous 
> > queues.
> > See below an example before and after the fix:
> > 
> > Before:
> > 
> >   $ ovs-appctl qos/show p5p2
> >   QoS: p5p2 linux-htb
> >   max-rate: 2428800
> > 
> >   Default:
> > burst: 12512
> > min-rate: 12000
> > max-rate: 2428800
> > tx_packets: 0
> > tx_bytes: 0
> > tx_errors: 0
> > 
> >   Queue 20:
> > burst: 12512
> > burst: 12512
> > min-rate: 12000
> > min-rate: 12000
> > max-rate: 607200
> > max-rate: 2428800
> > tx_packets: 28780
> > tx_bytes: 43572920
> > tx_errors: 17611
> > 
> >   Queue 10:
> > burst: 12512
> > burst: 12512
> > burst: 12512
> > max-rate: 2428800
> > max-rate: 607200
> > max-rate: 2428800
> > min-rate: 12000
> > min-rate: 12000
> > min-rate: 12000
> > tx_packets: 71751
> > tx_bytes: 108631014
> > tx_errors: 18503
> > 
> > After:
> > 
> >   $ ovs-appctl qos/show p5p2
> >   QoS: p5p2 linux-htb
> >   max-rate: 2428800
> > 
> >   Default:
> > burst: 12512
> > min-rate: 12000
> > max-rate: 2428800
> > tx_packets: 0
> > tx_bytes: 0
> > tx_errors: 0
> > 
> >   Queue 20:
> > burst: 12512
> > min-rate: 12000
> > max-rate: 607200
> > tx_packets: 28780
> > tx_bytes: 43572920
> > tx_errors: 17611
> > 
> >   Queue 10:
> > burst: 12512
> > min-rate: 12000
> > max-rate: 2428800
> > tx_packets: 71751
> > tx_bytes: 108631014
> > tx_errors: 18503
> > 
> > Signed-off-by: Eelco Chaudron 
> > ---
> >  vswitchd/bridge.c |1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> > index 706a07c..875bb60 100644
> > --- a/vswitchd/bridge.c
> > +++ b/vswitchd/bridge.c
> > @@ -3235,6 +3235,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc 
> > OVS_UNUSED,
> >  smap_init();
> >  NETDEV_QUEUE_FOR_EACH (_id, , , 
> > iface->netdev) {
> >  qos_unixctl_show_queue(queue_id, , iface, );
> > +smap_clear();
> >  }
> >  smap_destroy();
> 
> Shouldn't that be part of NETDEV_QUEUE_FOR_EACH()?
> It looks like ovn/controller/binding.c: setup_qos() might have the
> same bug.

Thanks for pointing that out.  Fix coming up.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] AUTHORS: Update or remove all Nicira email addresses.

2018-10-02 Thread Ben Pfaff
nicira.com email addresses stopped working long ago.  For folks still at
VMware, this updates them.  (Also for Martin, because I feel like it.)
For everyone else, this deletes the addresses.

Signed-off-by: Ben Pfaff 
---
 AUTHORS.rst | 120 ++--
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/AUTHORS.rst b/AUTHORS.rst
index b5f165a5daa5..59b0d2f2369a 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -47,19 +47,19 @@ Amit Bose  b...@noironetworks.com
 Amitabha Biswasazbis...@gmail.com
 Anand Kumarkumaran...@vmware.com
 Andrea Kao eirini...@gmail.com
-Andrew Evans   aev...@nicira.com
+Andrew Evans
 Andrew Beekhof abeek...@redhat.com
 Andrew Kampjes a.kamp...@gmail.com
-Andrew Lambeth w...@nicira.com
+Andrew Lambeth alamb...@vmware.com
 Andre McCurdy  armccu...@gmail.com
 Andy Hill  hil...@gmail.com
 Andy Southgate andy.southg...@citrix.com
 Andy Zhou  az...@ovn.org
 Ankur Sharma   ankursha...@vmware.com
 Anoob Somananoob.so...@citrix.com
-Ansis Atteka   aatt...@nicira.com
+Ansis Atteka   aatt...@vmware.com
 Antonio Fischetti  antonio.fische...@intel.com
-Anupam Chanda  acha...@nicira.com
+Anupam Chanda  acha...@vmware.com
 Ariel Tubaltsevatubalt...@vmware.com
 Arnoldo Lutz   arnoldo.lutz.guev...@hpe.com
 Arun Sharmaarun.sha...@calsoftinc.com
@@ -76,7 +76,7 @@ Bhanuprakash Bodireddy 
bhanuprakash.bodire...@intel.com
 Billy O'Mahony billy.o.mah...@intel.com
 Binbin Xu  xu.binb...@zte.com.cn
 Brian Kruger   bkruger+ovs...@gmail.com
-Bruce Davieb...@nicira.com
+Bruce Daviebda...@vmware.com
 Bryan Phillippeb...@toroki.com
 Carlo Andreottic.andreo...@m3s.it
 Casey Barker   crbar...@google.com
@@ -91,12 +91,12 @@ Conner Herrigesconner.herri...@ibm.com
 Damien Millescamps damien.millesca...@6wind.com
 Dan Carpenter  dan.carpen...@oracle.com
 Dan McGregor   dan.mcgre...@usask.ca
-Dan Wendlandt  d...@nicira.com
+Dan Wendlandt
 Dan Williams   d...@redhat.com
 Daniel Alvarez dalva...@redhat.com
 Daniel Borkmanndbork...@redhat.com
 Daniel Hiltgen dan...@netkine.com
-Daniel Roman   dro...@nicira.com
+Daniel Roman
 Daniele Di Proiettodaniele.di.proie...@gmail.com
 Daniele Venturino  venturino.daniele+...@gmail.com
 Danny Kukawka  danny.kuka...@bisect.de
@@ -113,7 +113,7 @@ Dominic Curran dominic.cur...@citrix.com
 Dongdong   dongdo...@huawei.com
 Dongjundo...@dtdream.com
 Duan Jiong djduanji...@gmail.com
-Duffie Cooley  dcoo...@nicira.com
+Duffie Cooley
 Dustin Lundquist   dus...@null-ptr.net
 Ed Maste   ema...@freebsd.org
 Ed Swierk  eswi...@skyportsystems.com
@@ -145,12 +145,12 @@ Gianluca Merlo 
gianluca.me...@gmail.com
 Giuseppe Lettieri  g.letti...@iet.unipi.it
 Glen Gibb  g...@stanford.edu
 Guoshuai Lil...@dtdream.com
-Guolin Yanggy...@nicira.com
+Guolin Yanggy...@vmware.com
 Guru Chaitanya Perakam gpera...@brocade.com
 Gurucharan Shetty  g...@ovn.org
 Han Zhou   zhou...@gmail.com
-Henry Mai  h...@nicira.com
-Hao Zheng  hzh...@nicira.com
+Henry Mai
+Hao Zheng
 Helmut Schaa   helmut.sc...@googlemail.com
 Hiteshi Kalra  hiteshi.ka...@tcs.com
 Huanle Han hanxue...@gmail.com
@@ -174,7 +174,7 @@ Jason Kölker   ja...@koelker.net
 Jason Wessel   jason.wes...@windriver.com
 Jasper Capel   jas...@capel.tv
 Jean Tourrilhesj...@hpl.hp.com
-Jeremy Stribling   st...@nicira.com
+Jeremy Stribling
 Jeroen van Bemmel  jvb...@gmail.com
 Jesse Grossje...@kernel.org
 Jian Lilij...@ooclab.com
@@ -189,7 +189,7 @@ JunhanYan   

Re: [ovs-dev] [PATCH v2 2/2] windows, ovn-nbctl: Add service_start call inside the server loop

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 06:01:26PM +0300, Alin Gabriel Serdean wrote:
> Currently all ovn-nbctl (daemon) tests are failing due to the missing
> call to `service_start` which is required on Windows.
> 
> Windows lacks fork so we need to pass all arguments, so we can spawn a new
> process and interpret it properly when calling `service_start`.
> 
> Signed-off-by: Alin Gabriel Serdean 
> Acked-by: Ben Pfaff 
> ---
> v2: Remove OVS_UNUSED, add acks

I think that this can be made non-Windows specific by rewriting it as
follows.

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index eabd30308ac2..7e42b53a9079 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -117,7 +117,7 @@ static char * OVS_WARN_UNUSED_RESULT main_loop(const char 
*args,
size_t n_commands,
struct ovsdb_idl *idl,
const struct timer *);
-static void server_loop(struct ovsdb_idl *idl);
+static void server_loop(struct ovsdb_idl *idl, int argc, char *argv[]);
 
 int
 main(int argc, char *argv[])
@@ -173,26 +173,24 @@ main(int argc, char *argv[])
 shash_init(_options);
 apply_options_direct(parsed_options, n_parsed_options, _options);
 free(parsed_options);
-argc -= optind;
-argv += optind;
 
 /* Initialize IDL. */
 idl = the_idl = ovsdb_idl_create(db, _idl_class, true, false);
 ovsdb_idl_set_leader_only(idl, leader_only);
 
 if (get_detach()) {
-if (argc != 0) {
+if (argc != optind) {
 ctl_fatal("non-option arguments not supported with --detach "
   "(use --help for help)");
 }
-server_loop(idl);
+server_loop(idl, argc, argv);
 } else {
 struct ctl_command *commands;
 size_t n_commands;
 char *error;
 
-error = ctl_parse_commands(argc, argv, _options, ,
-   _commands);
+error = ctl_parse_commands(argc - optind, argv + optind,
+   _options, , _commands);
 if (error) {
 ctl_fatal("%s", error);
 }
@@ -5349,11 +5347,12 @@ server_cmd_init(struct ovsdb_idl *idl, bool *exiting)
 }
 
 static void
-server_loop(struct ovsdb_idl *idl)
+server_loop(struct ovsdb_idl *idl, int argc, char *argv[])
 {
 struct unixctl_server *server = NULL;
 bool exiting = false;
 
+service_start(, );
 daemonize_start(false);
 int error = unixctl_server_create(unixctl_path, );
 if (error) {
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] bridge: Fix ovs-appctl qos/show repeated queue information

2018-10-02 Thread Flavio Leitner
On Tue, Oct 02, 2018 at 08:51:05AM -0400, Eelco Chaudron wrote:
> The patch below would stop qos/show to repeat information from the previous 
> queues.
> See below an example before and after the fix:
> 
> Before:
> 
>   $ ovs-appctl qos/show p5p2
>   QoS: p5p2 linux-htb
>   max-rate: 2428800
> 
>   Default:
> burst: 12512
> min-rate: 12000
> max-rate: 2428800
> tx_packets: 0
> tx_bytes: 0
> tx_errors: 0
> 
>   Queue 20:
> burst: 12512
> burst: 12512
> min-rate: 12000
> min-rate: 12000
> max-rate: 607200
> max-rate: 2428800
> tx_packets: 28780
> tx_bytes: 43572920
> tx_errors: 17611
> 
>   Queue 10:
> burst: 12512
> burst: 12512
> burst: 12512
> max-rate: 2428800
> max-rate: 607200
> max-rate: 2428800
> min-rate: 12000
> min-rate: 12000
> min-rate: 12000
> tx_packets: 71751
> tx_bytes: 108631014
> tx_errors: 18503
> 
> After:
> 
>   $ ovs-appctl qos/show p5p2
>   QoS: p5p2 linux-htb
>   max-rate: 2428800
> 
>   Default:
> burst: 12512
> min-rate: 12000
> max-rate: 2428800
> tx_packets: 0
> tx_bytes: 0
> tx_errors: 0
> 
>   Queue 20:
> burst: 12512
> min-rate: 12000
> max-rate: 607200
> tx_packets: 28780
> tx_bytes: 43572920
> tx_errors: 17611
> 
>   Queue 10:
> burst: 12512
> min-rate: 12000
> max-rate: 2428800
> tx_packets: 71751
> tx_bytes: 108631014
> tx_errors: 18503
> 
> Signed-off-by: Eelco Chaudron 
> ---
>  vswitchd/bridge.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
> index 706a07c..875bb60 100644
> --- a/vswitchd/bridge.c
> +++ b/vswitchd/bridge.c
> @@ -3235,6 +3235,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc 
> OVS_UNUSED,
>  smap_init();
>  NETDEV_QUEUE_FOR_EACH (_id, , , 
> iface->netdev) {
>  qos_unixctl_show_queue(queue_id, , iface, );
> +smap_clear();
>  }
>  smap_destroy();

Shouldn't that be part of NETDEV_QUEUE_FOR_EACH()?
It looks like ovn/controller/binding.c: setup_qos() might have the
same bug.

fbl

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


Re: [ovs-dev] [PATCH] bridge: Fix ovs-appctl qos/show repeated queue information

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 08:51:05AM -0400, Eelco Chaudron wrote:
> The patch below would stop qos/show to repeat information from the previous 
> queues.
> See below an example before and after the fix:

Thanks!  Applied and backported.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 1/2] ossfuzz: Fix minor bug in expr_parse_target.options

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 05:56:57PM +0200, bshas...@sect.tu-berlin.de wrote:
> From: Bhargava Shastry 
> 
> oss-fuzz options file must begin with a [libfuzzer] header. 
> This was missing in the expr_parse_target.options file which this
>  patch fixes.
> 
> Signed-off-by: Bhargava Shastry 

Thanks, I applied both of these patches to master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3] bundle: add symmetric_l3 hash method for multipath

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 09:40:09AM -0700, Martin Xu wrote:
> Add a symmetric_l3 hash method that uses both network destination
> address and network source address.
> 
> VMware-BZ: #2112940
> 
> Signed-off-by: Martin Xu 
> CC: Ben Pfaff 
> ---
> v1->v2: add eth_type as part of the hash fields; 
> added unit tests in multipath, bundle, oss-fuzz, ovs-ofctl
> v2->v3: add to the NEWS

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


Re: [ovs-dev] VERY URGENT

2018-10-02 Thread Florin Kirsi
Dear,






I am wishing you a very happy new month and the very best of all the packages 
this month has to offer. I have an imperative negotiation to talk to you about, 
Kindly contact me Via my Private Gmail address:  vivianyuan...@gmail.com for 
more details.




Best Regard.






Mrs. Yuan Vivian


Email: vivianyuan...@gmail.com


No. 212 Wang Yuen Street, Kowloon Bay Hong Kong.

?

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


Re: [ovs-dev] [PATCH v2] expr: Properly initialize expr_constant

2018-10-02 Thread Yifeng Sun
Yes, I saw that members of expr_constant are accessed in many places without
checking its type. I will work out another version.

For the subject, it is weird that I can't see [ovs-dev] added.

Thanks for your review.
Yifeng


On Tue, Oct 2, 2018 at 2:57 PM Ben Pfaff  wrote:

> On Tue, Oct 02, 2018 at 11:37:02AM -0700, Yifeng Sun wrote:
> > expr_constant.masked may be uninitialized when its type is EXPR_C_STRING.
> > This patch fixes this issue.
> >
> > Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10731
> > Signed-off-by: Yifeng Sun 
>
> Thanks for working to fix the bugs reported by the fuzzer.
>
> I don't understand this fix.  expr_constant is a union.  If an instance
> has type EXPR_C_STRING, then its 'masked' member must not be accessed,
> because that member is only relevant when it has type EXPR_C_INTEGER.
>
> > v1->v2: Fix email subject by adding [ovs-dev]
>
> I don't understand this either.  The mailing list itself adds [ovs-dev].
>
> Thanks,
>
> Ben.
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] extend-table: Fix a bug that iterates wrong table

2018-10-02 Thread Yifeng Sun
Good idea, let me work out a new version.

Thanks,
Yifeng

On Tue, Oct 2, 2018 at 3:03 PM Ben Pfaff  wrote:

> On Tue, Oct 02, 2018 at 11:37:03AM -0700, Yifeng Sun wrote:
> > This seems to be a copy and paste bug that iterates and frees
> > the wrong table. This commit fixes that.
> >
> > Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10730
> > Signed-off-by: Yifeng Sun 
> > ---
> > v1->v2: Fix email subject by adding [ovs-dev]
>
> Thank you for the fix.  It is valuable.
>
> Do you mind if we eliminate the code duplication, like this?
>
> Thanks,
>
> Ben.
>
> diff --git a/ovn/lib/extend-table.c b/ovn/lib/extend-table.c
> index 511d1a84b0c0..e42822be8ec1 100644
> --- a/ovn/lib/extend-table.c
> +++ b/ovn/lib/extend-table.c
> @@ -33,26 +33,24 @@ ovn_extend_table_init(struct ovn_extend_table *table)
>  hmap_init(>existing);
>  }
>
> +static void
> +ovn_extend_table_info_destroy(struct hmap *target)
> +{
> +struct ovn_extend_table_info *e, *next;
> +HMAP_FOR_EACH_SAFE (e, next, hmap_node, target) {
> +hmap_remove(target, >hmap_node);
> +free(e->name);
> +free(e);
> +}
> +hmap_destroy(target);
> +}
> +
>  void
>  ovn_extend_table_destroy(struct ovn_extend_table *table)
>  {
>  bitmap_free(table->table_ids);
> -
> -struct ovn_extend_table_info *desired, *d_next;
> -HMAP_FOR_EACH_SAFE (desired, d_next, hmap_node, >existing) {
> -hmap_remove(>existing, >hmap_node);
> -free(desired->name);
> -free(desired);
> -}
> -hmap_destroy(>desired);
> -
> -struct ovn_extend_table_info *existing, *e_next;
> -HMAP_FOR_EACH_SAFE (existing, e_next, hmap_node, >existing) {
> -hmap_remove(>existing, >hmap_node);
> -free(existing->name);
> -free(existing);
> -}
> -hmap_destroy(>existing);
> +ovn_extend_table_info_destroy(>desired);
> +ovn_extend_table_info_destroy(>existing);
>  }
>
>  /* Finds and returns a group_info in 'existing' whose key is identical
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] extend-table: Fix a bug that iterates wrong table

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 11:37:03AM -0700, Yifeng Sun wrote:
> This seems to be a copy and paste bug that iterates and frees
> the wrong table. This commit fixes that.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10730
> Signed-off-by: Yifeng Sun 
> ---
> v1->v2: Fix email subject by adding [ovs-dev]

Thank you for the fix.  It is valuable.

Do you mind if we eliminate the code duplication, like this?

Thanks,

Ben.

diff --git a/ovn/lib/extend-table.c b/ovn/lib/extend-table.c
index 511d1a84b0c0..e42822be8ec1 100644
--- a/ovn/lib/extend-table.c
+++ b/ovn/lib/extend-table.c
@@ -33,26 +33,24 @@ ovn_extend_table_init(struct ovn_extend_table *table)
 hmap_init(>existing);
 }
 
+static void
+ovn_extend_table_info_destroy(struct hmap *target)
+{
+struct ovn_extend_table_info *e, *next;
+HMAP_FOR_EACH_SAFE (e, next, hmap_node, target) {
+hmap_remove(target, >hmap_node);
+free(e->name);
+free(e);
+}
+hmap_destroy(target);
+}
+
 void
 ovn_extend_table_destroy(struct ovn_extend_table *table)
 {
 bitmap_free(table->table_ids);
-
-struct ovn_extend_table_info *desired, *d_next;
-HMAP_FOR_EACH_SAFE (desired, d_next, hmap_node, >existing) {
-hmap_remove(>existing, >hmap_node);
-free(desired->name);
-free(desired);
-}
-hmap_destroy(>desired);
-
-struct ovn_extend_table_info *existing, *e_next;
-HMAP_FOR_EACH_SAFE (existing, e_next, hmap_node, >existing) {
-hmap_remove(>existing, >hmap_node);
-free(existing->name);
-free(existing);
-}
-hmap_destroy(>existing);
+ovn_extend_table_info_destroy(>desired);
+ovn_extend_table_info_destroy(>existing);
 }
 
 /* Finds and returns a group_info in 'existing' whose key is identical
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] expr: Properly initialize expr_constant

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 11:37:02AM -0700, Yifeng Sun wrote:
> expr_constant.masked may be uninitialized when its type is EXPR_C_STRING.
> This patch fixes this issue.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10731
> Signed-off-by: Yifeng Sun 

Thanks for working to fix the bugs reported by the fuzzer.

I don't understand this fix.  expr_constant is a union.  If an instance
has type EXPR_C_STRING, then its 'masked' member must not be accessed,
because that member is only relevant when it has type EXPR_C_INTEGER.

> v1->v2: Fix email subject by adding [ovs-dev]

I don't understand this either.  The mailing list itself adds [ovs-dev].

Thanks,

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


Re: [ovs-dev] [PATCH v3] lex: Fix stack underflow bug reported by Fuzz

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 01:20:42PM -0700, Yifeng Sun wrote:
> In previous code, if hexit == 0, then the boundary for 'out' is
> not checked. This patch fixes it.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
> Signed-off-by: Yifeng Sun 
> ---
> v1->v2: Fix email subject by adding [ovs-dev]
> v2->v3: Fix the code to handle any number of leading zeros, thanks Ben!

Thanks, applied and backported.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] lex: Fix stack underflow bug and improve loop

2018-10-02 Thread Yifeng Sun
Thanks Ben for the review, I sent a v3.

On Tue, Oct 2, 2018 at 11:41 AM Ben Pfaff  wrote:

> On Tue, Oct 02, 2018 at 11:26:23AM -0700, Yifeng Sun wrote:
> > In previous code, if hexit == 0, then the boundary for 'out' is
> > not checked. This patch fixes it and also takes the checking out
> > of loop to improve loop's performance.
> >
> > Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
> > Signed-off-by: Yifeng Sun 
>
> Thanks for the fix!
>
> I think that my goal here was to ignore any number of leading zeros,
> more like this:
>
> diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
> index 0514950de6bf..a5237091a46b 100644
> --- a/ovn/lib/lex.c
> +++ b/ovn/lib/lex.c
> @@ -332,13 +332,14 @@ lex_parse_hex_integer(const char *start, size_t len,
> struct lex_token *token)
>  if (hexit < 0) {
>  lex_error(token, "Invalid syntax in hexadecimal constant.");
>  return;
> +} else if (hexit) {
> +if (i / 2 >= sizeof token->value.u8) {
> +lex_error(token, "Hexadecimal constant requires more than
> "
> +  "%"PRIuSIZE" bits.", 8 * sizeof
> token->value.u8);
> +return;
> +}
> +out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
>  }
> -if (hexit && i / 2 >= sizeof token->value.u8) {
> -lex_error(token, "Hexadecimal constant requires more than "
> -  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
> -return;
> -}
> -out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
>  }
>  token->format = LEX_F_HEXADECIMAL;
>  }
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v3] lex: Fix stack underflow bug reported by Fuzz

2018-10-02 Thread Yifeng Sun
In previous code, if hexit == 0, then the boundary for 'out' is
not checked. This patch fixes it.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
Signed-off-by: Yifeng Sun 
---
v1->v2: Fix email subject by adding [ovs-dev]
v2->v3: Fix the code to handle any number of leading zeros, thanks Ben!

 ovn/lib/lex.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
index 0514950de6bf..7a2ab4111e50 100644
--- a/ovn/lib/lex.c
+++ b/ovn/lib/lex.c
@@ -332,13 +332,15 @@ lex_parse_hex_integer(const char *start, size_t len, 
struct lex_token *token)
 if (hexit < 0) {
 lex_error(token, "Invalid syntax in hexadecimal constant.");
 return;
+} else if (hexit) {
+/* Check within loop to ignore any number of leading zeros. */
+if (i / 2 >= sizeof token->value.u8) {
+lex_error(token, "Hexadecimal constant requires more than "
+  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
+return;
+}
+out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
-if (hexit && i / 2 >= sizeof token->value.u8) {
-lex_error(token, "Hexadecimal constant requires more than "
-  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
-return;
-}
-out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
 token->format = LEX_F_HEXADECIMAL;
 }
-- 
2.7.4

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


Re: [ovs-dev] [PATCH] lex: Fix stack underflow bug and improve loop

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 11:26:23AM -0700, Yifeng Sun wrote:
> In previous code, if hexit == 0, then the boundary for 'out' is
> not checked. This patch fixes it and also takes the checking out
> of loop to improve loop's performance.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
> Signed-off-by: Yifeng Sun 

Thanks for the fix!

I think that my goal here was to ignore any number of leading zeros,
more like this:

diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
index 0514950de6bf..a5237091a46b 100644
--- a/ovn/lib/lex.c
+++ b/ovn/lib/lex.c
@@ -332,13 +332,14 @@ lex_parse_hex_integer(const char *start, size_t len, 
struct lex_token *token)
 if (hexit < 0) {
 lex_error(token, "Invalid syntax in hexadecimal constant.");
 return;
+} else if (hexit) {
+if (i / 2 >= sizeof token->value.u8) {
+lex_error(token, "Hexadecimal constant requires more than "
+  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
+return;
+}
+out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
-if (hexit && i / 2 >= sizeof token->value.u8) {
-lex_error(token, "Hexadecimal constant requires more than "
-  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
-return;
-}
-out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
 token->format = LEX_F_HEXADECIMAL;
 }
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] lex: Fix stack underflow bug and improve loop

2018-10-02 Thread Yifeng Sun
Sorry just realized my patches are missing the [ovs-dev] in the subjects.
Resend v2.

On Tue, Oct 2, 2018 at 11:26 AM Yifeng Sun  wrote:

> In previous code, if hexit == 0, then the boundary for 'out' is
> not checked. This patch fixes it and also takes the checking out
> of loop to improve loop's performance.
>
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
> Signed-off-by
> :
> Yifeng Sun 
> ---
>  ovn/lib/lex.c | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
> index 0514950de6bf..269267730526 100644
> --- a/ovn/lib/lex.c
> +++ b/ovn/lib/lex.c
> @@ -327,17 +327,18 @@ lex_parse_hex_integer(const char *start, size_t len,
> struct lex_token *token)
>  const char *in = start + (len - 1);
>  uint8_t *out = token->value.u8 + (sizeof token->value.u8 - 1);
>
> +if ((len - 1) / 2 >= sizeof token->value.u8) {
> +lex_error(token, "Hexadecimal constant requires more than "
> +  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
> +return;
> +}
> +
>  for (int i = 0; i < len; i++) {
>  int hexit = hexit_value(in[-i]);
>  if (hexit < 0) {
>  lex_error(token, "Invalid syntax in hexadecimal constant.");
>  return;
>  }
> -if (hexit && i / 2 >= sizeof token->value.u8) {
> -lex_error(token, "Hexadecimal constant requires more than "
> -  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
> -return;
> -}
>  out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
>  }
>  token->format = LEX_F_HEXADECIMAL;
> --
> 2.7.4
>
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] lex: Fix stack underflow bug and improve loop

2018-10-02 Thread Yifeng Sun
In previous code, if hexit == 0, then the boundary for 'out' is
not checked. This patch fixes it and also takes the checking out
of loop to improve loop's performance.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
Signed-off-by: Yifeng Sun 
---
v1->v2: Fix email subject by adding [ovs-dev]

 ovn/lib/lex.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
index 0514950de6bf..269267730526 100644
--- a/ovn/lib/lex.c
+++ b/ovn/lib/lex.c
@@ -327,17 +327,18 @@ lex_parse_hex_integer(const char *start, size_t len, 
struct lex_token *token)
 const char *in = start + (len - 1);
 uint8_t *out = token->value.u8 + (sizeof token->value.u8 - 1);
 
+if ((len - 1) / 2 >= sizeof token->value.u8) {
+lex_error(token, "Hexadecimal constant requires more than "
+  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
+return;
+}
+
 for (int i = 0; i < len; i++) {
 int hexit = hexit_value(in[-i]);
 if (hexit < 0) {
 lex_error(token, "Invalid syntax in hexadecimal constant.");
 return;
 }
-if (hexit && i / 2 >= sizeof token->value.u8) {
-lex_error(token, "Hexadecimal constant requires more than "
-  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
-return;
-}
 out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
 token->format = LEX_F_HEXADECIMAL;
-- 
2.7.4

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


[ovs-dev] [PATCH v2] extend-table: Fix a bug that iterates wrong table

2018-10-02 Thread Yifeng Sun
This seems to be a copy and paste bug that iterates and frees
the wrong table. This commit fixes that.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10730
Signed-off-by: Yifeng Sun 
---
v1->v2: Fix email subject by adding [ovs-dev]

 ovn/lib/extend-table.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ovn/lib/extend-table.c b/ovn/lib/extend-table.c
index 511d1a84b0c0..aba0b2e68b2c 100644
--- a/ovn/lib/extend-table.c
+++ b/ovn/lib/extend-table.c
@@ -39,8 +39,8 @@ ovn_extend_table_destroy(struct ovn_extend_table *table)
 bitmap_free(table->table_ids);
 
 struct ovn_extend_table_info *desired, *d_next;
-HMAP_FOR_EACH_SAFE (desired, d_next, hmap_node, >existing) {
-hmap_remove(>existing, >hmap_node);
+HMAP_FOR_EACH_SAFE (desired, d_next, hmap_node, >desired) {
+hmap_remove(>desired, >hmap_node);
 free(desired->name);
 free(desired);
 }
-- 
2.7.4

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


[ovs-dev] [PATCH v2] expr: Properly initialize expr_constant

2018-10-02 Thread Yifeng Sun
expr_constant.masked may be uninitialized when its type is EXPR_C_STRING.
This patch fixes this issue.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10731
Signed-off-by: Yifeng Sun 
---
v1->v2: Fix email subject by adding [ovs-dev]

 include/ovn/expr.h | 10 +-
 ovn/lib/expr.c |  4 
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/ovn/expr.h b/include/ovn/expr.h
index 3995e62f066c..8d3cab399bf0 100644
--- a/include/ovn/expr.h
+++ b/include/ovn/expr.h
@@ -450,7 +450,9 @@ enum expr_constant_type {
 EXPR_C_STRING
 };
 
-/* A string or integer constant (one must know which from context). */
+/* A string or integer constant (one must know which from context).
+ * It should be initialized through expr_constant_init().
+ */
 union expr_constant {
 /* Integer constant.
  *
@@ -469,6 +471,12 @@ union expr_constant {
 char *string;
 };
 
+static inline void
+expr_constant_init(union expr_constant *c)
+{
+memset(c, 0, sizeof *c);
+}
+
 bool expr_constant_parse(struct lexer *, const struct expr_field *,
  union expr_constant *);
 void expr_constant_format(const union expr_constant *,
diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c
index 148ac869e861..0a2cef2f0ee9 100644
--- a/ovn/lib/expr.c
+++ b/ovn/lib/expr.c
@@ -805,6 +805,7 @@ parse_constant(struct expr_context *ctx, struct 
expr_constant_set *cs,
 }
 
 union expr_constant *c = >values[cs->n_values++];
+expr_constant_init(c);
 c->value = ctx->lexer->token.value;
 c->format = ctx->lexer->token.format;
 c->masked = ctx->lexer->token.type == LEX_T_MASKED_INTEGER;
@@ -1004,6 +1005,7 @@ expr_const_sets_add(struct shash *const_sets, const char 
*name,
   values[i], lex.token.type);
 } else {
 union expr_constant *c = >values[cs->n_values++];
+expr_constant_init(c);
 c->value = lex.token.value;
 c->format = lex.token.format;
 c->masked = lex.token.type == LEX_T_MASKED_INTEGER;
@@ -1017,6 +1019,7 @@ expr_const_sets_add(struct shash *const_sets, const char 
*name,
 cs->type = EXPR_C_STRING;
 for (size_t i = 0; i < n_values; i++) {
 union expr_constant *c = >values[cs->n_values++];
+expr_constant_init(c);
 c->string = xstrdup(values[i]);
 }
 }
@@ -1120,6 +1123,7 @@ expr_parse_primary(struct expr_context *ctx, bool *atomic)
 *atomic = true;
 
 union expr_constant *cst = xzalloc(sizeof *cst);
+expr_constant_init(cst);
 cst->format = LEX_F_HEXADECIMAL;
 cst->masked = false;
 
-- 
2.7.4

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


[ovs-dev] [PATCH] lex: Fix stack underflow bug and improve loop

2018-10-02 Thread Yifeng Sun
In previous code, if hexit == 0, then the boundary for 'out' is
not checked. This patch fixes it and also takes the checking out
of loop to improve loop's performance.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10710
Signed-off-by: Yifeng Sun 
---
 ovn/lib/lex.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
index 0514950de6bf..269267730526 100644
--- a/ovn/lib/lex.c
+++ b/ovn/lib/lex.c
@@ -327,17 +327,18 @@ lex_parse_hex_integer(const char *start, size_t len, 
struct lex_token *token)
 const char *in = start + (len - 1);
 uint8_t *out = token->value.u8 + (sizeof token->value.u8 - 1);
 
+if ((len - 1) / 2 >= sizeof token->value.u8) {
+lex_error(token, "Hexadecimal constant requires more than "
+  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
+return;
+}
+
 for (int i = 0; i < len; i++) {
 int hexit = hexit_value(in[-i]);
 if (hexit < 0) {
 lex_error(token, "Invalid syntax in hexadecimal constant.");
 return;
 }
-if (hexit && i / 2 >= sizeof token->value.u8) {
-lex_error(token, "Hexadecimal constant requires more than "
-  "%"PRIuSIZE" bits.", 8 * sizeof token->value.u8);
-return;
-}
 out[-(i / 2)] |= i % 2 ? hexit << 4 : hexit;
 }
 token->format = LEX_F_HEXADECIMAL;
-- 
2.7.4

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


Re: [ovs-dev] [PATCH v2 2/2] Makes stylistic change suggested by 0-day robot.

2018-10-02 Thread Ben Pfaff
On Fri, Sep 28, 2018 at 07:42:21PM +0200, Bhargava Shastry wrote:
> Hi Ben,
> 
> > 25 seconds would be really long.  I think you could reasonably lower
> > it to just 1 or 2 seconds.
> 
> Somehow, even the 25 second timeout is being exceeded with non-trivial
> frequency. I'm afraid that if we lower it to 1-2 seconds, oss-fuzz is
> going to file a lot of bugs. I am trying out the tests locally, and the
> fuzzer reports timeouts of 15-20 seconds fairly quickly.

OK, probably the 25-second timeouts indicate bugs.  I'll investigate, at
some point.

> > Sometimes the inputs can get large in practice, because they are often
> > machine-generated.
> 
> OK. Would imposing a limit of 4096 bytes be sufficient to handle the
> machine-generated use-case?

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


Re: [ovs-dev] [PATCH 1/2] OVN: add buffering support for ipv4 packets

2018-10-02 Thread Ben Pfaff
Thanks for all the responses!  I'll comment on a few:

On Mon, Oct 01, 2018 at 06:26:05PM +0200, Lorenzo Bianconi wrote:
> On Sep 26, Ben Pfaff wrote:
> > A 30-second timeout seems long to me.  After that long, the sender will
> > have retransmitted the packet, probably multiple times.  I wasn't able
> > to figure out how long Linux buffers packets.
> > 
> 
> afaiu Linux neighbor subsystem removes an unresolved entry after a
> given number of attempts (~5). The default value for NEIGH_VAR_RETRANS_TIME
> is 1s, so I guess we can use 5s here as BUFFER_MAP_TIMEOUT?

That sounds reasonable to me.

> > Do you think it makes sense to use the same timestamp for all of the
> > packets buffered for a single IP?  I believe that, currently, no packets
> > will ever expire from a buffer unless either the buffer limit is
> > exceeded or no new packets have been queued for the timeout interval.  I
> > think that would mean that there could be a packet buffered for a total
> > of 30 + 64 seconds.
> 
> Stale timeout was intended for buffered_packets_map entries and not for 
> packets
> buffered for a single IP. However reviewing the code I agree that wait
> so long for a given packet is not useful. On the other hand if we set queue
> depth to 3 or so I guess it will not make a huge difference. Do you agree?
> Anyway we can add per-packet timeout instead of per entry one

I agree that with a small queue depth, it doesn't matter as much, so I
think either place for a timeout is fine.

Thanks,

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


Re: [ovs-dev] [PATCH] dp-packet.h: move funcs to be within cond block

2018-10-02 Thread Ben Pfaff
For what it's worth, Ian, I'm hoping that you'll take a look at this and
decide whether to merge it.

On Tue, Oct 02, 2018 at 10:32:40AM +0100, Lam, Tiago wrote:
> (Sending this again as yesterday's email seems to have been dropped.)
> 
> Hi Flavio,
> 
> Thanks for the patch. Looks good to me, it compiles with both DPDK and
> without DPDK linked, and the check-system-userspace tests pass.
> 
> Acked-by: Tiago Lam 
> 
> On 25/09/2018 22:08, Flavio Leitner wrote:
> > There is already an ifdef DPDK_NETDEV block, so instead of checking
> > on each and every function, move them to the right block.
> > 
> > No functional change.
> > 
> > Signed-off-by: Flavio Leitner 
> > ---
> >  lib/dp-packet.h | 260 
> > +++-
> >  1 file changed, 146 insertions(+), 114 deletions(-)
> > 
> > diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> > index ba91e5891..5b4c9c7a3 100644
> > --- a/lib/dp-packet.h
> > +++ b/lib/dp-packet.h
> > @@ -465,113 +465,142 @@ dp_packet_set_allocated(struct dp_packet *b, 
> > uint16_t s)
> >  {
> >  b->mbuf.buf_len = s;
> >  }
> > -#else
> > -static inline void *
> > -dp_packet_base(const struct dp_packet *b)
> > +
> > +/* Returns the RSS hash of the packet 'p'.  Note that the returned value is
> > + * correct only if 'dp_packet_rss_valid(p)' returns true */
> > +static inline uint32_t
> > +dp_packet_get_rss_hash(struct dp_packet *p)
> >  {
> > -return b->base_;
> > +return p->mbuf.hash.rss;
> >  }
> >  
> >  static inline void
> > -dp_packet_set_base(struct dp_packet *b, void *d)
> > +dp_packet_set_rss_hash(struct dp_packet *p, uint32_t hash)
> >  {
> > -b->base_ = d;
> > +p->mbuf.hash.rss = hash;
> > +p->mbuf.ol_flags |= PKT_RX_RSS_HASH;
> >  }
> >  
> > -static inline uint32_t
> > -dp_packet_size(const struct dp_packet *b)
> > +static inline bool
> > +dp_packet_rss_valid(struct dp_packet *p)
> >  {
> > -return b->size_;
> > +return p->mbuf.ol_flags & PKT_RX_RSS_HASH;
> >  }
> >  
> >  static inline void
> > -dp_packet_set_size(struct dp_packet *b, uint32_t v)
> > +dp_packet_rss_invalidate(struct dp_packet *p OVS_UNUSED)
> >  {
> > -b->size_ = v;
> >  }
> >  
> > -static inline uint16_t
> > -__packet_data(const struct dp_packet *b)
> > +static inline void
> > +dp_packet_mbuf_rss_flag_reset(struct dp_packet *p)
> >  {
> > -return b->data_ofs;
> > +p->mbuf.ol_flags &= ~PKT_RX_RSS_HASH;
> >  }
> >  
> > +/* This initialization is needed for packets that do not come
> > + * from DPDK interfaces, when vswitchd is built with --with-dpdk.
> > + * The DPDK rte library will still otherwise manage the mbuf.
> > + * We only need to initialize the mbuf ol_flags. */
> >  static inline void
> > -__packet_set_data(struct dp_packet *b, uint16_t v)
> > +dp_packet_mbuf_init(struct dp_packet *p)
> >  {
> > -b->data_ofs = v;
> > +p->mbuf.ol_flags = 0;
> >  }
> >  
> > -static inline uint16_t
> > -dp_packet_get_allocated(const struct dp_packet *b)
> > +static inline bool
> > +dp_packet_ip_checksum_valid(struct dp_packet *p)
> >  {
> > -return b->allocated_;
> > +return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
> > +PKT_RX_IP_CKSUM_GOOD;
> >  }
> >  
> > -static inline void
> > -dp_packet_set_allocated(struct dp_packet *b, uint16_t s)
> > +static inline bool
> > +dp_packet_ip_checksum_bad(struct dp_packet *p)
> >  {
> > -b->allocated_ = s;
> > +return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
> > +PKT_RX_IP_CKSUM_BAD;
> > +}
> > +
> > +static inline bool
> > +dp_packet_l4_checksum_valid(struct dp_packet *p)
> > +{
> > +return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
> > +PKT_RX_L4_CKSUM_GOOD;
> > +}
> > +
> > +static inline bool
> > +dp_packet_l4_checksum_bad(struct dp_packet *p)
> > +{
> > +return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
> > +PKT_RX_L4_CKSUM_BAD;
> >  }
> > -#endif
> >  
> >  static inline void
> > -dp_packet_reset_cutlen(struct dp_packet *b)
> > +reset_dp_packet_checksum_ol_flags(struct dp_packet *p)
> >  {
> > -b->cutlen = 0;
> > +p->mbuf.ol_flags &= ~(PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> > +  PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD);
> >  }
> >  
> > -static inline uint32_t
> > -dp_packet_set_cutlen(struct dp_packet *b, uint32_t max_len)
> > +static inline bool
> > +dp_packet_has_flow_mark(struct dp_packet *p, uint32_t *mark)
> >  {
> > -if (max_len < ETH_HEADER_LEN) {
> > -max_len = ETH_HEADER_LEN;
> > +if (p->mbuf.ol_flags & PKT_RX_FDIR_ID) {
> > +*mark = p->mbuf.hash.fdir.hi;
> > +return true;
> >  }
> >  
> > -if (max_len >= dp_packet_size(b)) {
> > -b->cutlen = 0;
> > -} else {
> > -b->cutlen = dp_packet_size(b) - max_len;
> > -}
> > -return b->cutlen;
> > +return false;
> >  }
> >  
> > -static inline uint32_t
> > -dp_packet_get_cutlen(const struct dp_packet *b)
> > +#else /* DPDK_NETDEV */

Re: [ovs-dev] Ovsdb delete bridge fails with "referential integrity violationDetails"

2018-10-02 Thread Ben Pfaff
On Tue, Oct 02, 2018 at 11:17:04AM +, Serguei Bezverkhi (sbezverk) via dev 
wrote:
> Hello,
> 
> I am trying to use rpc to delete a bridge but the sequence fails with this 
> error: " referential integrity violationDetails " , the create operations 
> works perfectly fine though.
> 
> Here are the operations:
> 
> Transaction: [
> {Op:delete Table:Bridge Row:map[] Rows:[] Columns:[] Mutations:[] Timeout:0 
> Where:[[name == test-1]] Until: UUIDName:} 
> {Op:mutate Table:Open_vSwitch Row:map[] Rows:[] Columns:[] 
> Mutations:[[bridges delete 0xc0002a21e0]] Timeout:0 Where:[[_uuid == 
> {GoUUID:580f43bb-0896-4f31-b3f3-1aafe1a4ed58}]] Until: UUIDName:}] 
> 
> Failed with error: OVS Transaction failed err referential integrity 
> violationDetails: cannot delete Bridge row 
> 45dad59b-547e-4e1c-88d4-4923ba531492 because of 1 remaining reference(s) 
> 
> But as you can see show does not show any child objects for bridge "test-1".
> 
> kubectl exec nsm-ovs-daemon-b48nv -- ovs-vsctl show
> 580f43bb-0896-4f31-b3f3-1aafe1a4ed58
> Bridge "test-1"

Can you show the transaction in some format supported by OVSDB?  This
isn't JSON and I don't know what JSON it corresponds to.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath-windows: Move OVS_IPHELPER_INSTANCE to IpHelper.h

2018-10-02 Thread Alin Gabriel Serdean
Applied on master!

> On 2 Oct 2018, at 16:16, Alin Gabriel Serdean  wrote:
> 
> 
> 
>> On 30 Sep 2018, at 14:53, Alin Gabriel Serdean > > wrote:
>> 
>>> 
>>> Move the IPHelper Instance to the main header file and update the usage to
>>> explicitly point to POVS_IPHELPER_INSTANCE instead of PVOID. Also rename
>>> the ipn->context to ipn->instance to make it more readable.
>>> 
>>> Found by inspection.
>>> 
>>> Signed-off-by: Sairam Venugopal >> >
>>> —
>>> 
>> 
>> Thanks for the patch!
>> 
>> Acked-by: Alin Gabriel Serdean mailto:aserd...@ovn.org>>
>> 
>> 
>> 
> 
> Acked-by: Alin Gabriel Serdean mailto:aserd...@ovn.org>>

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


[ovs-dev] [PATCH v3] bundle: add symmetric_l3 hash method for multipath

2018-10-02 Thread Martin Xu
Add a symmetric_l3 hash method that uses both network destination
address and network source address.

VMware-BZ: #2112940

Signed-off-by: Martin Xu 
CC: Ben Pfaff 
---
v1->v2: add eth_type as part of the hash fields; 
added unit tests in multipath, bundle, oss-fuzz, ovs-ofctl
v2->v3: add to the NEWS

 NEWS |   1 +
 include/openflow/nicira-ext.h|   4 +-
 lib/bundle.c |   2 +
 lib/flow.c   |  47 +-
 lib/flow.h   |   1 +
 lib/multipath.c  |   2 +
 tests/bundle.at  | 179 +++
 tests/multipath.at   | 271 +++
 tests/oss-fuzz/flow_extract_target.c |   1 +
 tests/ovs-ofctl.at   |  12 ++
 utilities/ovs-ofctl.8.in |   2 +
 11 files changed, 520 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 8b6f3ce..2e478b9 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Post-v2.10.0
- DPDK:
  * Add option for simple round-robin based Rxq to PMD assignment.
It can be set with pmd-rxq-assign.
+   - Add 'symmetric_l3' hash function.
 
 v2.10.0 - 18 Aug 2018
 -
diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index 1f5cbbf..dc12101 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -109,8 +109,10 @@ enum nx_hash_fields {
 NX_HASH_FIELDS_NW_SRC,
 
 /* Network destination address (NXM_OF_IP_DST) only. */
-NX_HASH_FIELDS_NW_DST
+NX_HASH_FIELDS_NW_DST,
 
+/* Both network destination and source destination addresses. */
+NX_HASH_FIELDS_SYMMETRIC_L3
 };
 
 /* NXT_PACKET_IN (analogous to OFPT_PACKET_IN).
diff --git a/lib/bundle.c b/lib/bundle.c
index edf6676..558e890 100644
--- a/lib/bundle.c
+++ b/lib/bundle.c
@@ -198,6 +198,8 @@ bundle_parse__(const char *s, const struct ofputil_port_map 
*port_map,
 bundle->fields = NX_HASH_FIELDS_NW_SRC;
 } else if (!strcasecmp(fields, "nw_dst")) {
 bundle->fields = NX_HASH_FIELDS_NW_DST;
+} else if (!strcasecmp(fields, "symmetric_l3")) {
+bundle->fields = NX_HASH_FIELDS_SYMMETRIC_L3;
 } else {
 return xasprintf("%s: unknown fields `%s'", s, fields);
 }
diff --git a/lib/flow.c b/lib/flow.c
index bffee70..79e4627 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -2307,6 +2307,37 @@ flow_hash_symmetric_l3l4(const struct flow *flow, 
uint32_t basis,
 return hash_finish(hash, basis);
 }
 
+/* Hashes 'flow' based on its nw_dst and nw_src for multipath. */
+uint32_t
+flow_hash_symmetric_l3(const struct flow *flow, uint32_t basis)
+{
+struct {
+union {
+ovs_be32 ipv4_addr;
+struct in6_addr ipv6_addr;
+};
+ovs_be16 eth_type;
+} fields;
+
+int i;
+
+memset(, 0, sizeof fields);
+fields.eth_type = flow->dl_type;
+
+if (fields.eth_type == htons(ETH_TYPE_IP)) {
+fields.ipv4_addr = flow->nw_src ^ flow->nw_dst;
+} else if (fields.eth_type == htons(ETH_TYPE_IPV6)) {
+const uint8_t *a = >ipv6_src.s6_addr[0];
+const uint8_t *b = >ipv6_dst.s6_addr[0];
+uint8_t *ipv6_addr = _addr.s6_addr[0];
+
+for (i = 0; i < 16; i++) {
+ipv6_addr[i] = a[i] ^ b[i];
+}
+}
+return jhash_bytes(, sizeof fields, basis);
+}
+
 /* Initialize a flow with random fields that matter for nx_hash_fields. */
 void
 flow_random_hash_fields(struct flow *flow)
@@ -2422,6 +2453,16 @@ flow_mask_hash_fields(const struct flow *flow, struct 
flow_wildcards *wc,
 }
 break;
 
+case NX_HASH_FIELDS_SYMMETRIC_L3:
+if (flow->dl_type == htons(ETH_TYPE_IP)) {
+memset(>masks.nw_src, 0xff, sizeof wc->masks.nw_src);
+memset(>masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
+} else if (flow->dl_type == htons(ETH_TYPE_IPV6)) {
+memset(>masks.ipv6_src, 0xff, sizeof wc->masks.ipv6_src);
+memset(>masks.ipv6_dst, 0xff, sizeof wc->masks.ipv6_dst);
+}
+break;
+
 default:
 OVS_NOT_REACHED();
 }
@@ -2464,6 +2505,8 @@ flow_hash_fields(const struct flow *flow, enum 
nx_hash_fields fields,
 return basis;
 }
 
+case NX_HASH_FIELDS_SYMMETRIC_L3:
+return flow_hash_symmetric_l3(flow, basis);
 }
 
 OVS_NOT_REACHED();
@@ -2480,6 +2523,7 @@ flow_hash_fields_to_str(enum nx_hash_fields fields)
 case NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP: return "symmetric_l3l4+udp";
 case NX_HASH_FIELDS_NW_SRC: return "nw_src";
 case NX_HASH_FIELDS_NW_DST: return "nw_dst";
+case NX_HASH_FIELDS_SYMMETRIC_L3: return "symmetric_l3";
 default: return "";
 }
 }
@@ -2493,7 +2537,8 @@ flow_hash_fields_valid(enum nx_hash_fields fields)
 || fields == NX_HASH_FIELDS_SYMMETRIC_L3L4
 || fields == NX_HASH_FIELDS_SYMMETRIC_L3L4_UDP
 || fields == 

[ovs-dev] [PATCH 2/2] ossfuzz: Remove max_len=100 option

2018-10-02 Thread bshastry
From: Bhargava Shastry 

The max_len field, which stipulates the maximum length of
 fuzzed input to feed a fuzzer target, was set to 100 for 
the ovn expr_parse_target.

In discussions with Ben, this was deemed too restrictive.
Google folks also suggested the removal of this option 
since it cannot be uniformly passed on to all fuzzer 
engines behind oss-fuzz.

For the future, the suggested way to limit the length of
 fuzzed input is in the C code of the test harness itself.

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/config/expr_parse_target.options | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/oss-fuzz/config/expr_parse_target.options 
b/tests/oss-fuzz/config/expr_parse_target.options
index 4dfedfd84..fc254e84f 100644
--- a/tests/oss-fuzz/config/expr_parse_target.options
+++ b/tests/oss-fuzz/config/expr_parse_target.options
@@ -1,4 +1,3 @@
 [libfuzzer]
 dict = expr.dict
 close_fd_mask = 3
-max_len = 100
-- 
2.17.1

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


[ovs-dev] [PATCH 1/2] ossfuzz: Fix minor bug in expr_parse_target.options

2018-10-02 Thread bshastry
From: Bhargava Shastry 

oss-fuzz options file must begin with a [libfuzzer] header. 
This was missing in the expr_parse_target.options file which this
 patch fixes.

Signed-off-by: Bhargava Shastry 
---
 tests/oss-fuzz/config/expr_parse_target.options | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/oss-fuzz/config/expr_parse_target.options 
b/tests/oss-fuzz/config/expr_parse_target.options
index c0dfa68f1..4dfedfd84 100644
--- a/tests/oss-fuzz/config/expr_parse_target.options
+++ b/tests/oss-fuzz/config/expr_parse_target.options
@@ -1,3 +1,4 @@
+[libfuzzer]
 dict = expr.dict
 close_fd_mask = 3
 max_len = 100
-- 
2.17.1

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


[ovs-dev] [PATCH v2 2/2] windows, ovn-nbctl: Add service_start call inside the server loop

2018-10-02 Thread Alin Gabriel Serdean
Currently all ovn-nbctl (daemon) tests are failing due to the missing
call to `service_start` which is required on Windows.

Windows lacks fork so we need to pass all arguments, so we can spawn a new
process and interpret it properly when calling `service_start`.

Signed-off-by: Alin Gabriel Serdean 
Acked-by: Ben Pfaff 
---
v2: Remove OVS_UNUSED, add acks
---
 ovn/utilities/ovn-nbctl.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index eabd30308..9062cecfb 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -117,7 +117,7 @@ static char * OVS_WARN_UNUSED_RESULT main_loop(const char 
*args,
size_t n_commands,
struct ovsdb_idl *idl,
const struct timer *);
-static void server_loop(struct ovsdb_idl *idl);
+static void server_loop(struct ovsdb_idl *idl, int argc, char *argv[]);
 
 int
 main(int argc, char *argv[])
@@ -185,7 +185,11 @@ main(int argc, char *argv[])
 ctl_fatal("non-option arguments not supported with --detach "
   "(use --help for help)");
 }
-server_loop(idl);
+#ifdef _WIN32
+argc += optind;
+argv -= optind;
+#endif
+server_loop(idl, argc, argv);
 } else {
 struct ctl_command *commands;
 size_t n_commands;
@@ -5349,11 +5353,12 @@ server_cmd_init(struct ovsdb_idl *idl, bool *exiting)
 }
 
 static void
-server_loop(struct ovsdb_idl *idl)
+server_loop(struct ovsdb_idl *idl, int argc, char *argv[])
 {
 struct unixctl_server *server = NULL;
 bool exiting = false;
 
+service_start(, );
 daemonize_start(false);
 int error = unixctl_server_create(unixctl_path, );
 if (error) {
-- 
2.16.1.windows.1

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


[ovs-dev] [PATCH v2 1/2] windows: Add set_detach function to daemon-windows.c

2018-10-02 Thread Alin Gabriel Serdean
The daemon-windows file is missing a `set_detach` routine, so add it.

This will be useful in the long run.

Signed-off-by: Alin Gabriel Serdean 
Acked-by: Ben Pfaff 
---
 lib/daemon-windows.c | 10 +-
 lib/daemon.h |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
index 70c5f5d56..7e5f264f5 100644
--- a/lib/daemon-windows.c
+++ b/lib/daemon-windows.c
@@ -82,6 +82,14 @@ daemon_usage(void)
"unexpected failure. \n");
 }
 
+/* Sets up a following call to service_start() to detach from the foreground
+ * session, running this process in the background.  */
+void
+set_detach(void)
+{
+detach = true;
+}
+
 /* Registers the call-back and configures the actions in case of a failure
  * with the Windows services manager. */
 void
@@ -357,7 +365,7 @@ detach_process(int argc, char *argv[])
 
 /* We are only interested in the '--detach' and '--pipe-handle'. */
 for (i = 0; i < argc; i ++) {
-if (!strcmp(argv[i], "--detach")) {
+if (!detach && !strcmp(argv[i], "--detach")) {
 detach = true;
 } else if (!strncmp(argv[i], "--pipe-handle", 13)) {
 /* If running as a child, return. */
diff --git a/lib/daemon.h b/lib/daemon.h
index f33e9df8d..094157496 100644
--- a/lib/daemon.h
+++ b/lib/daemon.h
@@ -121,6 +121,7 @@ pid_t read_pidfile(const char *name);
 
 #define DAEMON_OPTION_HANDLERS  \
 case OPT_DETACH:\
+set_detach();   \
 break;  \
 \
 case OPT_NO_SELF_CONFINEMENT:   \
@@ -139,6 +140,7 @@ pid_t read_pidfile(const char *name);
 break;  \
 \
 case OPT_SERVICE:   \
+set_detach();   \
 break;  \
 \
 case OPT_SERVICE_MONITOR:   \
@@ -159,6 +161,7 @@ pid_t read_pidfile(const char *name);
 
 void control_handler(DWORD request);
 void set_pipe_handle(const char *pipe_handle);
+void set_detach(void);
 #endif /* _WIN32 */
 
 bool get_detach(void);
-- 
2.16.1.windows.1

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


[ovs-dev] [PATCH v2 3/3] OVN: fix automatic tests broken by ip-buffering support

2018-10-02 Thread Lorenzo Bianconi
Fix following automatic tests broken by ip-buffering support
since now original ip packets are transmitted by OVN logical
router:
- ovn -- 3 HVs, 3 LS, 3 lports/LS, 1 LR
- ovn -- /32 router IP address

Signed-off-by: Lorenzo Bianconi 
---
 tests/ovn.at | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/ovn.at b/tests/ovn.at
index e4fcc53b6..943ee96f6 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -2617,6 +2617,11 @@ for is in 1 2 3; do
   echo $arp >> $id$jd2$kd.expected
 done
   done
+  if test $(vif_to_hv ${is}${js}${ks}) = $(vif_to_hv ${id}${jd}1); then
+  hmac=80$o4
+  rmac=ff$id$jd
+  echo 
${hmac}${rmac}0800451c"3f1101"00${sip}${dip}00350008 >> 
${id}11.expected
+  fi
 done
   done
 done
@@ -8870,8 +8875,6 @@ 
packet=${dst_mac}${src_mac}0800451c4011${src_ip}${dst_ip}0035111
 as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
 OVS_WAIT_UNTIL([test `ovn-sbctl find mac_binding ip="10.0.0.2" | wc -l` -gt 0])
 ovn-nbctl --wait=hv sync
-# Send the second packet to reach the destination.
-as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet
 
 # Packet to Expect at 'alice1'
 src_mac="00010204"
-- 
2.17.1

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


[ovs-dev] [PATCH v2 2/3] OVN: add buffering support for ipv6 packets

2018-10-02 Thread Lorenzo Bianconi
Add buffering support for IPv6 packets that will be processed by
nd_ns {} action when L2 address is not discovered yet since
otherwise the packet will be substituted with a Neighbor Solicitation
frame and this will result in the lost of the first packet of the
connection

Signed-off-by: Lorenzo Bianconi 
---
 ovn/controller/pinctrl.c | 10 ++---
 tests/ovn.at | 45 +---
 2 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 5f15e1696..325f92447 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -99,6 +99,7 @@ static void pinctrl_handle_put_nd_ra_opts(
 struct ofputil_packet_in *pin, struct ofpbuf *userdata,
 struct ofpbuf *continuation);
 static void pinctrl_handle_nd_ns(const struct flow *ip_flow,
+ struct dp_packet *pkt_in,
  const struct match *md,
  struct ofpbuf *userdata);
 static void init_ipv6_ras(void);
@@ -1376,7 +1377,8 @@ process_packet_in(const struct ofp_header *msg,
 break;
 
 case ACTION_OPCODE_ND_NS:
-pinctrl_handle_nd_ns(, _metadata, );
+pinctrl_handle_nd_ns(, , _metadata,
+ );
 break;
 
 case ACTION_OPCODE_ICMP:
@@ -2593,8 +2595,8 @@ pinctrl_handle_nd_na(const struct flow *ip_flow, const 
struct match *md,
 }
 
 static void
-pinctrl_handle_nd_ns(const struct flow *ip_flow, const struct match *md,
- struct ofpbuf *userdata)
+pinctrl_handle_nd_ns(const struct flow *ip_flow, struct dp_packet *pkt_in,
+ const struct match *md, struct ofpbuf *userdata)
 {
 /* This action only works for IPv6 packets. */
 if (get_dl_type(ip_flow) != htons(ETH_TYPE_IPV6)) {
@@ -2603,6 +2605,8 @@ pinctrl_handle_nd_ns(const struct flow *ip_flow, const 
struct match *md,
 return;
 }
 
+pinctrl_handle_bufferd_packets(ip_flow, pkt_in, md, false);
+
 uint64_t packet_stub[128 / 8];
 struct dp_packet packet;
 dp_packet_use_stub(, packet_stub, sizeof packet_stub);
diff --git a/tests/ovn.at b/tests/ovn.at
index 23c2cabaf..e4fcc53b6 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -11278,6 +11278,16 @@ send_icmp_packet() {
 as hv$hv ovs-appctl netdev-dummy/receive hv$hv-vif$inport $packet
 }
 
+send_icmp6_packet() {
+local inport=$1 hv=$2 eth_src=$3 eth_dst=$4 ipv6_src=$5 ipv6_dst=$6 
ipv6_router=$7 exp_icmp_chksum=$8
+shift 8
+
+local ip6_hdr=60083aff${ipv6_src}${ipv6_dst}
+local packet=${eth_dst}${eth_src}86dd${ip6_hdr}8000dcb662f1
+
+as hv$hv ovs-appctl netdev-dummy/receive hv$hv-vif$inport $packet
+}
+
 get_arp_req() {
 local eth_src=$1 spa=$2 tpa=$3
 local 
request=${eth_src}08060001080006040001${eth_src}${spa}${tpa}
@@ -11290,6 +11300,22 @@ send_arp_reply() {
 as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
 }
 
+send_na() {
+local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 src_ip=$5 dst_ip=$6
+local ip6_hdr=60203aff${src_ip}${dst_ip}
+local 
request=${eth_dst}${eth_src}86dd${ip6_hdr}8800d7844000${src_ip}0201${eth_src}
+
+as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request
+}
+
+get_nd() {
+local eth_src=$1 src_ip=$2 dst_ip=$3 ta=$4
+local ip6_hdr=60203aff${src_ip}${dst_ip}
+
request=ff10${eth_src}86dd${ip6_hdr}87003576${ta}0101${eth_src}
+
+echo $request
+}
+
 net_add n1
 
 sim_add hv1
@@ -11316,18 +11342,18 @@ ovn-nbctl create Logical_Router name=lr0 
options:chassis=hv1
 ovn-nbctl ls-add sw0
 ovn-nbctl ls-add sw1
 
-ovn-nbctl lrp-add lr0 sw0 00:00:01:01:02:03 192.168.1.1/24
+ovn-nbctl lrp-add lr0 sw0 00:00:01:01:02:03 192.168.1.1/24 2001::1/64
 ovn-nbctl lsp-add sw0 rp-sw0 -- set Logical_Switch_Port rp-sw0 \
 type=router options:router-port=sw0 \
 -- lsp-set-addresses rp-sw0 router
 
-ovn-nbctl lrp-add lr0 sw1 00:00:02:01:02:03 172.16.1.1/24
+ovn-nbctl lrp-add lr0 sw1 00:00:02:01:02:03 172.16.1.1/24 2002::1/64
 ovn-nbctl lsp-add sw1 rp-sw1 -- set Logical_Switch_Port rp-sw1 \
 type=router options:router-port=sw1 \
 -- lsp-set-addresses rp-sw1 router
 
 ovn-nbctl lsp-add sw0 sw0-p0 \
--- lsp-set-addresses sw0-p0 "f0:00:00:01:02:03 192.168.1.2"
+-- lsp-set-addresses sw0-p0 "f0:00:00:01:02:03 192.168.1.2 2001::2"
 
 ovn-nbctl lsp-add sw1 sw1-p0 \
 -- lsp-set-addresses sw1-p0 unknown
@@ -11341,13 +11367,16 @@ ip_to_hex() {
 
 src_mac=f0010203
 src_ip=$(ip_to_hex 192 168 1 2)
+src_ip6=20010002
 
 router_mac0=01010203
 router_mac1=02010203
 router_ip=$(ip_to_hex 172 16 1 1)
+router_ip6=20020001
 
 dst_mac=001122334455
 dst_ip=$(ip_to_hex 172 16 1 10)
+dst_ip6=20020010
 
 data=0800bee4391a0001
 
@@ -11358,5 +11387,15 @@ echo 

[ovs-dev] [PATCH v2 1/3] OVN: add buffering support for ipv4 packets

2018-10-02 Thread Lorenzo Bianconi
Add buffering support for IPv4 packets that will be processed
by arp {} action when L2 address is not discovered yet since
otherwise the packet will be substituted with an ARP frame and
this will result in the lost of the first packet of the connection

Signed-off-by: Lorenzo Bianconi 
---
 ovn/controller/pinctrl.c | 200 ++-
 tests/ovn.at | 107 +
 2 files changed, 304 insertions(+), 3 deletions(-)

diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 8ae4c9e52..5f15e1696 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -61,6 +61,9 @@ static struct rconn *swconn;
  * rconn_get_connection_seqno(rconn), 'swconn' has reconnected. */
 static unsigned int conn_seq_no;
 
+static void init_buffered_packets_map(void);
+static void destroy_buffered_packets_map(void);
+
 static void pinctrl_handle_put_mac_binding(const struct flow *md,
const struct flow *headers,
bool is_arp);
@@ -108,6 +111,7 @@ static void send_ipv6_ras(
 ;
 
 COVERAGE_DEFINE(pinctrl_drop_put_mac_binding);
+COVERAGE_DEFINE(pinctrl_drop_buffered_packets_map);
 
 void
 pinctrl_init(void)
@@ -117,6 +121,7 @@ pinctrl_init(void)
 init_put_mac_bindings();
 init_send_garps();
 init_ipv6_ras();
+init_buffered_packets_map();
 }
 
 static ovs_be32
@@ -190,9 +195,181 @@ set_actions_and_enqueue_msg(const struct dp_packet 
*packet,
 ofpbuf_uninit();
 }
 
+struct buffer_info {
+struct ofpbuf ofpacts;
+struct dp_packet *p;
+};
+
+#define BUFFER_QUEUE_DEPTH 4
+struct buffered_packets {
+struct hmap_node hmap_node;
+
+/* key */
+ovs_be128 ip;
+
+long long int timestamp;
+
+struct buffer_info data[BUFFER_QUEUE_DEPTH];
+uint32_t head, tail;
+};
+
+static struct hmap buffered_packets_map;
+
+static void
+init_buffered_packets_map(void)
+{
+hmap_init(_packets_map);
+}
+
+static void
+destroy_buffered_packets(struct buffered_packets *bp)
+{
+struct buffer_info *bi;
+
+while (bp->head != bp->tail) {
+bi = >data[bp->head];
+dp_packet_uninit(bi->p);
+ofpbuf_uninit(>ofpacts);
+
+bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
+}
+hmap_remove(_packets_map, >hmap_node);
+free(bp);
+}
+
+static void
+destroy_buffered_packets_map(void)
+{
+struct buffered_packets *bp;
+HMAP_FOR_EACH_POP (bp, hmap_node, _packets_map) {
+destroy_buffered_packets(bp);
+}
+hmap_destroy(_packets_map);
+}
+
+static void
+buffered_push_packet(struct buffered_packets *bp,
+ struct dp_packet *packet,
+ const struct match *md)
+{
+uint32_t next = (bp->tail + 1) % BUFFER_QUEUE_DEPTH;
+struct buffer_info *bi = >data[bp->tail];
+
+ofpbuf_init(>ofpacts, 4096);
+
+reload_metadata(>ofpacts, md);
+struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(>ofpacts);
+resubmit->in_port = OFPP_CONTROLLER;
+resubmit->table_id = OFTABLE_REMOTE_OUTPUT;
+
+bi->p = packet;
+
+if (next == bp->head) {
+bi = >data[bp->head];
+dp_packet_uninit(bi->p);
+ofpbuf_uninit(>ofpacts);
+bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
+}
+bp->tail = next;
+}
+
+static void
+buffered_send_packets(struct buffered_packets *bp, struct eth_addr *addr)
+{
+enum ofp_version version = rconn_get_version(swconn);
+enum ofputil_protocol proto = ofputil_protocol_from_ofp_version(version);
+
+while (bp->head != bp->tail) {
+struct buffer_info *bi = >data[bp->head];
+struct eth_header *eth = dp_packet_data(bi->p);
+
+eth->eth_dst = *addr;
+struct ofputil_packet_out po = {
+.packet = dp_packet_data(bi->p),
+.packet_len = dp_packet_size(bi->p),
+.buffer_id = UINT32_MAX,
+.ofpacts = bi->ofpacts.data,
+.ofpacts_len = bi->ofpacts.size,
+};
+match_set_in_port(_metadata, OFPP_CONTROLLER);
+queue_msg(ofputil_encode_packet_out(, proto));
+
+ofpbuf_uninit(>ofpacts);
+dp_packet_uninit(bi->p);
+
+bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
+}
+}
+
+#define BUFFER_MAP_TIMEOUT   1
+static void
+buffered_packets_map_gc(void)
+{
+struct buffered_packets *cur_qp, *next_qp;
+long long int now = time_msec();
+
+HMAP_FOR_EACH_SAFE (cur_qp, next_qp, hmap_node, _packets_map) {
+if (now > cur_qp->timestamp + BUFFER_MAP_TIMEOUT) {
+destroy_buffered_packets(cur_qp);
+}
+}
+}
+
+static struct buffered_packets *
+pinctrl_find_buffered_packets(const ovs_be128 *ip, uint32_t hash)
+{
+struct buffered_packets *qp;
+
+HMAP_FOR_EACH_WITH_HASH (qp, hmap_node, hash,
+ _packets_map) {
+if (!memcmp(>ip, ip, sizeof(ovs_be128))) {
+return qp;
+}
+}
+return NULL;
+}
+

[ovs-dev] [PATCH v2 0/3] add buffering support for IP packets

2018-10-02 Thread Lorenzo Bianconi
Add buffering support for IP traffic that will be processed
by neighboring subsystem (arp{} or nd_ns{} actions) since this
will result in the lost of the first packet of the connection

Changes since v1:
- add automatic test support for IPv4 and IPv6
- fix automatic tests broken by ip-buffering support
- reduce queue depth to 3 packets
- use binary form of the IP address as hash key
- in buffered_send_packets() routine signature use eth_addr instead of
  unsigned char pointer
- use unsigned int for {head/tail} queue index

Lorenzo Bianconi (3):
  OVN: add buffering support for ipv4 packets
  OVN: add buffering support for ipv6 packets
  OVN: fix automatic tests broken by ip-buffering support

 ovn/controller/pinctrl.c | 210 +--
 tests/ovn.at | 153 +++-
 2 files changed, 355 insertions(+), 8 deletions(-)

-- 
2.17.1

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


Re: [ovs-dev] [PATCH] datapath-windows: Move OVS_IPHELPER_INSTANCE to IpHelper.h

2018-10-02 Thread Alin Gabriel Serdean


> On 30 Sep 2018, at 14:53, Alin Gabriel Serdean  wrote:
> 
>> 
>> Move the IPHelper Instance to the main header file and update the usage to
>> explicitly point to POVS_IPHELPER_INSTANCE instead of PVOID. Also rename
>> the ipn->context to ipn->instance to make it more readable.
>> 
>> Found by inspection.
>> 
>> Signed-off-by: Sairam Venugopal > >
>> —
>> 
> 
> Thanks for the patch!
> 
> Acked-by: Alin Gabriel Serdean mailto:aserd...@ovn.org>>
> 
> 
> 

Acked-by: Alin Gabriel Serdean mailto:aserd...@ovn.org>>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] bridge: Fix ovs-appctl qos/show repeated queue information

2018-10-02 Thread Eelco Chaudron
The patch below would stop qos/show to repeat information from the previous 
queues.
See below an example before and after the fix:

Before:

  $ ovs-appctl qos/show p5p2
  QoS: p5p2 linux-htb
  max-rate: 2428800

  Default:
burst: 12512
min-rate: 12000
max-rate: 2428800
tx_packets: 0
tx_bytes: 0
tx_errors: 0

  Queue 20:
burst: 12512
burst: 12512
min-rate: 12000
min-rate: 12000
max-rate: 607200
max-rate: 2428800
tx_packets: 28780
tx_bytes: 43572920
tx_errors: 17611

  Queue 10:
burst: 12512
burst: 12512
burst: 12512
max-rate: 2428800
max-rate: 607200
max-rate: 2428800
min-rate: 12000
min-rate: 12000
min-rate: 12000
tx_packets: 71751
tx_bytes: 108631014
tx_errors: 18503

After:

  $ ovs-appctl qos/show p5p2
  QoS: p5p2 linux-htb
  max-rate: 2428800

  Default:
burst: 12512
min-rate: 12000
max-rate: 2428800
tx_packets: 0
tx_bytes: 0
tx_errors: 0

  Queue 20:
burst: 12512
min-rate: 12000
max-rate: 607200
tx_packets: 28780
tx_bytes: 43572920
tx_errors: 17611

  Queue 10:
burst: 12512
min-rate: 12000
max-rate: 2428800
tx_packets: 71751
tx_bytes: 108631014
tx_errors: 18503

Signed-off-by: Eelco Chaudron 
---
 vswitchd/bridge.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 706a07c..875bb60 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3235,6 +3235,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
 smap_init();
 NETDEV_QUEUE_FOR_EACH (_id, , , iface->netdev) {
 qos_unixctl_show_queue(queue_id, , iface, );
+smap_clear();
 }
 smap_destroy();
 

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


[ovs-dev] Ovsdb delete bridge fails with "referential integrity violationDetails"

2018-10-02 Thread Serguei Bezverkhi (sbezverk) via dev
Hello,

I am trying to use rpc to delete a bridge but the sequence fails with this 
error: " referential integrity violationDetails " , the create operations works 
perfectly fine though.

Here are the operations:

Transaction: [
{Op:delete Table:Bridge Row:map[] Rows:[] Columns:[] Mutations:[] Timeout:0 
Where:[[name == test-1]] Until: UUIDName:} 
{Op:mutate Table:Open_vSwitch Row:map[] Rows:[] Columns:[] Mutations:[[bridges 
delete 0xc0002a21e0]] Timeout:0 Where:[[_uuid == 
{GoUUID:580f43bb-0896-4f31-b3f3-1aafe1a4ed58}]] Until: UUIDName:}] 

Failed with error: OVS Transaction failed err referential integrity 
violationDetails: cannot delete Bridge row 45dad59b-547e-4e1c-88d4-4923ba531492 
because of 1 remaining reference(s) 

But as you can see show does not show any child objects for bridge "test-1".

kubectl exec nsm-ovs-daemon-b48nv -- ovs-vsctl show
580f43bb-0896-4f31-b3f3-1aafe1a4ed58
Bridge "test-1"

Appreciate if somebody could comment which reference I would need to cleanup 
before I can delete the bridge?

Thank you
Serguei


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


Re: [ovs-dev] [PATCH] dp-packet.h: move funcs to be within cond block

2018-10-02 Thread Lam, Tiago
(Sending this again as yesterday's email seems to have been dropped.)

Hi Flavio,

Thanks for the patch. Looks good to me, it compiles with both DPDK and
without DPDK linked, and the check-system-userspace tests pass.

Acked-by: Tiago Lam 

On 25/09/2018 22:08, Flavio Leitner wrote:
> There is already an ifdef DPDK_NETDEV block, so instead of checking
> on each and every function, move them to the right block.
> 
> No functional change.
> 
> Signed-off-by: Flavio Leitner 
> ---
>  lib/dp-packet.h | 260 
> +++-
>  1 file changed, 146 insertions(+), 114 deletions(-)
> 
> diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> index ba91e5891..5b4c9c7a3 100644
> --- a/lib/dp-packet.h
> +++ b/lib/dp-packet.h
> @@ -465,113 +465,142 @@ dp_packet_set_allocated(struct dp_packet *b, uint16_t 
> s)
>  {
>  b->mbuf.buf_len = s;
>  }
> -#else
> -static inline void *
> -dp_packet_base(const struct dp_packet *b)
> +
> +/* Returns the RSS hash of the packet 'p'.  Note that the returned value is
> + * correct only if 'dp_packet_rss_valid(p)' returns true */
> +static inline uint32_t
> +dp_packet_get_rss_hash(struct dp_packet *p)
>  {
> -return b->base_;
> +return p->mbuf.hash.rss;
>  }
>  
>  static inline void
> -dp_packet_set_base(struct dp_packet *b, void *d)
> +dp_packet_set_rss_hash(struct dp_packet *p, uint32_t hash)
>  {
> -b->base_ = d;
> +p->mbuf.hash.rss = hash;
> +p->mbuf.ol_flags |= PKT_RX_RSS_HASH;
>  }
>  
> -static inline uint32_t
> -dp_packet_size(const struct dp_packet *b)
> +static inline bool
> +dp_packet_rss_valid(struct dp_packet *p)
>  {
> -return b->size_;
> +return p->mbuf.ol_flags & PKT_RX_RSS_HASH;
>  }
>  
>  static inline void
> -dp_packet_set_size(struct dp_packet *b, uint32_t v)
> +dp_packet_rss_invalidate(struct dp_packet *p OVS_UNUSED)
>  {
> -b->size_ = v;
>  }
>  
> -static inline uint16_t
> -__packet_data(const struct dp_packet *b)
> +static inline void
> +dp_packet_mbuf_rss_flag_reset(struct dp_packet *p)
>  {
> -return b->data_ofs;
> +p->mbuf.ol_flags &= ~PKT_RX_RSS_HASH;
>  }
>  
> +/* This initialization is needed for packets that do not come
> + * from DPDK interfaces, when vswitchd is built with --with-dpdk.
> + * The DPDK rte library will still otherwise manage the mbuf.
> + * We only need to initialize the mbuf ol_flags. */
>  static inline void
> -__packet_set_data(struct dp_packet *b, uint16_t v)
> +dp_packet_mbuf_init(struct dp_packet *p)
>  {
> -b->data_ofs = v;
> +p->mbuf.ol_flags = 0;
>  }
>  
> -static inline uint16_t
> -dp_packet_get_allocated(const struct dp_packet *b)
> +static inline bool
> +dp_packet_ip_checksum_valid(struct dp_packet *p)
>  {
> -return b->allocated_;
> +return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
> +PKT_RX_IP_CKSUM_GOOD;
>  }
>  
> -static inline void
> -dp_packet_set_allocated(struct dp_packet *b, uint16_t s)
> +static inline bool
> +dp_packet_ip_checksum_bad(struct dp_packet *p)
>  {
> -b->allocated_ = s;
> +return (p->mbuf.ol_flags & PKT_RX_IP_CKSUM_MASK) ==
> +PKT_RX_IP_CKSUM_BAD;
> +}
> +
> +static inline bool
> +dp_packet_l4_checksum_valid(struct dp_packet *p)
> +{
> +return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
> +PKT_RX_L4_CKSUM_GOOD;
> +}
> +
> +static inline bool
> +dp_packet_l4_checksum_bad(struct dp_packet *p)
> +{
> +return (p->mbuf.ol_flags & PKT_RX_L4_CKSUM_MASK) ==
> +PKT_RX_L4_CKSUM_BAD;
>  }
> -#endif
>  
>  static inline void
> -dp_packet_reset_cutlen(struct dp_packet *b)
> +reset_dp_packet_checksum_ol_flags(struct dp_packet *p)
>  {
> -b->cutlen = 0;
> +p->mbuf.ol_flags &= ~(PKT_RX_L4_CKSUM_GOOD | PKT_RX_L4_CKSUM_BAD |
> +  PKT_RX_IP_CKSUM_GOOD | PKT_RX_IP_CKSUM_BAD);
>  }
>  
> -static inline uint32_t
> -dp_packet_set_cutlen(struct dp_packet *b, uint32_t max_len)
> +static inline bool
> +dp_packet_has_flow_mark(struct dp_packet *p, uint32_t *mark)
>  {
> -if (max_len < ETH_HEADER_LEN) {
> -max_len = ETH_HEADER_LEN;
> +if (p->mbuf.ol_flags & PKT_RX_FDIR_ID) {
> +*mark = p->mbuf.hash.fdir.hi;
> +return true;
>  }
>  
> -if (max_len >= dp_packet_size(b)) {
> -b->cutlen = 0;
> -} else {
> -b->cutlen = dp_packet_size(b) - max_len;
> -}
> -return b->cutlen;
> +return false;
>  }
>  
> -static inline uint32_t
> -dp_packet_get_cutlen(const struct dp_packet *b)
> +#else /* DPDK_NETDEV */
> +static inline void *
> +dp_packet_base(const struct dp_packet *b)
>  {
> -/* Always in valid range if user uses dp_packet_set_cutlen. */
> -return b->cutlen;
> +return b->base_;
> +}
> +
> +static inline void
> +dp_packet_set_base(struct dp_packet *b, void *d)
> +{
> +b->base_ = d;
>  }
>  
>  static inline uint32_t
> -dp_packet_get_send_len(const struct dp_packet *b)
> +dp_packet_size(const struct dp_packet *b)
>  {
> -return dp_packet_size(b) - 

[ovs-dev] Hierarchical egress scheduler for OVS-DPDK

2018-10-02 Thread Eelco Chaudron

Hello,

I was wondering if anyone is working on some kind of hierarchical egress 
scheduler for OVS-DPDK?


I did see a patch from Zhao, https://patchwork.ozlabs.org/patch/793159/ 
adding multiple queues. However, this will not allow minimum bandwidth 
guarantees among multiple queues (well it could be, but the bandwidth 
would be reserved, not shared @idle time). In addition, the patchset 
seems to be dead...


Guess I'm looking for something similar to the linux-htb for the kernel 
datapath.


If found some emails from Gayathri hinting that they are working on it, 
but no patches:


http://mails.dpdk.org/archives/dev/2016-May/039191.html
https://mail.openvswitch.org/pipermail/ovs-discuss/2016-June/041582.html

If no one is working on this, I'll try to see if I can make some time to 
work on this.


If anyone has prior attempts please share your thoughts/experiences.

Cheers,

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


Re: [ovs-dev] [PATCH] Revert "openvswitch: Fix template leak in error cases."

2018-10-02 Thread David Miller
From: Flavio Leitner 
Date: Fri, 28 Sep 2018 14:55:34 -0300

> This reverts commit 90c7afc96cbbd77f44094b5b651261968e97de67.
> 
> When the commit was merged, the code used nf_ct_put() to free
> the entry, but later on commit 76644232e612 ("openvswitch: Free
> tmpl with tmpl_free.") replaced that with nf_ct_tmpl_free which
> is a more appropriate. Now the original problem is removed.
> 
> Then 44d6e2f27328 ("net: Replace NF_CT_ASSERT() with WARN_ON().")
> replaced a debug assert with a WARN_ON() which is trigged now.
> 
> Signed-off-by: Flavio Leitner 

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