Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to include/openvswitch

2017-11-02 Thread Xiao Liang
On Fri, Nov 3, 2017 at 1:12 AM, Ben Pfaff  wrote:
> On Thu, Nov 02, 2017 at 01:35:11PM +, Alin Serdean wrote:
>>
>>
>> > -Original Message-
>> > From: Xiao Liang [mailto:shaw.l...@gmail.com]
>> > Sent: Thursday, November 2, 2017 4:32 AM
>> > To: Alin Serdean 
>> > Cc: Ben Pfaff ; d...@openvswitch.org
>> > Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
>> > include/openvswitch
>> >
>> > On Thu, Nov 2, 2017 at 5:51 AM, Alin Serdean
>> >  wrote:
>> > >
>> > >
>> > >> -Original Message-
>> > >> From: Ben Pfaff [mailto:b...@ovn.org]
>> > >> Sent: Tuesday, October 31, 2017 9:34 PM
>> > >> To: Xiao Liang ; Alin Serdean
>> > >> 
>> > >> Cc: d...@openvswitch.org
>> > >> Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
>> > >> include/openvswitch
>> > >>
>> > >> On Thu, Aug 17, 2017 at 12:06:25AM +0800, Xiao Liang wrote:
>> > >> > Poll-loop is the core to implement main loop. It should be
>> > >> > available in libopenvswitch.
>> > >> >
>> > >> > Signed-off-by: Xiao Liang 
>> > >>
>> > >> I'm concerned about the way that this adds a definition of HANDLE in
>> > >> a public header.  That seems unfriendly to code that might want to
>> > >> include both this header and Win32 headers that properly define HANDLE.
>> > >>
>> > >> Alin, what's the right thing to do here?
>> > > [Alin Serdean] First the type definition is wrong (HANDLE is VOID*).
>> > > I would avoid adding the definition to HANDLE. Maybe add an include to
>> >  or  to include/windows/poll.h .
>> >
>> > Since include/windows is not installed as public header, is it safe to 
>> > remove
>> > inclusion of poll.h and add windows.h in poll-loop.h?
>> That sounds reasonable to me. Ben do you agree?
>
>  is definitely needed on non-Windows platforms for the
> definition of POLLIN and POLLOUT, so it would have to be conditional.  I
> don't object to including , on Windows, but I don't know the
> full implications of doing it.

Thanks. I submitted a new patch.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] lib: Move lib/poll-loop.h to include/openvswitch

2017-11-02 Thread Xiao Liang
Poll-loop is the core to implement main loop. It should be available in
libopenvswitch.

Signed-off-by: Xiao Liang 
---
 include/openvswitch/automake.mk   | 1 +
 {lib => include/openvswitch}/poll-loop.h  | 7 ++-
 lib/bfd.c | 2 +-
 lib/cfm.c | 2 +-
 lib/conntrack.c   | 2 +-
 lib/daemon-windows.c  | 2 +-
 lib/dpif-netdev.c | 2 +-
 lib/dpif-netlink.c| 2 +-
 lib/dpif.c| 2 +-
 lib/fatal-signal.c| 2 +-
 lib/jsonrpc.c | 2 +-
 lib/lacp.c| 2 +-
 lib/latch-unix.c  | 2 +-
 lib/latch-windows.c   | 2 +-
 lib/learning-switch.c | 2 +-
 lib/mac-learning.c| 2 +-
 lib/mcast-snooping.c  | 2 +-
 lib/memory.c  | 2 +-
 lib/netdev-bsd.c  | 2 +-
 lib/netdev-dummy.c| 2 +-
 lib/netdev-linux.c| 2 +-
 lib/netdev-vport.c| 2 +-
 lib/netdev-windows.c  | 2 +-
 lib/netdev.c  | 2 +-
 lib/netlink-conntrack.c   | 2 +-
 lib/netlink-socket.c  | 2 +-
 lib/ovs-lldp.c| 2 +-
 lib/ovs-rcu.c | 2 +-
 lib/ovs-thread.c  | 2 +-
 lib/ovsdb-idl.c   | 2 +-
 lib/poll-loop.c   | 2 +-
 lib/process.c | 2 +-
 lib/rconn.c   | 2 +-
 lib/reconnect.c   | 2 +-
 lib/rtbsd.c   | 2 +-
 lib/seq.c | 2 +-
 lib/signals.c | 2 +-
 lib/socket-util.c | 2 +-
 lib/stream-fd.c   | 2 +-
 lib/stream-ssl.c  | 2 +-
 lib/stream-unix.c | 2 +-
 lib/stream-windows.c  | 2 +-
 lib/stream.c  | 2 +-
 lib/timer.c   | 2 +-
 lib/tnl-neigh-cache.c | 2 +-
 lib/token-bucket.c| 2 +-
 lib/unixctl.c | 2 +-
 lib/vconn-stream.c| 2 +-
 lib/vconn.c   | 2 +-
 ofproto/bond.c| 2 +-
 ofproto/bundles.c | 2 +-
 ofproto/connmgr.c | 2 +-
 ofproto/fail-open.c   | 2 +-
 ofproto/in-band.c | 2 +-
 ofproto/netflow.c | 2 +-
 ofproto/ofproto-dpif-ipfix.c  | 2 +-
 ofproto/ofproto-dpif-monitor.c| 2 +-
 ofproto/ofproto-dpif-sflow.c  | 2 +-
 ofproto/ofproto-dpif-upcall.c | 2 +-
 ofproto/ofproto-dpif.c| 2 +-
 ofproto/ofproto.c | 2 +-
 ofproto/pinsched.c| 2 +-
 ovn/controller-vtep/gateway.c | 2 +-
 ovn/controller-vtep/ovn-controller-vtep.c | 2 +-
 ovn/controller/binding.c  | 2 +-
 ovn/controller/ofctrl.c   | 2 +-
 ovn/controller/ovn-controller.c   | 2 +-
 ovn/controller/physical.c | 2 +-
 ovn/controller/pinctrl.c  | 2 +-
 ovn/northd/ovn-northd.c   | 2 +-
 ovn/utilities/ovn-nbctl.c | 2 +-
 ovn/utilities/ovn-sbctl.c | 2 +-
 ovn/utilities/ovn-trace.c | 2 +-
 ovsdb/jsonrpc-server.c| 2 +-
 ovsdb/ovsdb-client.c  | 2 +-
 ovsdb/ovsdb-server.c  | 2 +-
 ovsdb/trigger.c   | 3 ++-
 tests/test-jsonrpc.c  | 2 +-
 tests/test-netflow.c  | 2 +-
 tests/test-netlink-conntrack.c| 2 +-
 tests/test-ovsdb.c| 2 +-
 tests/test-sflow.c| 2 +-
 tests/test-unixctl.c  | 2 +-
 tests/test-vconn.c| 2 +-
 utilities/nlmon.c | 2 +-
 utilities/ovs-ofctl.c | 2 +-
 utilities/ovs-testcontroller.c| 2 +-
 utilities/ovs-vsctl.c | 2 +-
 vswitchd/bridge.c | 2 +-
 vswitchd/ovs-vswitchd.c   | 2 +-
 vswitchd/system-stats.c   | 2 +-
 vtep/vtep-ctl.c   | 2 +-
 92 files changed, 98 insertions(+), 91 deletions(-)
 rename {lib => include/openvswitch}/poll-loop.h (97%)

diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk
index ec4580641..93d1062a4 100644
--- 

Re: [ovs-dev] [PATCH v10 0/4] Add Router Solicitation responder support and generate Neighbor Solicitation request for unknown

2017-11-02 Thread Numan Siddique
On Fri, Nov 3, 2017 at 2:10 AM, Ben Pfaff  wrote:

> On Thu, Nov 02, 2017 at 01:37:40PM -0700, Ben Pfaff wrote:
> > Thank you for the patches!  They look good to me, so I will apply them
> > to master soon.  I folded in a few minor changes to patch 2, which I'll
> > mention in a reply to that patch.
>
> Oh, one more thing: I'd appreciate it if you would follow up with a
> patch that adds an item to NEWS, to explain the new feature to end
> users.
>
>
Thanks Ben for the review and applying them. I submitted the patch for the
NEWS
 here - https://patchwork.ozlabs.org/patch/833636/

Thanks
Numan


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


[ovs-dev] [PATCH] NEWS: Add recently added OVN IPv6 features

2017-11-02 Thread nusiddiq
From: Numan Siddique 

OVN now supports sending IPv6 RA packet in response to the RS packet
and resolves the unknown next hop MACs by generating a NS packet.

Mention this in the NEWS.

Signed-off-by: Numan Siddique 
---
 NEWS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index 1325d3146..047f34b9f 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,12 @@ Post-v2.8.0
- OVN:
  * The "requested-chassis" option for a logical switch port now accepts a
chassis "hostname" in addition to a chassis "name".
+ * IPv6
+   - Added support to send IPv6 Router Advertisement packets in response to
+ the IPv6 Router Solicitation packets from  the VIF ports.
+   - Added support to generate Neighbor Solicitation packets using the OVN
+ action 'nd_ns' to resolve unknown next hop MAC addresses for the
+ IPv6 packets.
- Linux kernel 4.13
  * Add support for compiling OVS with the latest Linux 4.13 kernel
 
-- 
2.13.5

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


Re: [ovs-dev] [Patch V2] Documentation: Document additional module dependency

2017-11-02 Thread Greg Rose

On 11/02/2017 02:02 PM, Greg Rose wrote:

On certain Ubuntu systems running the 4.4 based kernel depmod
may not correctly search for module dependencies when newer
openvswitch kernel modules have been installed in the extra
directory at /lib/modules/$(uname -r)/extra.  A symptom of
this are the following messages in system log that can be
printed with the dmesg command:

[164917.582125] vport_lisp: disagrees about version of symbol ovs_netdev_link
[164917.582139] vport_lisp: Unknown symbol ovs_netdev_link (err -22)
[164917.582155] vport_lisp: Unknown symbol ovs_lisp_fill_metadata_dst (err 0)
[164917.582165] vport_lisp: Unknown symbol rpl_rtnl_delete_link (err 0)
[164917.582169] vport_lisp: disagrees about version of symbol 
ovs_netdev_tunnel_destroy
[164917.582170] vport_lisp: Unknown symbol ovs_netdev_tunnel_destroy (err -22)
[164917.582178] vport_lisp: Unknown symbol rpl_lisp_xmit (err 0)
[164917.582184] vport_lisp: Unknown symbol rpl_lisp_dev_create_fb (err 0)
[164917.582187] vport_lisp: disagrees about version of symbol 
__ovs_vport_ops_register
[164917.582188] vport_lisp: Unknown symbol __ovs_vport_ops_register (err -22)
[164917.582191] vport_lisp: disagrees about version of symbol 
ovs_vport_ops_unregister
[164917.582192] vport_lisp: Unknown symbol ovs_vport_ops_unregister (err -22)
[164917.582194] vport_lisp: disagrees about version of symbol ovs_vport_alloc
[164917.582195] vport_lisp: Unknown symbol ovs_vport_alloc (err -22)
[164917.582197] vport_lisp: disagrees about version of symbol ovs_vport_free
[164917.582198] vport_lisp: Unknown symbol ovs_vport_free (err -22)
[164917.606229] vport_stt: disagrees about version of symbol ovs_netdev_link
[164917.606233] vport_stt: Unknown symbol ovs_netdev_link (err -22)
[164917.606248] vport_stt: Unknown symbol ovs_stt_fill_metadata_dst (err 0)
[164917.606260] vport_stt: Unknown symbol rpl_rtnl_delete_link (err 0)
[164917.606264] vport_stt: disagrees about version of symbol 
ovs_netdev_tunnel_destroy
[164917.606266] vport_stt: Unknown symbol ovs_netdev_tunnel_destroy (err -22)
[164917.606274] vport_stt: Unknown symbol ovs_stt_dev_create_fb (err 0)
[164917.606279] vport_stt: disagrees about version of symbol 
__ovs_vport_ops_register
[164917.606281] vport_stt: Unknown symbol __ovs_vport_ops_register (err -22)
[164917.606285] vport_stt: disagrees about version of symbol 
ovs_vport_ops_unregister
[164917.606286] vport_stt: Unknown symbol ovs_vport_ops_unregister (err -22)
[164917.606291] vport_stt: disagrees about version of symbol ovs_vport_alloc
[164917.606292] vport_stt: Unknown symbol ovs_vport_alloc (err -22)
[164917.606295] vport_stt: disagrees about version of symbol ovs_vport_free
[164917.606297] vport_stt: Unknown symbol ovs_vport_free (err -22)
[164917.606305] vport_stt: Unknown symbol ovs_stt_xmit (err 0)

When this occurs the 'make check-kmod' command will experience many
failures and openvswitch will not operate correctly.

Adding 'search extra' to the beginning of the /etc/depmod.d/openvswitch.conf
module dependency configuration file fixes the problem.  So to be safe
just add it.

Signed-off-by: Greg Rose 
---
  Documentation/intro/install/general.rst | 1 +
  1 file changed, 1 insertion(+)

diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index e5ec155..a561b57 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -385,6 +385,7 @@ Building
 following snippet of code achieves the same::
  
 $ config_file="/etc/depmod.d/openvswitch.conf"

+   $ echo "search extra" >> "$config_file"
 $ for module in datapath/linux/*.ko; do
   modname="$(basename ${module})"
   echo "override ${modname%.ko} * extra" >> "$config_file"



I'm withdrawing this patch - I may have been working from a corrupted system.

Please ignore.

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


Re: [ovs-dev] [PATCH net-next v15] openvswitch: enable NSH support

2017-11-02 Thread Yang, Yi
On Thu, Nov 02, 2017 at 05:06:47AM -0700, Pravin Shelar wrote:
> On Wed, Nov 1, 2017 at 7:50 PM, Yang, Yi  wrote:
> > On Thu, Nov 02, 2017 at 08:52:40AM +0800, Pravin Shelar wrote:
> >> On Tue, Oct 31, 2017 at 9:03 PM, Yi Yang  wrote:
> >> >
> >> > OVS master and 2.8 branch has merged NSH userspace
> >> > patch series, this patch is to enable NSH support
> >> > in kernel data path in order that OVS can support
> >> > NSH in compat mode by porting this.
> >> >
> >> > Signed-off-by: Yi Yang 
> >> > ---
> >> I have comment related to checksum, otherwise patch looks good to me.
> >
> > Pravin, thank you for your comments, the below part is incremental patch
> > for checksum, please help check it, I'll send out v16 with this after
> > you confirm.
> >
> This change looks good to me.
> I noticed couple of more issues.
> 1. Can you move the ovs_key_nsh to the union of ipv4 an ipv6?
> ipv4/ipv6/nsh key data is mutually exclusive so there is no need for
> separate space for nsh key in the ovs key.
> 2. We need to fix match_validate() with nsh check. Datapath can not
> allow any l3 or l4 match if the flow key contains nsh match and
> vice-versa. such flow key should be rejected.

Pravin, the below incremental patch should fix the issues you pionted
out, please help confirm/ack, then I'll send out v16 with all acks
from you all for merge. BTW, it has been verified in my sfc test
environment.

diff --git a/net/openvswitch/flow.h b/net/openvswitch/flow.h
index 8eeae749..c670dd2 100644
--- a/net/openvswitch/flow.h
+++ b/net/openvswitch/flow.h
@@ -149,8 +149,8 @@ struct sw_flow_key {
} nd;
};
} ipv6;
+   struct ovs_key_nsh nsh; /* network service header */
};
-   struct ovs_key_nsh nsh; /* network service header */
struct {
/* Connection tracking fields not packed above. */
struct {
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 0d7d4ae..090103c 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -178,7 +178,8 @@ static bool match_validate(const struct sw_flow_match 
*match,
| (1 << OVS_KEY_ATTR_ICMPV6)
| (1 << OVS_KEY_ATTR_ARP)
| (1 << OVS_KEY_ATTR_ND)
-   | (1 << OVS_KEY_ATTR_MPLS));
+   | (1 << OVS_KEY_ATTR_MPLS)
+   | (1 << OVS_KEY_ATTR_NSH));
 
/* Always allowed mask fields. */
mask_allowed |= ((1 << OVS_KEY_ATTR_TUNNEL)
@@ -287,6 +288,14 @@ static bool match_validate(const struct sw_flow_match 
*match,
}
}
 
+   if (match->key->eth.type == htons(ETH_P_NSH)) {
+   key_expected |= 1 << OVS_KEY_ATTR_NSH;
+   if (match->mask &&
+   match->mask->key.eth.type == htons(0x)) {
+   mask_allowed |= 1 << OVS_KEY_ATTR_NSH;
+   }
+   }
+
if ((key_attrs & key_expected) != key_expected) {
/* Key attributes check failed. */
OVS_NLERR(log, "Missing key (keys=%llx, expected=%llx)",
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2] ovn-northd.8: Fix wrong description

2017-11-02 Thread wei
Signed-off-by: wei 
---
 ovn/northd/ovn-northd.8.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index e9799e18a..37284301b 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -1422,7 +1422,7 @@ icmp4 {
   B, a priority-100 flow matches ip 
   ip4.dst == B  inport == GW,
   where GW is the logical router gateway port, with an
-  action ct_snat; next;.
+  action ct_snat;.
 
 
 
-- 
2.12.2.windows.2


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


Re: [ovs-dev] [PATCH] ofp-util: Update OpenFlow 1.6 port support to track latest proposal.

2017-11-02 Thread Yi-Hung Wei
On Tue, Oct 24, 2017 at 3:17 PM, Ben Pfaff  wrote:
> This patch, from July, still applies and still needs a review.
>
> On Fri, Jul 14, 2017 at 12:51:43PM -0700, Ben Pfaff wrote:
>> The latest updates to the OpenFlow 1.6 proposal removes the hw_addr_type
>> fields from ofp_port and ofp_port_mod.  This commit updates the OVS
>> prototype to match the updated proposal.
>>
>> ONF-JIRA: EXT-566
>> Signed-off-by: Ben Pfaff 
>> ---

Thanks for the patch. It looks good to me.

Acked-by: Yi-Hung Wei 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] actions in openflow rules

2017-11-02 Thread Haitham Ghalwash

Hi all


I am a little bit confused when interpreting the action part for the following 
rule,  I got the rule by initiating the "ovs-ofctl dump-flows" on my mininet 
openflow switch.


cookie=0x2ba5, duration=528.939s, table=0, n_packets=176, 
n_bytes=33116, idle_age=0, priority=2,in_port=1 actions=output:4,output:2


we have multiple action ports in a certain order, when checking the 
"restconf/operational/opendaylight-inventory:nodes/" in the opendaylight 
controller we can see each action with different order

"action": [
  { "order": 0,"output-action": {
   "max-length": 65535,
"output-node-connector": "2" }
  {"order": 1, "output-action": {
"max-length": 65535,
"output-node-connector": "4" }
}


I am not sure how the packets hitting such entry will be forwarded, are they 
replicated and send over both? are they load balanced over all ports?


Best wishes,

Haitham


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


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Greg Rose

On 11/02/2017 02:39 PM, Guru Shetty wrote:



On 2 November 2017 at 12:55, Greg Rose > wrote:

On 11/02/2017 11:12 AM, Greg Rose wrote:

On 11/02/2017 11:07 AM, Ben Pfaff wrote:

On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:
 > On certain Ubuntu systems running the 4.4 based kernel depmod
 > may not correctly search for module dependencies when newer
 > openvswitch kernel modules have been installed in the extra
 > directory at /lib/modules/$(uname -r)/extra.  A symptom of
 > this are the following messages in system log that can be
 > printed with the dmesg command:

Thanks for figuring out the problem and documenting a fix.  I really
appreciate documentation patches.

 > +#!/bin/sh
 > +
 > +check_ubuntu_depmod_config() {
 > +if [ -e /etc/depmod.d/ubuntu.conf ]; then
 > +if ! grep -q extra /etc/depmod.d/ubuntu.conf
 > +then
 > +sed -i s\/search\/"search extra"\/ 
/etc/depmod.d/ubuntu.conf
 > +/sbin/depmod -a
 > +fi
 > +fi
 > +}

I wonder about the details of this particular fix.  Usually, when 
there
is a configuration file in a .d directory, like depmod.d, it is 
possible
to add more files to the same directory that also get used for
configuration.  When that works, it is usually better to add files 
to
the directory rather than changing existing files, because it 
behaves
better on upgrade.  So, in this case, I wonder whether it is 
possible to
add a new file that would have something like:

  search extra


This works if put in a separate file such as 
/etc/depmod.d/ovs-search-path.conf
or something else.  Suggested names are welcome.  It also works if the
instructions already in place to create the /etc/depmod.d/openvswitch.conf
file are amended so that the first line of the file is 'search extra'.

Like this:

search extra
override * * extra
override * * weak-updates


I have over the years found something like this to work::

|cat > /etc/depmod.d/openvswitch.conf << EOF override openvswitch * extra override vport-geneve * extra override vport-stt * extra 
override vport-* * extra EOF|


That does usually work.  Definitely on all the newer Ubuntu releases.
But I found a case where it did not and thus the safety override of
'search extra'.  It won't hurt anything I guess and will prevent
confusion.  Especially my own!

I suppose my argument is better safe than unpredictable.

Thanks Guru!

- Greg






or

  override kmod * extra


Doesn't work.


The latter is suggested by depmod.d(5).

I'll give it a try and get back with the results.

Thanks!


Let me know what the preference is and I'll spin up a V2 of the patch.

Thanks,

- Greg

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





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


[ovs-dev] Recursos Humanos Rumbo al 2018

2017-11-02 Thread Evite Riesgo de una Demanda
Buenas Tardes:

Este mes de septiembre le invitamos a adquirir una de nuestras pólizas de 
Capacitación online en PREVENTA, los cuáles constan de 12 Temas que son 
utilizables durante 3 meses, las 24 hrs del día, las veces que usted así lo 
requiera.

En Específico le ofrecemos el plan de Recursos Humanos Rumbo al 2018 que consta 
de 12 temas.

Temas de Nuestra Póliza:

1. Contratos Laborales en México.
2. Reclutamiento 3.0.
3. Pruebas Psicométricas de Personalidad.
4. Cómo son los CFDI de Nóminas a partir del 2017.
5. Gestión por competencias / Gestión por conocimientos.
6. Sistema de Incentivos por Objetivos.
7. Desarrollo de Talento a través de Entornos Digitales.
8. Evaluación del Clima Organizacional. 
9. Trabajadores Comprometidos hasta la Médula. 
10. Cómo Registrar e Implementar el plan y Programas de Capacitación, 
Adiestramiento y Productividad ante la STPS.
11. Certificación Well.
12. Un poco de Presión siempre ayuda. 


Para que usted reciba la información completa de este plan, le solicitamos por 
favor enviarnos la palabra RH2018 junto los siguientes datos:

Nombre:
Empresa:
Teléfono:

Y le haremos llegar el Temario Completo para que usted revise más a detalle.

centro telefónico: 018002129393


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


Re: [ovs-dev] *** SPAM *** Re: [PATCH] Documentation: Add the Open vSwitch project charter.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 09:25:56PM +, Mark Michelson wrote:
> Looks good to me.
> 
> On Thu, Nov 2, 2017 at 1:16 PM Ben Pfaff  wrote:
> 
> > I'd appreciate it if someone would review this change.  It is
> > documentation only.
> >
> > On Tue, Oct 24, 2017 at 09:33:07AM -0700, Ben Pfaff wrote:
> > > It always seems odd that this isn't in the repo, so this adds it, with
> > > internal links properly directed.
> > >
> > > Signed-off-by: Ben Pfaff 
> >
> Acked-by: Mark Michelson 

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


Re: [ovs-dev] [PATCH] ofproto-dpif-upcall: Transition ukey on dp_ops error.

2017-11-02 Thread Ben Pfaff
On Mon, Sep 18, 2017 at 02:56:35PM -0700, Greg Rose wrote:
> On 09/06/2017 03:12 PM, Joe Stringer wrote:
> >In most situations, we don't expect that a flow we've successfully
> >dumped, which we intend to delete, cannot be deleted. However, to make
> >this code more resilient to ensure that ukeys *will* transition in all
> >cases (including an error at this stage), grab the lock and transition
> >this ukey forward to the evicted state, effectively treating a failure
> >to delete as "this flow is already gone".
> >
> >If we subsequently find out that it wasn't deleted, then that's ok - we
> >will re-dump, and validate at that stage, which should lead to creating
> >a new ukey or deleting the datapath flow when that happens.
> >
> >Signed-off-by: Joe Stringer 
> >---
> >  ofproto/ofproto-dpif-upcall.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> >diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
> >index 4a71bbe258df..bd324fbb6323 100644
> >--- a/ofproto/ofproto-dpif-upcall.c
> >+++ b/ofproto/ofproto-dpif-upcall.c
> >@@ -2227,6 +2227,11 @@ push_dp_ops(struct udpif *udpif, struct ukey_op *ops, 
> >size_t n_ops)
> >  if (op->dop.error) {
> >  /* flow_del error, 'stats' is unusable. */
> >+if (op->ukey) {
> >+ovs_mutex_lock(>ukey->mutex);
> >+transition_ukey(op->ukey, UKEY_EVICTED);
> >+ovs_mutex_unlock(>ukey->mutex);
> >+}
> >  continue;
> >  }
> >
> 
> Compile tested only - I didn't see of any good way to force the error
> 
> Code looks good to me.
> 
> Reviewed-by: Greg Rose 

I applied this to master, although I don't fully understand it so that
seems like living dangerously.  That's EXTREME programming.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv3] dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

2017-11-02 Thread Guru Shetty
On 2 November 2017 at 12:01, William Tu  wrote:

> When using the out-of-tree (openvswitch compat) geneve module,
> the first time oot tunnel probing returns true (correct).
> Without unloading the geneve module, if the userspace ovs-vswitchd
> restarts, because the 'geneve_sys_6081' still exists, the probing
> incorrectly returns false and loads the in-tree (upstream kernel)
> geneve module.
>
> The patch fixes it by querying the geneve device's kind when exists.
> The out-of-tree modules uses kind string as 'ovs_geneve', while the
> in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> > /etc/init.d/openvswitch-switch start
> > creat a bridge and attach a geneve port using out-of-tree geneve
> > /etc/init.d/openvswitch-switch restart
>
> Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides
> used interface")
> Signed-off-by: William Tu 
> Cc: Eric Garver 
> Cc: Gurucharan Shetty 
>

Thanks. I also tested this for a good reproduction case and applied to
master and 2.8.


> ---
> v2->v3:
> Add return code checking for netlink parsing
> Fix memory leak
> v1->v2:
> Add detection of existing module, instead of unconditionally
> remote it and create.
> ---
>  lib/dpif-netlink-rtnl.c | 39 +++
>  1 file changed, 39 insertions(+)
>
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 0c32e7d8ccb4..fe9c8ed7104f 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>
>  error = netdev_open("ovs-system-probe", "geneve", );
>  if (!error) {
> +struct ofpbuf *reply;
>  const struct netdev_tunnel_config *tnl_cfg;
>
>  tnl_cfg = netdev_get_tunnel_config(netdev);
> @@ -448,6 +449,44 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  }
>
>  name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof
> namebuf);
> +
> +/* The geneve module exists when ovs-vswitchd crashes
> + * and restarts, handle the case here.
> + */
> +error = dpif_netlink_rtnl_getlink(name, );
> +if (!error) {
> +
> +struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)];
> +struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)];
> +const char *kind;
> +
> +if (!nl_policy_parse(reply,
> + NLMSG_HDRLEN + sizeof(struct ifinfomsg),
> + rtlink_policy, rtlink,
> + ARRAY_SIZE(rtlink_policy))
> +|| !nl_parse_nested(rtlink[IFLA_LINKINFO],
> linkinfo_policy,
> +linkinfo,
> ARRAY_SIZE(linkinfo_policy))) {
> +VLOG_ABORT("Error fetching Geneve tunnel device %s "
> +   "linkinfo", name);
> +}
> +
> +kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]);
> +
> +if (!strcmp(kind, "ovs_geneve")) {
> +out_of_tree = true;
> +} else if (!strcmp(kind, "geneve")) {
> +out_of_tree = false;
> +} else {
> +VLOG_ABORT("Geneve tunnel device %s with kind %s"
> +   " not supported", name, kind);
> +}
> +
> +ofpbuf_delete(reply);
> +netdev_close(netdev);
> +
> +return out_of_tree;
> +}
> +
>  error = dpif_netlink_rtnl_create(tnl_cfg, name,
> OVS_VPORT_TYPE_GENEVE,
>   "ovs_geneve",
>   (NLM_F_REQUEST | NLM_F_ACK
> --
> 2.7.4
>
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Guru Shetty
On 2 November 2017 at 12:55, Greg Rose  wrote:

> On 11/02/2017 11:12 AM, Greg Rose wrote:
>
>> On 11/02/2017 11:07 AM, Ben Pfaff wrote:
>>
>>> On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:
>>> > On certain Ubuntu systems running the 4.4 based kernel depmod
>>> > may not correctly search for module dependencies when newer
>>> > openvswitch kernel modules have been installed in the extra
>>> > directory at /lib/modules/$(uname -r)/extra.  A symptom of
>>> > this are the following messages in system log that can be
>>> > printed with the dmesg command:
>>>
>>> Thanks for figuring out the problem and documenting a fix.  I really
>>> appreciate documentation patches.
>>>
>>> > +#!/bin/sh
>>> > +
>>> > +check_ubuntu_depmod_config() {
>>> > +if [ -e /etc/depmod.d/ubuntu.conf ]; then
>>> > +if ! grep -q extra /etc/depmod.d/ubuntu.conf
>>> > +then
>>> > +sed -i s\/search\/"search extra"\/
>>> /etc/depmod.d/ubuntu.conf
>>> > +/sbin/depmod -a
>>> > +fi
>>> > +fi
>>> > +}
>>>
>>> I wonder about the details of this particular fix.  Usually, when there
>>> is a configuration file in a .d directory, like depmod.d, it is possible
>>> to add more files to the same directory that also get used for
>>> configuration.  When that works, it is usually better to add files to
>>> the directory rather than changing existing files, because it behaves
>>> better on upgrade.  So, in this case, I wonder whether it is possible to
>>> add a new file that would have something like:
>>>
>>>  search extra
>>>
>>
> This works if put in a separate file such as /etc/depmod.d/ovs-search-path.
> conf
> or something else.  Suggested names are welcome.  It also works if the
> instructions already in place to create the /etc/depmod.d/openvswitch.conf
> file are amended so that the first line of the file is 'search extra'.
>
> Like this:
>
> search extra
> override * * extra
> override * * weak-updates


I have over the years found something like this to work::

cat > /etc/depmod.d/openvswitch.conf << EOF
override openvswitch * extra
override vport-geneve * extra
override vport-stt * extra
override vport-* * extra
EOF



>
>
>
>>> or
>>>
>>>  override kmod * extra
>>>
>>
> Doesn't work.
>
>
>>> The latter is suggested by depmod.d(5).
>>>
>>> I'll give it a try and get back with the results.
>>
>> Thanks!
>>
>
> Let me know what the preference is and I'll spin up a V2 of the patch.
>
> Thanks,
>
> - Greg
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] Documentation: Add the Open vSwitch project charter.

2017-11-02 Thread Mark Michelson
Looks good to me.

On Thu, Nov 2, 2017 at 1:16 PM Ben Pfaff  wrote:

> I'd appreciate it if someone would review this change.  It is
> documentation only.
>
> On Tue, Oct 24, 2017 at 09:33:07AM -0700, Ben Pfaff wrote:
> > It always seems odd that this isn't in the repo, so this adds it, with
> > internal links properly directed.
> >
> > Signed-off-by: Ben Pfaff 
>
Acked-by: Mark Michelson 

> > ---
> >  Documentation/automake.mk   |   1 +
> >  Documentation/index.rst |   3 +-
> >  Documentation/internals/charter.rst | 204
> 
> >  Documentation/internals/index.rst   |   1 +
> >  4 files changed, 208 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/internals/charter.rst
> >
> > diff --git a/Documentation/automake.mk b/Documentation/automake.mk
> > index 6f38912f264b..6a2a169d3b21 100644
> > --- a/Documentation/automake.mk
> > +++ b/Documentation/automake.mk
> > @@ -78,6 +78,7 @@ DOC_SOURCE = \
> >   Documentation/internals/index.rst \
> >   Documentation/internals/authors.rst \
> >   Documentation/internals/bugs.rst \
> > + Documentation/internals/charter.rst \
> >   Documentation/internals/committer-grant-revocation.rst \
> >   Documentation/internals/committer-responsibilities.rst \
> >   Documentation/internals/documentation.rst \
> > diff --git a/Documentation/index.rst b/Documentation/index.rst
> > index 836c37fc3de9..904e4442b1da 100644
> > --- a/Documentation/index.rst
> > +++ b/Documentation/index.rst
> > @@ -105,7 +105,8 @@ Learn more about the Open vSwitch project and about
> how you can contribute:
> >:doc:`internals/contributing/coding-style` |
> >:doc:`internals/contributing/coding-style-windows`
> >
> > -- **Maintaining:** :doc:`internals/maintainers` |
> > +- **Maintaining:** :doc:`internals/charter` |
> > +  :doc:`internals/maintainers` |
> >:doc:`internals/committer-responsibilities` |
> >:doc:`internals/committer-grant-revocation`
> >
> > diff --git a/Documentation/internals/charter.rst
> b/Documentation/internals/charter.rst
> > new file mode 100644
> > index ..1c8c46ede5a2
> > --- /dev/null
> > +++ b/Documentation/internals/charter.rst
> > @@ -0,0 +1,204 @@
> > +The Linux Foundation Open vSwitch Project Charter
> > +=
> > +
> > +Effective August 9, 2016
> > +
> > +1. Mission of Open vSwitch Project (“OVS”).
> > +
> > +   The mission of OVS is to:
> > +
> > +   a. create an open source, production quality virtual networking
> > +  platform, including a software switch, control plane, and
> > +  related components, that supports standard management interfaces
> > +  and opens the forwarding functions to programmatic extension and
> > +  control; and
> > +
> > +   b. host the infrastructure for an OVS community, establishing a
> > +  neutral home for community assets, infrastructure, meetings,
> > +  events and collaborative discussions.
> > +
> > +2. Technical Steering Committee (“TSC”)
> > +
> > +   a. A TSC shall be composed of the Committers for OVS. The list of
> Committers
> > +  on the TSC are available at :doc:`/internals/maintainers`.
> > +
> > +   b. TSC projects generally will involve Committers and Contributors:
> > +
> > +  i. Contributors: anyone in the technical community that
> > + contributes code, documentation or other technical artifacts
> > + to the OVS codebase.
> > +
> > +  ii. Committers: Contributors who have the ability to commit
> > +  directly to a project’s main branch or repository on an OVS
> > +  project.
> > +
> > +   c. Participation in as a Contributor and/or Committer is open to
> > +  anyone under the terms of this Charter.  The TSC may:
> > +
> > +  i. establish work flows and procedures for the submission,
> > + approval and closure or archiving of projects,
> > +
> > +  ii. establish criteria and processes for the promotion of
> Contributors to
> > +  Committer status, available at
> > +  :doc:`/internals/committer-grant-revocation`. and
> > +
> > +  iii. amend, adjust and refine the roles of Contributors and
> Committers
> > +listed in Section 2.b., create new roles and publicly document
> > +responsibilities and expectations for such roles, as it sees
> fit,
> > +available at :doc:`/internals/committer-responsibilities`.
> > +
> > +   d. Responsibilities: The TSC is responsible for overseeing OVS
> > +  activities and making decisions that impact the mission of OVS,
> > +  including:
> > +
> > +  i. coordinating the technical direction of OVS;
> > +
> > +  ii. approving project proposals (including, but not limited to,
> > +  incubation, deprecation and changes to a project’s charter
> > +  or scope);
> > +
> > +  iii. creating sub-committees or working groups 

Re: [ovs-dev] [PATCHv3 1/3] ovsdb-idl: Fix memory leak

2017-11-02 Thread Yifeng Sun
Thanks for all your advice. I will pay close attention next time.

On Thu, Nov 2, 2017 at 2:14 PM, Ben Pfaff  wrote:

> On Tue, Oct 31, 2017 at 10:52:08AM -0700, Yifeng Sun wrote:
> > Valgrind testcase 2339 (ovn -- ipam connectivity) reports the leak below:
> > 45 (32 direct, 13 indirect) bytes in 1 blocks are definitely lost in
> loss record 65 of 83
> > at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_
> memcheck-amd64-linux.so)
> > by 0x4A6D64: xmalloc (util.c:120)
> > by 0x49C847: shash_add_nocopy__ (shash.c:109)
> > by 0x49C847: shash_add_nocopy (shash.c:121)
> > by 0x49CA85: shash_add (shash.c:129)
> > by 0x49CA85: shash_add_once (shash.c:136)
> > by 0x4914B5: ovsdb_idl_create_index (ovsdb-idl.c:2067)
> > by 0x406C98: create_ovnsb_indexes (ovn-controller.c:568)
> > by 0x406C98: main (ovn-controller.c:619)
> >
> > The leak happens when vsdb_idl_table is freed but its indexes are not
> freed.
> >
> > v1->v2: Amend comments.
> > v2->v3: Fix error in patch.
> >
> > Signed-off-by: Yifeng Sun 
>
> Thanks!  I'll apply this to master soon.
>
> Please don't put the changes from one version to the next into the
> commit message, because they should not go into the repository.  They
> can go after the --- line in the email; you can even put a --- line into
> the commit message and put them after it, if you prefer.
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv3 3/3] ovsdb-server.c: Fix memory leak

2017-11-02 Thread Ben Pfaff
On Tue, Oct 31, 2017 at 10:52:10AM -0700, Yifeng Sun wrote:
> Valgrind testcase 2349 (ovn -- DSCP marking check) reports the leak below:
> 21 bytes in 21 blocks are definitely lost in loss record 24 of 362
> at 0x4C2DB8F: malloc (in 
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x436FD4: xmalloc (util.c:120)
> by 0x437044: xmemdup0 (util.c:150)
> by 0x408C97: add_manager_options (ovsdb-server.c:709)
> by 0x408C97: query_db_remotes (ovsdb-server.c:765)
> by 0x408C97: reconfigure_remotes (ovsdb-server.c:926)
> by 0x406273: main_loop (ovsdb-server.c:194)
> by 0x406273: main (ovsdb-server.c:434)
> 
> When options are freed, options->role need to be freed explicitly.
> 
> v1->v3: Amend valgrind report.
> 
> Signed-off-by: Yifeng Sun 
> ---
>  ovsdb/ovsdb-server.c | 17 -
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
> index 030d86ba467f..cd30dd48425b 100644
> --- a/ovsdb/ovsdb-server.c
> +++ b/ovsdb/ovsdb-server.c
> @@ -674,6 +674,21 @@ add_remote(struct shash *remotes, const char *target)
>  return options;
>  }
>  
> +static void
> +free_remotes(struct shash *remotes)
> +{
> +struct ovsdb_jsonrpc_options *options;
> +struct shash_node *node;
> +
> +if (remotes) {
> +SHASH_FOR_EACH(node, remotes) {
> +options = node->data;
> +free(options->role);
> +}
> +shash_destroy_free_data(remotes);
> +}
> +}

Thanks a lot.  I'll apply this to master in a minute.

Please put a space after SHASH_FOR_EACH, etc., like we do after the
"for" keyword.  I fixed that up.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv3 2/3] test-ovsdb: Fix memory leak

2017-11-02 Thread Ben Pfaff
On Tue, Oct 31, 2017 at 10:52:09AM -0700, Yifeng Sun wrote:
> Valgrind testcase 1465 (integer atom enum from string) reports the leak below:
> 16 bytes in 1 blocks are definitely lost in loss record 2 of 5
> at 0x4C2DB8F: malloc (in 
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x43F5F4: xmalloc (util.c:120)
> by 0x424AC6: alloc_default_atoms (ovsdb-data.c:315)
> by 0x4271E0: ovsdb_atom_from_string__ (ovsdb-data.c:508)
> by 0x4271E0: ovsdb_atom_from_string (ovsdb-data.c:632)
> by 0x40ADCC: do_parse_atom_strings (test-ovsdb.c:566)
> by 0x41BA73: ovs_cmdl_run_command__ (command-line.c:115)
> by 0x4051C9: main (test-ovsdb.c:72)
> 
> range_end_atom is allocated in ovsdb_atom_from_string__() and no one is 
> holding a reference to it at the end of do_parse_atom_strings(). It should be 
> freed here, as also pointed out by ovsdb_atom_destroy().
> 
> v1->v2: Amend comments.
> v2->v3: Fix error in patch.
> 
> Signed-off-by: Yifeng Sun 
> ---
>  tests/test-ovsdb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
> index 451172cdcc34..b5147fc055e3 100644
> --- a/tests/test-ovsdb.c
> +++ b/tests/test-ovsdb.c
> @@ -582,6 +582,7 @@ do_parse_atom_strings(struct ovs_cmdl_context *ctx)
>  ovsdb_atom_destroy(, base.type);
>  if (range_end_atom) {
>  ovsdb_atom_destroy(range_end_atom, base.type);
> + free(range_end_atom);
>  }
>  }

Thanks!  I'll apply this to master in a minute.

The patch adds a tab for indentation.  We only use spaces, so I fixed
that.

Thanks,

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


Re: [ovs-dev] [PATCHv3 1/3] ovsdb-idl: Fix memory leak

2017-11-02 Thread Ben Pfaff
On Tue, Oct 31, 2017 at 10:52:08AM -0700, Yifeng Sun wrote:
> Valgrind testcase 2339 (ovn -- ipam connectivity) reports the leak below:
> 45 (32 direct, 13 indirect) bytes in 1 blocks are definitely lost in loss 
> record 65 of 83
> at 0x4C2DB8F: malloc (in 
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x4A6D64: xmalloc (util.c:120)
> by 0x49C847: shash_add_nocopy__ (shash.c:109)
> by 0x49C847: shash_add_nocopy (shash.c:121)
> by 0x49CA85: shash_add (shash.c:129)
> by 0x49CA85: shash_add_once (shash.c:136)
> by 0x4914B5: ovsdb_idl_create_index (ovsdb-idl.c:2067)
> by 0x406C98: create_ovnsb_indexes (ovn-controller.c:568)
> by 0x406C98: main (ovn-controller.c:619)
> 
> The leak happens when vsdb_idl_table is freed but its indexes are not freed.
> 
> v1->v2: Amend comments.
> v2->v3: Fix error in patch.
> 
> Signed-off-by: Yifeng Sun 

Thanks!  I'll apply this to master soon.

Please don't put the changes from one version to the next into the
commit message, because they should not go into the repository.  They
can go after the --- line in the email; you can even put a --- line into
the commit message and put them after it, if you prefer.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv3] dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

2017-11-02 Thread Eric Garver
On Thu, Nov 02, 2017 at 12:01:17PM -0700, William Tu wrote:
> When using the out-of-tree (openvswitch compat) geneve module,
> the first time oot tunnel probing returns true (correct).
> Without unloading the geneve module, if the userspace ovs-vswitchd
> restarts, because the 'geneve_sys_6081' still exists, the probing
> incorrectly returns false and loads the in-tree (upstream kernel)
> geneve module.
> 
> The patch fixes it by querying the geneve device's kind when exists.
> The out-of-tree modules uses kind string as 'ovs_geneve', while the
> in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> > /etc/init.d/openvswitch-switch start
> > creat a bridge and attach a geneve port using out-of-tree geneve
> > /etc/init.d/openvswitch-switch restart
> 
> Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides 
> used interface")
> Signed-off-by: William Tu 
> Cc: Eric Garver 
> Cc: Gurucharan Shetty 
> ---
> v2->v3:
> Add return code checking for netlink parsing
> Fix memory leak
> v1->v2:
> Add detection of existing module, instead of unconditionally
> remote it and create.
> ---
>  lib/dpif-netlink-rtnl.c | 39 +++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 0c32e7d8ccb4..fe9c8ed7104f 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  
>  error = netdev_open("ovs-system-probe", "geneve", );
>  if (!error) {
> +struct ofpbuf *reply;
>  const struct netdev_tunnel_config *tnl_cfg;
>  
>  tnl_cfg = netdev_get_tunnel_config(netdev);
> @@ -448,6 +449,44 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  }
>  
>  name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
> +
> +/* The geneve module exists when ovs-vswitchd crashes
> + * and restarts, handle the case here.
> + */
> +error = dpif_netlink_rtnl_getlink(name, );
> +if (!error) {
> +
> +struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)];
> +struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)];
> +const char *kind;
> +
> +if (!nl_policy_parse(reply,
> + NLMSG_HDRLEN + sizeof(struct ifinfomsg),
> + rtlink_policy, rtlink,
> + ARRAY_SIZE(rtlink_policy))
> +|| !nl_parse_nested(rtlink[IFLA_LINKINFO], linkinfo_policy,
> +linkinfo, ARRAY_SIZE(linkinfo_policy))) {
> +VLOG_ABORT("Error fetching Geneve tunnel device %s "
> +   "linkinfo", name);
> +}
> +
> +kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]);
> +
> +if (!strcmp(kind, "ovs_geneve")) {
> +out_of_tree = true;
> +} else if (!strcmp(kind, "geneve")) {
> +out_of_tree = false;
> +} else {
> +VLOG_ABORT("Geneve tunnel device %s with kind %s"
> +   " not supported", name, kind);
> +}
> +
> +ofpbuf_delete(reply);
> +netdev_close(netdev);
> +
> +return out_of_tree;
> +}
> +
>  error = dpif_netlink_rtnl_create(tnl_cfg, name, 
> OVS_VPORT_TYPE_GENEVE,
>   "ovs_geneve",
>   (NLM_F_REQUEST | NLM_F_ACK

This looks better. Thanks!

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


[ovs-dev] [Patch V2] Documentation: Document additional module dependency

2017-11-02 Thread Greg Rose
On certain Ubuntu systems running the 4.4 based kernel depmod
may not correctly search for module dependencies when newer
openvswitch kernel modules have been installed in the extra
directory at /lib/modules/$(uname -r)/extra.  A symptom of
this are the following messages in system log that can be
printed with the dmesg command:

[164917.582125] vport_lisp: disagrees about version of symbol ovs_netdev_link
[164917.582139] vport_lisp: Unknown symbol ovs_netdev_link (err -22)
[164917.582155] vport_lisp: Unknown symbol ovs_lisp_fill_metadata_dst (err 0)
[164917.582165] vport_lisp: Unknown symbol rpl_rtnl_delete_link (err 0)
[164917.582169] vport_lisp: disagrees about version of symbol 
ovs_netdev_tunnel_destroy
[164917.582170] vport_lisp: Unknown symbol ovs_netdev_tunnel_destroy (err -22)
[164917.582178] vport_lisp: Unknown symbol rpl_lisp_xmit (err 0)
[164917.582184] vport_lisp: Unknown symbol rpl_lisp_dev_create_fb (err 0)
[164917.582187] vport_lisp: disagrees about version of symbol 
__ovs_vport_ops_register
[164917.582188] vport_lisp: Unknown symbol __ovs_vport_ops_register (err -22)
[164917.582191] vport_lisp: disagrees about version of symbol 
ovs_vport_ops_unregister
[164917.582192] vport_lisp: Unknown symbol ovs_vport_ops_unregister (err -22)
[164917.582194] vport_lisp: disagrees about version of symbol ovs_vport_alloc
[164917.582195] vport_lisp: Unknown symbol ovs_vport_alloc (err -22)
[164917.582197] vport_lisp: disagrees about version of symbol ovs_vport_free
[164917.582198] vport_lisp: Unknown symbol ovs_vport_free (err -22)
[164917.606229] vport_stt: disagrees about version of symbol ovs_netdev_link
[164917.606233] vport_stt: Unknown symbol ovs_netdev_link (err -22)
[164917.606248] vport_stt: Unknown symbol ovs_stt_fill_metadata_dst (err 0)
[164917.606260] vport_stt: Unknown symbol rpl_rtnl_delete_link (err 0)
[164917.606264] vport_stt: disagrees about version of symbol 
ovs_netdev_tunnel_destroy
[164917.606266] vport_stt: Unknown symbol ovs_netdev_tunnel_destroy (err -22)
[164917.606274] vport_stt: Unknown symbol ovs_stt_dev_create_fb (err 0)
[164917.606279] vport_stt: disagrees about version of symbol 
__ovs_vport_ops_register
[164917.606281] vport_stt: Unknown symbol __ovs_vport_ops_register (err -22)
[164917.606285] vport_stt: disagrees about version of symbol 
ovs_vport_ops_unregister
[164917.606286] vport_stt: Unknown symbol ovs_vport_ops_unregister (err -22)
[164917.606291] vport_stt: disagrees about version of symbol ovs_vport_alloc
[164917.606292] vport_stt: Unknown symbol ovs_vport_alloc (err -22)
[164917.606295] vport_stt: disagrees about version of symbol ovs_vport_free
[164917.606297] vport_stt: Unknown symbol ovs_vport_free (err -22)
[164917.606305] vport_stt: Unknown symbol ovs_stt_xmit (err 0)

When this occurs the 'make check-kmod' command will experience many
failures and openvswitch will not operate correctly.

Adding 'search extra' to the beginning of the /etc/depmod.d/openvswitch.conf
module dependency configuration file fixes the problem.  So to be safe
just add it.

Signed-off-by: Greg Rose 
---
 Documentation/intro/install/general.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index e5ec155..a561b57 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -385,6 +385,7 @@ Building
following snippet of code achieves the same::
 
$ config_file="/etc/depmod.d/openvswitch.conf"
+   $ echo "search extra" >> "$config_file"
$ for module in datapath/linux/*.ko; do
  modname="$(basename ${module})"
  echo "override ${modname%.ko} * extra" >> "$config_file"
-- 
1.8.3.1

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


Re: [ovs-dev] [PATCH] netdev-dummy: Remove wrong netdev_close

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 06:42:22AM -0700, Yifeng Sun wrote:
> netdev_dummy_ip6addr() calls netdev_close() twice though it increases 
> netdev's reference only once from netdev_from_name(). As a result, Valgrind 
> test 788 (tunnel_push_pop - action) reports the error below:

Thanks a lot!  I applied this to master.

(Please wrap your commit messages to about 75 columns, though.)
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 2/2] OVN: Add support for periodic router advertisements.

2017-11-02 Thread Mark Michelson
This change adds three new options to the Northbound
Logical_Router_Port's ipv6_ra_configs option:

* send_periodic: If set to "true", then OVN will send periodic router
advertisements out of this router port.
* max_interval: The maximum amount of time to wait between sending
periodic router advertisements.
* min_interval: The minimum amount of time to wait between sending
periodic router advertisements.

When send_periodic is true, then IPv6 RA configs, as well as some layer
2 and layer 3 information about the router port, are copied to the
southbound database. From there, ovn-controller can use this information
to know when to send periodic RAs and what to send in them.

Because periodic RAs originate from each ovn-controller, the new
keep-local flag is set on the packet so that ports don't receive an
overabundance of RAs.

Signed-off-by: Mark Michelson 
---
 lib/packets.h|   4 +
 ovn/controller/pinctrl.c | 349 +++
 ovn/northd/ovn-northd.c  |  65 +
 ovn/ovn-nb.xml   |  19 +++
 tests/ovn-northd.at  | 110 +++
 tests/ovn.at | 150 
 6 files changed, 697 insertions(+)

diff --git a/lib/packets.h b/lib/packets.h
index 057935cbf..9d69b93d0 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -976,6 +976,7 @@ BUILD_ASSERT_DECL(ND_PREFIX_OPT_LEN == sizeof(struct 
ovs_nd_prefix_opt));
 
 /* Neighbor Discovery option: MTU. */
 #define ND_MTU_OPT_LEN 8
+#define ND_MTU_DEFAULT 0
 struct ovs_nd_mtu_opt {
 uint8_t  type;  /* ND_OPT_MTU */
 uint8_t  len;   /* Always 1. */
@@ -1015,6 +1016,9 @@ BUILD_ASSERT_DECL(RA_MSG_LEN == sizeof(struct 
ovs_ra_msg));
 #define ND_RA_MANAGED_ADDRESS 0x80
 #define ND_RA_OTHER_CONFIG0x40
 
+#define ND_RA_MAX_INTERVAL_DEFAULT 600
+#define ND_RA_MIN_INTERVAL_DEFAULT(max) (max) >= 9 ? (max) / 3 : (max) * 3 / 4
+
 /*
  * Use the same struct for MLD and MLD2, naming members as the defined fields 
in
  * in the corresponding version of the protocol, though they are reserved in 
the
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 29b2dde0c..f97eba4d5 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -48,6 +48,7 @@
 #include "socket-util.h"
 #include "timeval.h"
 #include "vswitch-idl.h"
+#include "lflow.h"
 
 VLOG_DEFINE_THIS_MODULE(pinctrl);
 
@@ -88,6 +89,11 @@ static void pinctrl_handle_put_nd_ra_opts(
 static void pinctrl_handle_nd_ns(const struct flow *ip_flow,
  const struct match *md,
  struct ofpbuf *userdata);
+static void init_ipv6_ras(void);
+static void destroy_ipv6_ras(void);
+static void ipv6_ra_wait(void);
+static void send_ipv6_ras(const struct controller_ctx *ctx,
+struct hmap *local_datapaths);
 
 COVERAGE_DEFINE(pinctrl_drop_put_mac_binding);
 
@@ -98,6 +104,7 @@ pinctrl_init(void)
 conn_seq_no = 0;
 init_put_mac_bindings();
 init_send_garps();
+init_ipv6_ras();
 }
 
 static ovs_be32
@@ -1083,8 +1090,348 @@ pinctrl_run(struct controller_ctx *ctx,
 run_put_mac_bindings(ctx);
 send_garp_run(ctx, br_int, chassis, chassis_index, local_datapaths,
   active_tunnels);
+send_ipv6_ras(ctx, local_datapaths);
 }
 
+/* Table of ipv6_ra_state structures, keyed on logical port name */
+static struct shash ipv6_ras;
+
+/* Next IPV6 RA in seconds. */
+static long long int send_ipv6_ra_time;
+
+struct ipv6_network_prefix {
+struct in6_addr addr;
+unsigned int prefix_len;
+};
+
+struct ipv6_ra_config {
+time_t min_interval;
+time_t max_interval;
+struct eth_addr eth_src;
+struct eth_addr eth_dst;
+struct in6_addr ipv6_src;
+struct in6_addr ipv6_dst;
+ovs_be32 mtu;
+uint8_t mo_flags;
+uint8_t la_flags;
+struct ipv6_network_prefix *prefixes;
+int n_prefixes;
+};
+
+struct ipv6_ra_state {
+long long int next_announce;
+struct ipv6_ra_config *config;
+int64_t port_key;
+int64_t metadata;
+bool deleteme;
+};
+
+static void
+init_ipv6_ras(void)
+{
+shash_init(_ras);
+send_ipv6_ra_time = LLONG_MAX;
+}
+
+static void ipv6_ra_config_delete(struct ipv6_ra_config *config)
+{
+if (config) {
+free(config->prefixes);
+}
+free(config);
+}
+
+static void
+ipv6_ra_delete(struct ipv6_ra_state *ra)
+{
+ipv6_ra_config_delete(ra->config);
+free(ra);
+}
+
+static void
+destroy_ipv6_ras(void)
+{
+struct shash_node *iter, *next;
+SHASH_FOR_EACH_SAFE (iter, next, _ras) {
+struct ipv6_ra_state *ra = iter->data;
+ipv6_ra_delete(ra);
+shash_delete(_ras, iter);
+}
+shash_destroy(_ras);
+}
+
+static struct ipv6_ra_config *
+ipv6_ra_update_config(const struct sbrec_port_binding *pb)
+{
+struct ipv6_ra_config *config;
+
+config = xzalloc(sizeof *config);
+
+config->max_interval = smap_get_int(>options, "ipv6_ra_max_interval",
+

[ovs-dev] [PATCH v2 1/2] OVN: Add multicast keep-local flag.

2017-11-02 Thread Mark Michelson
When this flag is set, then a multicast packet that would normally be
delivered to ports on multiple hypervisors is only delivered to ports
on the local hypervisor.

The primary known use case for this is when multicast packets originate
from ovn-controller. Multiple ovn-controllers will be attempting to send
out those multicast packets, and so each should only be responsible for
delivering those packets to their local ports.

Signed-off-by: Mark Michelson 
---
 ovn/controller/physical.c  | 15 +++
 ovn/lib/logical-fields.h   |  6 ++
 ovn/ovn-architecture.7.xml | 10 ++
 3 files changed, 31 insertions(+)

diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index df71979f9..b2216457f 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -995,6 +995,21 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id 
mff_ovn_geneve,
 struct ofpbuf remote_ofpacts;
 ofpbuf_init(_ofpacts, 0);
 SBREC_MULTICAST_GROUP_FOR_EACH (mc, ctx->ovnsb_idl) {
+/* Table 32, priority 150.
+ * ===
+ *
+ * Multicast packets that should not be sent to other hypervisors.
+ */
+struct match match = MATCH_CATCHALL_INITIALIZER;
+match_set_metadata(, htonll(mc->datapath->tunnel_key));
+match_set_reg(, MFF_LOG_OUTPORT - MFF_REG0, mc->tunnel_key);
+match_set_reg_masked(, MFF_LOG_FLAGS - MFF_REG0,
+ MLF_KEEP_LOCAL, MLF_KEEP_LOCAL);
+ofpbuf_clear();
+put_resubmit(OFTABLE_LOCAL_OUTPUT, );
+ofctrl_add_flow(flow_table, OFTABLE_REMOTE_OUTPUT, 150, 0, ,
+);
+
 consider_mc_group(mff_ovn_geneve, ct_zones, local_datapaths, chassis,
   mc, , _ofpacts, flow_table);
 }
diff --git a/ovn/lib/logical-fields.h b/ovn/lib/logical-fields.h
index 696c529be..eb0b8f422 100644
--- a/ovn/lib/logical-fields.h
+++ b/ovn/lib/logical-fields.h
@@ -49,6 +49,7 @@ enum mff_log_flags_bits {
 MLF_RCV_FROM_VXLAN_BIT = 1,
 MLF_FORCE_SNAT_FOR_DNAT_BIT = 2,
 MLF_FORCE_SNAT_FOR_LB_BIT = 3,
+MLF_KEEP_LOCAL_BIT = 4,
 };
 
 /* MFF_LOG_FLAGS_REG flag assignments */
@@ -69,6 +70,11 @@ enum mff_log_flags {
 /* Indicate that a packet needs a force SNAT in the gateway router when
  * load-balancing has taken place. */
 MLF_FORCE_SNAT_FOR_LB = (1 << MLF_FORCE_SNAT_FOR_LB_BIT),
+
+/* Indicate that a packet that should be distributed across multiple
+ * hypervisors should instead only be output to local targets
+ */
+MLF_KEEP_LOCAL = (1 << MLF_KEEP_LOCAL_BIT),
 };
 
 #endif /* ovn/lib/logical-fields.h */
diff --git a/ovn/ovn-architecture.7.xml b/ovn/ovn-architecture.7.xml
index b13b41177..9c7663e93 100644
--- a/ovn/ovn-architecture.7.xml
+++ b/ovn/ovn-architecture.7.xml
@@ -1027,6 +1027,16 @@
   their traffic should never go out through a tunnel.
 
 
+  A higher-priority rule to match packets that have the MLF_KEEP_LOCAL
+  logical flow flag set, and whose destination is a multicast address.
+  This flag indicates that the packet should not be delivered to remote
+  hypervisors, even if the multicast destination includes ports on
+  remote hypervisors. This flag is used when ovn-controller is the
+  originator of the multicast packet. Since each ovn-controller
+  instance is originating these packets, the packets only need to be
+  delivered to local ports.
+
+
   A fallback flow that resubmits to table 33 if there is no other
   match.
 
-- 
2.13.5

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


[ovs-dev] [PATCH v2 0/2] OVN: Add support for periodic router advertisements

2017-11-02 Thread Mark Michelson
This patch series adds support for sending periodic router
advertisements from OVN. The patch is divided into two commits

* Commit 1 introduces a method to ensure that multicast packets are sent
  only to targets on the local hypervisor
* Commit 2 adds the ability to actually send the periodic RAs.

This patch series builds on the work in Numan Siddique's "ovn IPv6: Add
Router Solicitation responder support and generate Neighbor Solicitation
request for unknown" (patch series 11416 if using git-pw). Thus this
patch series cannot be merged until that patch series is merged first.

There are a couple of points I'd like to bring up with regards to this
patch that I would like addressed in reviews:

* I placed the logic for sending periodic RAs in pinctrl.c. My reasoning
  for this was that the closest thing that exists in OVN today is the
  periodic sending of gratuitous ARP requests, and that is in pinctrl.c.
  If periodic sending of RAs should be placed into a separate file,
  please let me know.
* In this patch, you will notice that a copy of the put_load() function
  from ovn/controller/physical.c has been placed in pinctrl.c. My choice
  was either to make the function public or duplicate it. Given that the
  function is so small, I see no reason why it would be modified, I went
  with the duplication choice. However, if it should be done the other
  way, let me know and I'll go that direction instead.


v1 -> v2:
* The patchset has been applied on top of patch series 11416. The cover
  letter above has been adjusted for that change.
* Patch 1 has been updated by adding new information to the
  ovn-architecture manpage that mentions the MLF_KEEP_LOCAL flows
  installed in table 32.

Mark Michelson (2):
  OVN: Add multicast keep-local flag.
  OVN: Add support for periodic router advertisements.

 lib/packets.h  |   4 +
 ovn/controller/physical.c  |  15 ++
 ovn/controller/pinctrl.c   | 349 +
 ovn/lib/logical-fields.h   |   6 +
 ovn/northd/ovn-northd.c|  65 +
 ovn/ovn-architecture.7.xml |  10 ++
 ovn/ovn-nb.xml |  19 +++
 tests/ovn-northd.at| 110 ++
 tests/ovn.at   | 150 +++
 9 files changed, 728 insertions(+)

-- 
2.13.5

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


Re: [ovs-dev] [PATCH v10 0/4] Add Router Solicitation responder support and generate Neighbor Solicitation request for unknown

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 01:37:40PM -0700, Ben Pfaff wrote:
> Thank you for the patches!  They look good to me, so I will apply them
> to master soon.  I folded in a few minor changes to patch 2, which I'll
> mention in a reply to that patch.

Oh, one more thing: I'd appreciate it if you would follow up with a
patch that adds an item to NEWS, to explain the new feature to end
users.

Thanks,

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


Re: [ovs-dev] [PATCH v10 2/4] ovn-controller: Add a new action - 'put_nd_ra_opts'

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 06:19:24AM +0530, nusid...@redhat.com wrote:
> From: Numan Siddique 
> 
> This patch adds a new OVN action 'put_nd_ra_opts' to support native
> IPv6 Router Advertisement in OVN. This action can be used to respond
> to the IPv6 Router Solicitation requests.

Thanks for the patch!  I folded in the following changes because I
didn't think it made sense to mention the function name in error
messages; we don't do that elsewhere.

diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index 8cec5c7d0871..0df5edbaa51d 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -1851,69 +1851,57 @@ parse_put_nd_ra_opts(struct action_context *ctx, const 
struct expr_field *dst,
 o < >options[po->n_options]; o++) {
 const union expr_constant *c = o->value.values;
 if (o->value.n_values > 1) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts -Invalid value for"
-" the option %s.", o->option->name);
+lexer_error(ctx->lexer, "Invalid value for \"%s\" option",
+o->option->name);
 return;
 }
 
+bool ok = true;
 switch (o->option->code) {
 case ND_RA_FLAG_ADDR_MODE:
-if (!c->string || (strcmp(c->string, "slaac") &&
-   strcmp(c->string, "dhcpv6_stateful") &&
-   strcmp(c->string, "dhcpv6_stateless"))) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts -Invalid value "
-"for the option %s.", o->option->name);
-return;
-}
-
-if (!strcmp(c->string, "dhcpv6_stateful")) {
+ok = (c->string && (!strcmp(c->string, "slaac") ||
+!strcmp(c->string, "dhcpv6_stateful") ||
+!strcmp(c->string, "dhcpv6_stateless")));
+if (ok && !strcmp(c->string, "dhcpv6_stateful")) {
 addr_mode_stateful = true;
 }
 break;
 
 case ND_OPT_SOURCE_LINKADDR:
-if (c->format != LEX_F_ETHERNET) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts -Invalid value "
-   "for the option %s.", o->option->name);
-}
+ok = c->format == LEX_F_ETHERNET;
 slla_present = true;
 break;
 
 case ND_OPT_PREFIX_INFORMATION:
-if (c->format != LEX_F_IPV6 || !c->masked) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts -Invalid value "
-"for the option %s.", o->option->name);
-}
+ok = c->format == LEX_F_IPV6 && c->masked;
 prefix_set = true;
 break;
 
 case ND_OPT_MTU:
-if (c->format != LEX_F_DECIMAL) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts -Invalid value "
-"for the option %s.", o->option->name);
-}
+ok = c->format == LEX_F_DECIMAL;
 break;
 }
-}
 
-if (ctx->lexer->error) {
-return;
+if (!ok) {
+lexer_error(ctx->lexer, "Invalid value for \"%s\" option",
+o->option->name);
+return;
+}
 }
 
 if (!slla_present) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts - slla option not"
-" present.");
+lexer_error(ctx->lexer, "slla option not present");
 return;
 }
 
 if (addr_mode_stateful && prefix_set) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts - prefix option can't be"
+lexer_error(ctx->lexer, "prefix option can't be"
 " set when address mode is dhcpv6_stateful.");
 return;
 }
 
 if (!addr_mode_stateful && !prefix_set) {
-lexer_error(ctx->lexer, "parse_put_nd_ra_opts - prefix option needs "
+lexer_error(ctx->lexer, "prefix option needs "
 "to be set when address mode is slaac/dhcpv6_stateless.");
 return;
 }
diff --git a/tests/ovn.at b/tests/ovn.at
index 320ec4bb2b72..93515aa329d1 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -1083,25 +1083,25 @@ reg1[0] = put_nd_ra_opts(addr_mode = 
"dhcpv6_stateless", slla = ae:01:02:03:04:0
 encodes as 
controller(userdata=00.00.00.08.00.00.00.00.00.01.de.10.00.00.00.40.86.00.00.00.ff.40.ff.ff.00.00.00.00.00.00.00.00.01.01.ae.01.02.03.04.06.03.04.40.c0.ff.ff.ff.ff.ff.ff.ff.ff.00.00.00.00.ae.f0.00.00.00.00.00.00.00.00.00.00.00.00.00.00,pause)
 has prereqs ip6
 reg1[0] = put_nd_ra_opts(addr_mode = "slaac", mtu = 1500, prefix = aef0::/64);
-parse_put_nd_ra_opts - slla option not present.
+slla option not present
 reg1[0] = put_nd_ra_opts(addr_mode = "dhcpv6_stateful", mtu = 1450, prefix = 
aef0::/64, prefix = bef0::/64, slla = ae:01:02:03:04:10);
-parse_put_nd_ra_opts - prefix option can't be set when address mode 

Re: [ovs-dev] [PATCH v10 0/4] Add Router Solicitation responder support and generate Neighbor Solicitation request for unknown

2017-11-02 Thread Ben Pfaff
Thank you for the patches!  They look good to me, so I will apply them
to master soon.  I folded in a few minor changes to patch 2, which I'll
mention in a reply to that patch.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Greg Rose

On 11/02/2017 01:09 PM, Ben Pfaff wrote:

On Thu, Nov 02, 2017 at 12:55:13PM -0700, Greg Rose wrote:

On 11/02/2017 11:12 AM, Greg Rose wrote:

On 11/02/2017 11:07 AM, Ben Pfaff wrote:

On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:

On certain Ubuntu systems running the 4.4 based kernel depmod
may not correctly search for module dependencies when newer
openvswitch kernel modules have been installed in the extra
directory at /lib/modules/$(uname -r)/extra.  A symptom of
this are the following messages in system log that can be
printed with the dmesg command:


Thanks for figuring out the problem and documenting a fix.  I really
appreciate documentation patches.


+#!/bin/sh
+
+check_ubuntu_depmod_config() {
+if [ -e /etc/depmod.d/ubuntu.conf ]; then
+if ! grep -q extra /etc/depmod.d/ubuntu.conf
+then
+sed -i s\/search\/"search extra"\/ 
/etc/depmod.d/ubuntu.conf
+/sbin/depmod -a
+fi
+fi
+}


I wonder about the details of this particular fix.  Usually, when there
is a configuration file in a .d directory, like depmod.d, it is possible
to add more files to the same directory that also get used for
configuration.  When that works, it is usually better to add files to
the directory rather than changing existing files, because it behaves
better on upgrade.  So, in this case, I wonder whether it is possible to
add a new file that would have something like:

 search extra


This works if put in a separate file such as /etc/depmod.d/ovs-search-path.conf
or something else.  Suggested names are welcome.  It also works if the
instructions already in place to create the /etc/depmod.d/openvswitch.conf
file are amended so that the first line of the file is 'search extra'.

Like this:

search extra
override * * extra
override * * weak-updates


I forgot we already had instructions for that.  It seems easiest to just
add the extra line there, then.



Will do.  Thanks.

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


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Greg Rose

On 11/02/2017 11:12 AM, Greg Rose wrote:

On 11/02/2017 11:07 AM, Ben Pfaff wrote:

On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:
> On certain Ubuntu systems running the 4.4 based kernel depmod
> may not correctly search for module dependencies when newer
> openvswitch kernel modules have been installed in the extra
> directory at /lib/modules/$(uname -r)/extra.  A symptom of
> this are the following messages in system log that can be
> printed with the dmesg command:

Thanks for figuring out the problem and documenting a fix.  I really
appreciate documentation patches.

> +#!/bin/sh
> +
> +check_ubuntu_depmod_config() {
> +if [ -e /etc/depmod.d/ubuntu.conf ]; then
> +if ! grep -q extra /etc/depmod.d/ubuntu.conf
> +then
> +sed -i s\/search\/"search extra"\/ 
/etc/depmod.d/ubuntu.conf
> +/sbin/depmod -a
> +fi
> +fi
> +}

I wonder about the details of this particular fix.  Usually, when there
is a configuration file in a .d directory, like depmod.d, it is possible
to add more files to the same directory that also get used for
configuration.  When that works, it is usually better to add files to
the directory rather than changing existing files, because it behaves
better on upgrade.  So, in this case, I wonder whether it is possible to
add a new file that would have something like:

 search extra


This works if put in a separate file such as /etc/depmod.d/ovs-search-path.conf
or something else.  Suggested names are welcome.  It also works if the
instructions already in place to create the /etc/depmod.d/openvswitch.conf
file are amended so that the first line of the file is 'search extra'.

Like this:

search extra
override * * extra
override * * weak-updates



or

 override kmod * extra


Doesn't work.



The latter is suggested by depmod.d(5).


I'll give it a try and get back with the results.

Thanks!


Let me know what the preference is and I'll spin up a V2 of the patch.

Thanks,

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


[ovs-dev] Investment Proposal.

2017-11-02 Thread mickbrewis
Good Morning,

I am Mick Brewis, one of the Directors of The Scottish Investment 
Trust PLC, One of UK`s largest oldest independent self managed 
funds management company with over £45billion Capital Investment 
Funds.

Nevertheless, as Scottish Investment Funds Manager, I handle all 
our Investor's Direct Capital Funds and secretly extract 1.3% 
Excess Maximum Return Capital Profit (EMRCP) per annum on each of 
the Investor’s Magellan Capital Funds. As an expert, I have made 
over (GBP 60million) Sixty Million Great Britain Pounds from the 
Investor's EMRCP and hereby looking for someone to trust who will 
stand as an Investor to receive the funds as Annual Investment 
Proceeds from Scottish Magellan Capital Funds.

All confirmed documents to back up the claims will be made 
available to you prior to your acceptance. Meanwhile, I have 
worked out the strategies and technicalities whereby the funds 
can be claimed in any of our Clearing Houses without any hitches. 
Our sharing ratio should be 70-30. If you are interested,You can 
state down your direct telephone number, for discussions or 
relate your interest via my email.


Sincerely,
Mick Brewis.
The Scottish Investment Trust
6 Albyn Place Edinburgh EH2 4NL
www.thescottish.co.uk
https://thescottish.co.uk/shareholder-information/the-board
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] Importancia a Nivel Mundial

2017-11-02 Thread Desarrollo Sustentable
Conozca los ODS y establezca alianzas con las empresas del futuro

Los Objetivos del Desarrollo Sustentable y su importancia en los negocios
16 de noviembre - Mtra. Guillermina Barrera Zaragoza9am-6pm

En septiembre de 2015, se llevó a cabo la Cumbre para el Desarrollo Sostenible, 
en la cual los Estados Miembros de la ONU aprobaron la Agenda 2030 para el 
Desarrollo Sostenible, que incluye un conjunto de 17 Objetivos de Desarrollo 
Sostenible (ODS) para poner fin a la pobreza, luchar contra la desigualdad y la 
injusticia y hacer frente al cambio climático, asegurando la prosperidad para 
todos como parte de una nueva agenda de desarrollo sostenible. Es importante 
saber que será necesario contar con iniciativas que deben ir de la mano de 
estrategias que favorezcan el crecimiento económico, aborden una serie de 
necesidades sociales (educación, salud y oportunidades de empleo entre otras), 
luchen contra el cambio climático y promueven la protección del medio ambiente. 

BENEFICIOS DE ASISTIR: 

a) Conocerá los ODS y su importancia a nivel mundial 
b) Evaluará la importancia que revisten los ODS para su empresa, entorno social 
y medio ambiente global y local.
c) Identificará proyectos a desarrollar, relacionados con los ODS en su empresa 
o cadena de valor. 
d) Considerará una idea de proyecto alcanzable 
e) Analizará los riesgos en la empresa al no implementar dichos objetivos 

¿Requiere la información a la Brevedad? responda este email con la palabra: 
Desarrollo + nombre - teléfono - correo.


centro telefónico:018002120744


 


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


Re: [ovs-dev] [PATCHv2] dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

2017-11-02 Thread William Tu
On Thu, Nov 2, 2017 at 10:32 AM, Eric Garver  wrote:
> On Wed, Nov 01, 2017 at 12:35:40PM -0700, William Tu wrote:
>> When using the out-of-tree (openvswitch compat) geneve module,
>> the first time oot tunnel probing returns true (correct).
>> Without unloading the geneve module, if the userspace ovs-vswitchd
>> restarts, because the 'geneve_sys_6081' still exists, the probing
>> incorrectly returns false and loads the in-tree (upstream kernel)
>> geneve module.
>>
>> The patch fixes it by querying the geneve device's kind when exists.
>> The out-of-tree modules uses kind string as 'ovs_geneve', while the
>> in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
>> > /etc/init.d/openvswitch-switch start
>> > creat a bridge and attach a geneve port using out-of-tree geneve
>> > /etc/init.d/openvswitch-switch restart
>>
>> Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides 
>> used interface")
>> Signed-off-by: William Tu 
>> Cc: Eric Garver 
>> Cc: Gurucharan Shetty 
>> ---
>> v1->v2:
>> Add detection of existing module, instead of unconditionally
>> remote it and create.
>> ---
>>  lib/dpif-netlink-rtnl.c | 35 +++
>>  1 file changed, 35 insertions(+)
>>
>> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
>> index 0c32e7d8ccb4..b19b862d308b 100644
>> --- a/lib/dpif-netlink-rtnl.c
>> +++ b/lib/dpif-netlink-rtnl.c
>> @@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>>
>>  error = netdev_open("ovs-system-probe", "geneve", );
>>  if (!error) {
>> +struct ofpbuf *reply;
>>  const struct netdev_tunnel_config *tnl_cfg;
>>
>>  tnl_cfg = netdev_get_tunnel_config(netdev);
>> @@ -448,6 +449,36 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>>  }
>>
>>  name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
>> +
>> +/* The geneve module exists when ovs-vswitchd crashes
>> + * and restarts, handle the case here.
>> + */
>> +error = dpif_netlink_rtnl_getlink(name, );
>> +if (!error) {
>> +
>> +struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)];
>> +struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)];
>> +const char *kind;
>> +
>> +nl_policy_parse(reply, NLMSG_HDRLEN + sizeof(struct ifinfomsg),
>> +rtlink_policy, rtlink,
>> +ARRAY_SIZE(rtlink_policy));
>> +nl_parse_nested(rtlink[IFLA_LINKINFO], linkinfo_policy,
>> +linkinfo, ARRAY_SIZE(linkinfo_policy));
>
> Should check the return code of these two.
>
>> +kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]);
>> +
>> +if (!strcmp(kind, "ovs_geneve")) {
>> +out_of_tree = true;
>> +goto exit;
>> +} else if (!strcmp(kind, "geneve")) {
>> +out_of_tree = false;
>> +goto exit;
>> +} else {
>> +VLOG_ABORT("Geneve tunnel device %s with kind %s"
>> +   " not supported", name, kind);
>> +}
>
> Need to free reply somewhere, ofpbuf_delete(reply)
>
>> +}
>> +
>>  error = dpif_netlink_rtnl_create(tnl_cfg, name, 
>> OVS_VPORT_TYPE_GENEVE,
>>   "ovs_geneve",
>>   (NLM_F_REQUEST | NLM_F_ACK
>> @@ -458,6 +489,10 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>>  }
>>  out_of_tree = true;
>>  }
>> +}
>> +
>> +exit:
>> +if (!error) {
>>  netdev_close(netdev);
>>  }
>
> This is not right. netdev_open() may succeed, but
> dpif_netlink_rtnl_create() can fail. Which means netdev will not be
> freed here.

Hi Eric,

Thanks for the feedback. I've sent v3 patch.

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


[ovs-dev] [PATCH 7/8] nlmon: added netns support.

2017-11-02 Thread Flavio Leitner
Signed-off-by: Flavio Leitner 
---
 utilities/nlmon.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/utilities/nlmon.c b/utilities/nlmon.c
index 08a117b58..609b152f9 100644
--- a/utilities/nlmon.c
+++ b/utilities/nlmon.c
@@ -41,6 +41,7 @@ main(int argc OVS_UNUSED, char *argv[])
 {
 uint64_t buf_stub[4096 / 64];
 struct nl_sock *sock;
+struct netns ns;
 struct ofpbuf buf;
 int error;
 
@@ -57,9 +58,10 @@ main(int argc OVS_UNUSED, char *argv[])
 ovs_fatal(error, "could not join RTNLGRP_LINK multicast group");
 }
 
+nl_sock_listen_all_nsid(sock, true);
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
 for (;;) {
-error = nl_sock_recv(sock, , NULL, false);
+error = nl_sock_recv(sock, , , false);
 if (error == EAGAIN) {
 /* Nothing to do. */
 } else if (error == ENOBUFS) {
@@ -123,6 +125,11 @@ main(int argc OVS_UNUSED, char *argv[])
 }
 }
 printf("\n");
+if (netns_is_remote()) {
+printf("\tnetns id: %d\n", ns.id);
+} else {
+printf("\tnetns id: local\n");
+}
 if (attrs[IFLA_MASTER]) {
 uint32_t idx = nl_attr_get_u32(attrs[IFLA_MASTER]);
 char ifname[IFNAMSIZ];
-- 
2.13.6

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


[ovs-dev] [PATCH 8/8] netdev-linux: fail ops not supporting remote netns.

2017-11-02 Thread Flavio Leitner
When the netdev is in another namespace and the operation doesn't
support network namespaces, return the correct error.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 134 +++--
 1 file changed, 120 insertions(+), 14 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index b40b7b920..1d948c956 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1341,6 +1341,11 @@ netdev_linux_send(struct netdev *netdev_, int qid 
OVS_UNUSED,
 int sock = 0;
 
 if (!is_tap_netdev(netdev_)) {
+if (netdev_linux_netns_is_remote(netdev_linux_cast(netdev_))) {
+error = EOPNOTSUPP;
+goto free_batch;
+}
+
 sock = af_packet_sock();
 if (sock < 0) {
 error = -sock;
@@ -1400,6 +1405,10 @@ netdev_linux_set_etheraddr(struct netdev *netdev_, const 
struct eth_addr mac)
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
 
 if (netdev->cache_valid & VALID_ETHERADDR) {
 error = netdev->ether_addr_error;
@@ -1513,6 +1522,11 @@ netdev_linux_set_mtu(struct netdev *netdev_, int mtu)
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 if (netdev->cache_valid & VALID_MTU) {
 error = netdev->netdev_mtu_error;
 if (error || netdev->mtu == mtu) {
@@ -1542,9 +1556,14 @@ netdev_linux_get_ifindex(const struct netdev *netdev_)
 int ifindex, error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
 error = get_ifindex(netdev_, );
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error ? -error : ifindex;
 }
 
@@ -2085,6 +2104,11 @@ netdev_linux_get_features(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 netdev_linux_read_features(netdev);
 if (!netdev->get_features_error) {
 *current = netdev->current;
@@ -2093,8 +2117,9 @@ netdev_linux_get_features(const struct netdev *netdev_,
 *peer = 0;  /* XXX */
 }
 error = netdev->get_features_error;
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2110,6 +2135,12 @@ netdev_linux_set_advertisements(struct netdev *netdev_,
 ovs_mutex_lock(>mutex);
 
 COVERAGE_INC(netdev_get_ethtool);
+
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 memset(, 0, sizeof ecmd);
 error = netdev_linux_do_ethtool(netdev_get_name(netdev_), ,
 ETHTOOL_GSET, "ETHTOOL_GSET");
@@ -2187,6 +2218,11 @@ netdev_linux_set_policing(struct netdev *netdev_,
: kbits_burst);   /* Stick with user-specified value. */
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto out;
+}
+
 if (netdev->cache_valid & VALID_POLICING) {
 error = netdev->netdev_policing_error;
 if (error || (netdev->kbits_rate == kbits_rate &&
@@ -2323,6 +2359,11 @@ netdev_linux_get_qos(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (!error) {
 *typep = netdev->tc->ops->ovs_name;
@@ -2330,8 +2371,9 @@ netdev_linux_get_qos(const struct netdev *netdev_,
  ? netdev->tc->ops->qdisc_get(netdev_, details)
  : 0);
 }
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2353,6 +2395,11 @@ netdev_linux_set_qos(struct netdev *netdev_,
 }
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (error) {
 goto exit;
@@ -2386,6 +2433,11 @@ netdev_linux_get_queue(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (!error) {
 struct tc_queue *queue = tc_find_queue(netdev_, queue_id);
@@ -2393,8 +2445,9 @@ netdev_linux_get_queue(const struct netdev *netdev_,
 ? netdev->tc->ops->class_get(netdev_, queue, details)
 : ENOENT);
 }
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2406,6 +2459,11 @@ netdev_linux_set_queue(struct netdev *netdev_,
 

[ovs-dev] [PATCH 6/8] netlink linux: enable listening to all nsids

2017-11-02 Thread Flavio Leitner
Internal ports may be moved to another network namespace
and when that happens, the vswitch stops receiving netlink
notifications.

This patch enables the vswitch to listen to all network
namespaces that have a nsid assigned into the network
namespace where the socket has been opened.

It requires kernel 4.2 or newer.

Signed-off-by: Flavio Leitner 
---
 lib/daemon-unix.c|  3 ++-
 lib/daemon.man   |  6 +++---
 lib/daemon.xml   |  8 
 lib/netdev-linux.c   |  1 +
 lib/netlink-protocol.h   |  6 ++
 lib/netlink-socket.c | 27 +++
 lib/netlink-socket.h |  2 ++
 tests/ofproto-macros.at  |  1 +
 tests/ovn-controller-vtep.at |  1 +
 9 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c
index 967a28432..be6d29cbe 100644
--- a/lib/daemon-unix.c
+++ b/lib/daemon-unix.c
@@ -818,7 +818,8 @@ daemon_become_new_user_linux(bool access_datapath 
OVS_UNUSED)
 
 if (access_datapath && !ret) {
 ret = capng_update(CAPNG_ADD, cap_sets, CAP_NET_ADMIN)
-  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_RAW);
+  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_RAW)
+  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_BROADCAST);
 }
 } else {
 ret = -1;
diff --git a/lib/daemon.man b/lib/daemon.man
index 820a09903..68c0a312d 100644
--- a/lib/daemon.man
+++ b/lib/daemon.man
@@ -76,9 +76,9 @@ started by the root user accepts this argument.
 .IP
 On Linux, daemons will be granted CAP_IPC_LOCK and CAP_NET_BIND_SERVICES
 before dropping root privileges. Daemons that interact with a datapath,
-such as \fBovs\-vswitchd\fR, will be granted two additional capabilities, 
namely
-CAP_NET_ADMIN and CAP_NET_RAW. The capability change will apply even if
-new user is "root".
+such as \fBovs\-vswitchd\fR, will be granted three additional capabilities,
+namely CAP_NET_ADMIN, CAP_NET_BROADCAST and CAP_NET_RAW.  The capability
+change will apply even if the new user is root.
 .IP
 On Windows, this option is not currently supported. For security reasons,
 specifying this option will cause the daemon process not to start.
diff --git a/lib/daemon.xml b/lib/daemon.xml
index 5cb447c49..1b5e8acae 100644
--- a/lib/daemon.xml
+++ b/lib/daemon.xml
@@ -107,10 +107,10 @@
   On Linux, daemons will be granted CAP_IPC_LOCK and
   CAP_NET_BIND_SERVICES before dropping root privileges.
   Daemons that interact with a datapath, such as
-  ovs-vswitchd, will be granted two additional
-  capabilities, namely CAP_NET_ADMIN and
-  CAP_NET_RAW.  The capability change will apply even
-  if the new user is root.
+  ovs-vswitchd, will be granted three additional
+  capabilities, namely CAP_NET_ADMIN,
+  CAP_NET_BROADCAST and CAP_NET_RAW.  The
+  capability change will apply even if the new user is root.
 
 
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 0250b0987..b40b7b920 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -653,6 +653,7 @@ netdev_linux_notify_sock(void)
 }
 }
 }
+nl_sock_listen_all_nsid(sock, true);
 ovsthread_once_done();
 }
 
diff --git a/lib/netlink-protocol.h b/lib/netlink-protocol.h
index a7b9a65fa..c0617dfad 100644
--- a/lib/netlink-protocol.h
+++ b/lib/netlink-protocol.h
@@ -158,6 +158,12 @@ enum {
 #define NETLINK_DROP_MEMBERSHIP 2
 #endif
 
+/* This was introduced in v4.2.  (We want our programs to support the newer
+ * kernel features even if compiled with older headers.) */
+#ifndef NETLINK_LISTEN_ALL_NSID
+#define NETLINK_LISTEN_ALL_NSID 8
+#endif
+
 /* These were introduced all together in 2.6.23.  (We want our programs to
  * support the newer kernel features even if compiled with older headers.) */
 #ifndef CTRL_ATTR_MCAST_GRP_MAX
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 08eb0c8ee..7c037ca57 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -441,6 +441,33 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int 
multicast_group)
 return 0;
 }
 
+/* When 'enable' is true, it tries to enable 'sock' to receive netlink
+ * notifications form all network namespaces that have an nsid assigned
+ * into the network namespace where the socket has been opened. The
+ * running kernel needs to provide support for that. When 'enable' is
+ * false, it will receive netlink notifications only from the network
+ * namespace where the socket has been opened.
+ *
+ * Returns 0 if successful, otherwise a positive errno.  */
+int
+nl_sock_listen_all_nsid(struct nl_sock *sock, bool enable)
+{
+int error;
+int val = enable ? 1 : 0;
+
+#ifndef _WIN32
+if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, ,
+   sizeof val) < 0) {
+error = errno;
+VLOG_INFO("netlink: could not 

[ovs-dev] [PATCH 5/8] netdev-linux: use netlink to update netdev.

2017-11-02 Thread Flavio Leitner
The ioctl interface doesn't support network namespaces, so
try updating the netdev using netlink message instead.

To provide backwards compatibility, fall back to the previous
method if netlink isn't supported or fails.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 107 +++--
 1 file changed, 104 insertions(+), 3 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 7f9387c0e..0250b0987 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -86,6 +86,9 @@ COVERAGE_DEFINE(netdev_get_ethtool);
 COVERAGE_DEFINE(netdev_set_ethtool);
 
 
+#ifndef IFLA_IF_NETNSID
+#define IFLA_IF_NETNSID 0x45
+#endif
 /* These were introduced in Linux 2.6.14, so they might be missing if we have
  * old headers. */
 #ifndef ADVERTISED_Pause
@@ -615,6 +618,7 @@ netdev_linux_netns_is_eq(struct netdev_linux *netdev, 
struct netns *ns)
 return netns_eq(>netns, ns);
 }
 
+static int netdev_linux_update_via_netlink(struct netdev_linux *);
 static void netdev_linux_update(struct netdev_linux *netdev, struct netns *,
 const struct rtnetlink_change *)
 OVS_REQUIRES(netdev->mutex);
@@ -1435,6 +1439,11 @@ netdev_linux_get_etheraddr(const struct netdev *netdev_, 
struct eth_addr *mac)
 
 ovs_mutex_lock(>mutex);
 if (!(netdev->cache_valid & VALID_ETHERADDR)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_ETHERADDR)) {
+/* Fall back to ioctl if netlink fails */
 netdev->ether_addr_error = get_etheraddr(netdev_get_name(netdev_),
  >etheraddr);
 netdev->cache_valid |= VALID_ETHERADDR;
@@ -1455,6 +1464,11 @@ netdev_linux_get_mtu__(struct netdev_linux *netdev, int 
*mtup)
 int error;
 
 if (!(netdev->cache_valid & VALID_MTU)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_MTU)) {
+/* Fall back to ioctl if netlink fails */
 struct ifreq ifr;
 
 netdev->netdev_mtu_error = af_inet_ifreq_ioctl(
@@ -2867,12 +2881,21 @@ netdev_linux_update_flags(struct netdev *netdev_, enum 
netdev_flags off,
   enum netdev_flags on, enum netdev_flags *old_flagsp)
 {
 struct netdev_linux *netdev = netdev_linux_cast(netdev_);
-int error;
+int error = 0;
 
 ovs_mutex_lock(>mutex);
-error = update_flags(netdev, off, on, old_flagsp);
+if (on || off) {
+/* Changing flags over netlink isn't support yet. */
+error = update_flags(netdev, off, on, old_flagsp);
+} else {
+/* Try reading flags over netlink, or fall back to ioctl. */
+if (!netdev_linux_update_via_netlink(netdev)) {
+*old_flagsp = iff_to_nd_flags(netdev->ifi_flags);
+} else {
+error = update_flags(netdev, off, on, old_flagsp);
+}
+}
 ovs_mutex_unlock(>mutex);
-
 return error;
 }
 
@@ -5515,6 +5538,11 @@ get_ifindex(const struct netdev *netdev_, int *ifindexp)
 struct netdev_linux *netdev = netdev_linux_cast(netdev_);
 
 if (!(netdev->cache_valid & VALID_IFINDEX)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_IFINDEX)) {
+/* Fall back to ioctl if netlink fails */
 int ifindex = linux_get_ifindex(netdev_get_name(netdev_));
 
 if (ifindex < 0) {
@@ -5532,6 +5560,79 @@ get_ifindex(const struct netdev *netdev_, int *ifindexp)
 }
 
 static int
+netdev_linux_update_via_netlink(struct netdev_linux *netdev)
+{
+struct ofpbuf request;
+struct ofpbuf *reply;
+struct rtnetlink_change chg;
+struct rtnetlink_change *change = 
+int error;
+
+ofpbuf_init(, 0);
+nl_msg_put_nlmsghdr(,
+sizeof(struct ifinfomsg) + NL_ATTR_SIZE(IFNAMSIZ),
+RTM_GETLINK, NLM_F_REQUEST);
+ofpbuf_put_zeros(, sizeof(struct ifinfomsg));
+
+/* The correct identifiers for a Linux device are netnsid and ifindex,
+ * but ifindex changes as the port is moved to another network namespace
+ * and the interface name statically stored in ovsdb. */
+nl_msg_put_string(, IFLA_IFNAME, netdev_get_name(>up));
+if (netdev_linux_netns_is_remote(netdev)) {
+nl_msg_push_u32(, IFLA_IF_NETNSID, netdev->netns.id);
+}
+error = nl_transact(NETLINK_ROUTE, , );
+ofpbuf_uninit();
+if (error) {
+ofpbuf_delete(reply);
+return error;
+}
+
+if (rtnetlink_parse(reply, change)
+&& change->nlmsg_type == RTM_NEWLINK) {
+bool changed = false;
+error = 0;
+
+/* Update netdev from rtnl msg and increment its seq if needed. */
+if ((change->ifi_flags ^ netdev->ifi_flags) & IFF_RUNNING) {
+netdev->carrier_resets++;
+changed = true;
+}
+if (change->ifi_flags != netdev->ifi_flags) {
+

[ovs-dev] [PATCH 4/8] netdev: update device info only if netns matches.

2017-11-02 Thread Flavio Leitner
A network device in another network namespace could have the
same name, so once the socket starts listening to other network
namespaces, it is necessary to confirm the netns id.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 50 +++---
 1 file changed, 43 insertions(+), 7 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 8ddaa8b39..7f9387c0e 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -573,7 +573,7 @@ netdev_rxq_linux_cast(const struct netdev_rxq *rx)
 }
 
 static int
-netdev_linux_netns_update(struct netdev_linux *netdev)
+netdev_linux_netns_update__(struct netdev_linux *netdev)
 {
 struct netns *dev_netns = >netns;
 struct dpif_netlink_vport reply;
@@ -591,7 +591,31 @@ netdev_linux_netns_update(struct netdev_linux *netdev)
 return 0;
 }
 
-static void netdev_linux_update(struct netdev_linux *netdev,
+static int
+netdev_linux_netns_update(struct netdev_linux *netdev)
+{
+if (netns_is_invalid(>netns)) {
+return netdev_linux_netns_update__(netdev);
+}
+
+return 0;
+}
+
+static bool
+netdev_linux_netns_is_remote(struct netdev_linux *netdev)
+{
+netdev_linux_netns_update(netdev);
+return netns_is_remote(>netns);
+}
+
+static bool
+netdev_linux_netns_is_eq(struct netdev_linux *netdev, struct netns *ns)
+{
+netdev_linux_netns_update(netdev);
+return netns_eq(>netns, ns);
+}
+
+static void netdev_linux_update(struct netdev_linux *netdev, struct netns *,
 const struct rtnetlink_change *)
 OVS_REQUIRES(netdev->mutex);
 static void netdev_linux_changed(struct netdev_linux *netdev,
@@ -655,10 +679,11 @@ netdev_linux_run(const struct netdev_class *netdev_class 
OVS_UNUSED)
 do {
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
 uint64_t buf_stub[4096 / 8];
+struct netns ns;
 struct ofpbuf buf;
 
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
-error = nl_sock_recv(sock, , NULL, false);
+error = nl_sock_recv(sock, , , false);
 if (!error) {
 struct rtnetlink_change change;
 
@@ -677,7 +702,7 @@ netdev_linux_run(const struct netdev_class *netdev_class 
OVS_UNUSED)
 struct netdev_linux *netdev = netdev_linux_cast(netdev_);
 
 ovs_mutex_lock(>mutex);
-netdev_linux_update(netdev, );
+netdev_linux_update(netdev, , );
 ovs_mutex_unlock(>mutex);
 }
 netdev_close(netdev_);
@@ -744,11 +769,11 @@ netdev_linux_changed(struct netdev_linux *dev,
 }
 
 static void
-netdev_linux_update(struct netdev_linux *dev,
-const struct rtnetlink_change *change)
+netdev_linux_update__(struct netdev_linux *dev,
+  const struct rtnetlink_change *change)
 OVS_REQUIRES(dev->mutex)
 {
-if (rtnetlink_type_is_rtnlgrp_link(change->nlmsg_type)){
+if (rtnetlink_type_is_rtnlgrp_link(change->nlmsg_type)) {
 if (change->nlmsg_type == RTM_NEWLINK) {
 /* Keep drv-info, and ip addresses. */
 netdev_linux_changed(dev, change->ifi_flags,
@@ -772,6 +797,7 @@ netdev_linux_update(struct netdev_linux *dev,
 dev->get_ifindex_error = 0;
 } else {
 netdev_linux_changed(dev, change->ifi_flags, 0);
+netns_set_invalid(>netns);
 }
 } else if (rtnetlink_type_is_rtnlgrp_addr(change->nlmsg_type)) {
 /* Invalidates in4, in6. */
@@ -781,6 +807,16 @@ netdev_linux_update(struct netdev_linux *dev,
 }
 }
 
+static void
+netdev_linux_update(struct netdev_linux *dev, struct netns *ns,
+const struct rtnetlink_change *change)
+OVS_REQUIRES(dev->mutex)
+{
+if (netdev_linux_netns_is_eq(dev, ns)) {
+netdev_linux_update__(dev, change);
+}
+}
+
 static struct netdev *
 netdev_linux_alloc(void)
 {
-- 
2.13.6

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


[ovs-dev] [PATCH 3/8] vport: retrieve the netnsid if available.

2017-11-02 Thread Flavio Leitner
Recent kernels provide the network namespace ID of a port,
so use that to discover where the port currently is.

Signed-off-by: Flavio Leitner 
---
 datapath/linux/compat/include/linux/openvswitch.h |  2 ++
 lib/dpif-netlink.c|  6 ++
 lib/dpif-netlink.h|  2 ++
 lib/netdev-linux.c| 20 
 4 files changed, 30 insertions(+)

diff --git a/datapath/linux/compat/include/linux/openvswitch.h 
b/datapath/linux/compat/include/linux/openvswitch.h
index bc6c94b8d..d2712d05f 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -283,6 +283,8 @@ enum ovs_vport_attr {
/* receiving upcalls */
OVS_VPORT_ATTR_STATS,   /* struct ovs_vport_stats */
OVS_VPORT_ATTR_PAD,
+   OVS_VPORT_ATTR_IFINDEX,
+   OVS_VPORT_ATTR_NETNSID,
__OVS_VPORT_ATTR_MAX
 };
 
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 563eb5638..81c4631f0 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -3065,6 +3065,7 @@ dpif_netlink_vport_from_ofpbuf(struct dpif_netlink_vport 
*vport,
 [OVS_VPORT_ATTR_STATS] = { NL_POLICY_FOR(struct ovs_vport_stats),
.optional = true },
 [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true },
+[OVS_VPORT_ATTR_NETNSID] = { .type = NL_A_U32, .optional = true },
 };
 
 dpif_netlink_vport_init(vport);
@@ -3100,6 +3101,11 @@ dpif_netlink_vport_from_ofpbuf(struct dpif_netlink_vport 
*vport,
 vport->options = nl_attr_get(a[OVS_VPORT_ATTR_OPTIONS]);
 vport->options_len = nl_attr_get_size(a[OVS_VPORT_ATTR_OPTIONS]);
 }
+if (a[OVS_VPORT_ATTR_NETNSID]) {
+netns_set_id(>netns, 
nl_attr_get_u32(a[OVS_VPORT_ATTR_NETNSID]));
+} else {
+netns_set_local(>netns);
+}
 return 0;
 }
 
diff --git a/lib/dpif-netlink.h b/lib/dpif-netlink.h
index 568b81441..680a74c2f 100644
--- a/lib/dpif-netlink.h
+++ b/lib/dpif-netlink.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include "odp-netlink.h"
+#include "netns.h"
 
 #include "flow.h"
 
@@ -32,6 +33,7 @@ struct dpif_netlink_vport {
 
 /* ovs_vport header. */
 int dp_ifindex;
+struct netns netns;
 odp_port_t port_no;/* ODPP_NONE if unknown. */
 enum ovs_vport_type type;
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 3c80690f4..8ddaa8b39 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -476,6 +476,7 @@ struct netdev_linux {
 long long int miimon_interval;  /* Miimon Poll rate. Disabled if <= 0. */
 struct timer miimon_timer;
 
+struct netns netns; /* network namespace. */
 /* The following are figured out "on demand" only.  They are only valid
  * when the corresponding VALID_* bit in 'cache_valid' is set. */
 int ifindex;
@@ -571,6 +572,25 @@ netdev_rxq_linux_cast(const struct netdev_rxq *rx)
 return CONTAINER_OF(rx, struct netdev_rxq_linux, up);
 }
 
+static int
+netdev_linux_netns_update(struct netdev_linux *netdev)
+{
+struct netns *dev_netns = >netns;
+struct dpif_netlink_vport reply;
+struct ofpbuf *buf;
+int error;
+
+error = dpif_netlink_vport_get(netdev_get_name(>up), , );
+if (error) {
+netns_set_invalid(dev_netns);
+return error;
+}
+
+netns_copy(dev_netns, );
+ofpbuf_delete(buf);
+return 0;
+}
+
 static void netdev_linux_update(struct netdev_linux *netdev,
 const struct rtnetlink_change *)
 OVS_REQUIRES(netdev->mutex);
-- 
2.13.6

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


[ovs-dev] [PATCH 2/8] netdev-linux: initialize netns as invalid.

2017-11-02 Thread Flavio Leitner
A port might be already in another netns, so initialize it
as invalid to force a state update.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 0d03ca876..3c80690f4 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -788,6 +788,10 @@ netdev_linux_common_construct(struct netdev *netdev_)
 return EINVAL;
 }
 
+/* The device could be in the same network namespace or in another one.
+ * Initialize as invalid to force a state update. */
+netns_set_invalid(>netns);
+
 ovs_mutex_init(>mutex);
 return 0;
 }
-- 
2.13.6

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


[ovs-dev] [PATCH 1/8] netlink: provide network namespace id from a msg.

2017-11-02 Thread Flavio Leitner
The netlink notification's ancillary data contains the network
namespace id (netnsid) needed to identify the device correctly.
(ifindex and netnsid).

Signed-off-by: Flavio Leitner 
---
 configure.ac   |   3 +-
 lib/automake.mk|   1 +
 lib/dpif-netlink.c |   6 +--
 lib/netdev-linux.c |   2 +-
 lib/netlink-notifier.c |   2 +-
 lib/netlink-socket.c   |  37 ---
 lib/netlink-socket.h   |   4 +-
 lib/netns.h| 119 +
 utilities/nlmon.c  |   2 +-
 9 files changed, 162 insertions(+), 14 deletions(-)
 create mode 100644 lib/netns.h

diff --git a/configure.ac b/configure.ac
index 27425991a..522704f9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,7 +113,8 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], [], 
[],
   [[#include 
 #include ]])
 AC_CHECK_FUNCS([mlockall strnlen getloadavg statvfs getmntent_r sendmmsg])
-AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h 
stdatomic.h])
+AC_CHECK_HEADERS([mntent.h sys/statvfs.h linux/types.h linux/if_ether.h ])
+AC_CHECK_HEADERS([linux/net_namespace.h stdatomic.h])
 AC_CHECK_HEADERS([net/if_mib.h], [], [], [[#include 
 #include ]])
 
diff --git a/lib/automake.mk b/lib/automake.mk
index ca1cf5dd2..e354cd96f 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -140,6 +140,7 @@ lib_libopenvswitch_la_SOURCES = \
lib/netflow.h \
lib/netlink.c \
lib/netlink.h \
+   lib/netns.h \
lib/nx-match.c \
lib/nx-match.h \
lib/object-collection.c \
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index 29001fbe4..563eb5638 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -1287,7 +1287,7 @@ dpif_netlink_port_poll(const struct dpif *dpif_, char 
**devnamep)
 int error;
 
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
-error = nl_sock_recv(dpif->port_notifier, , false);
+error = nl_sock_recv(dpif->port_notifier, , NULL, false);
 if (!error) {
 struct dpif_netlink_vport vport;
 
@@ -2621,7 +2621,7 @@ dpif_netlink_recv_windows(struct dpif_netlink *dpif, 
uint32_t handler_id,
 return EAGAIN;
 }
 
-error = nl_sock_recv(sock_pool[i].nl_sock, buf, false);
+error = nl_sock_recv(sock_pool[i].nl_sock, buf, NULL, false);
 if (error == ENOBUFS) {
 /* ENOBUFS typically means that we've received so many
  * packets that the buffer overflowed.  Try again
@@ -2696,7 +2696,7 @@ dpif_netlink_recv__(struct dpif_netlink *dpif, uint32_t 
handler_id,
 return EAGAIN;
 }
 
-error = nl_sock_recv(ch->sock, buf, false);
+error = nl_sock_recv(ch->sock, buf, NULL, false);
 if (error == ENOBUFS) {
 /* ENOBUFS typically means that we've received so many
  * packets that the buffer overflowed.  Try again
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 2ff3e2bcc..0d03ca876 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -638,7 +638,7 @@ netdev_linux_run(const struct netdev_class *netdev_class 
OVS_UNUSED)
 struct ofpbuf buf;
 
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
-error = nl_sock_recv(sock, , false);
+error = nl_sock_recv(sock, , NULL, false);
 if (!error) {
 struct rtnetlink_change change;
 
diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index 3acded418..d33904658 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -187,7 +187,7 @@ nln_run(struct nln *nln)
 int error;
 
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
-error = nl_sock_recv(nln->notify_sock, , false);
+error = nl_sock_recv(nln->notify_sock, , NULL, false);
 if (!error) {
 int group = nln->parse(, nln->change);
 
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index ccfd55e92..08eb0c8ee 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -607,7 +608,8 @@ nl_sock_send_seq(struct nl_sock *sock, const struct ofpbuf 
*msg,
 }
 
 static int
-nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, bool wait)
+nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, struct netns *ns,
+   bool wait)
 {
 /* We can't accurately predict the size of the data to be received.  The
  * caller is supposed to have allocated enough space in 'buf' to handle the
@@ -618,6 +620,8 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, 
bool wait)
 uint8_t tail[65536];
 struct iovec iov[2];
 struct msghdr msg;
+uint8_t msgctrl[64];
+struct cmsghdr *cmsg;
 ssize_t retval;
 int error;
 
@@ -632,6 +636,8 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, 
bool wait)
 memset(, 0, sizeof 

[ovs-dev] [PATCH 0/8] Add minimum network namespace support.

2017-11-02 Thread Flavio Leitner
Today Open vSwitch doesn't know about network namespaces (netns), but
users are moving internal ports to other namespaces.  Although packets
are still flowing, the daemon fails to find out basic port information,
like if it is UP or DOWN, for instance.

This patchset rely on a new kernel vport API being proposed to netdev to
find out the new network namespace ID of a bridge's port. This information
along with the port's name recorded in the database is used to match the
corresponding netlink messages.

This patchset also leverages another kernel API that allows the daemon
to listen to all netlink messages from all netns which has an ID assigned
into it.  This and the previous change allows the userspace to track ports
in other network namespaces.

If any of the APIs aren't available, it falls back to the older APIs to
not break backwards compatibility.

Flavio Leitner (8):
  netlink: provide network namespace id from a msg.
  netdev-linux: initialize netns as invalid.
  vport: retrieve the netnsid if available.
  netdev: update device info only if netns matches.
  netdev-linux: use netlink to update netdev.
  netlink linux: enable listening to all nsids
  nlmon: added netns support.
  netdev-linux: fail ops not supporting remote netns.

 configure.ac  |   3 +-
 datapath/linux/compat/include/linux/openvswitch.h |   2 +
 lib/automake.mk   |   1 +
 lib/daemon-unix.c |   3 +-
 lib/daemon.man|   6 +-
 lib/daemon.xml|   8 +-
 lib/dpif-netlink.c|  12 +-
 lib/dpif-netlink.h|   2 +
 lib/netdev-linux.c| 314 --
 lib/netlink-notifier.c|   2 +-
 lib/netlink-protocol.h|   6 +
 lib/netlink-socket.c  |  64 -
 lib/netlink-socket.h  |   6 +-
 lib/netns.h   | 119 
 tests/ofproto-macros.at   |   1 +
 tests/ovn-controller-vtep.at  |   1 +
 utilities/nlmon.c |   9 +-
 17 files changed, 515 insertions(+), 44 deletions(-)
 create mode 100644 lib/netns.h

-- 
2.13.6

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


[ovs-dev] [PATCH net-next 3/3] rtnetlink: use netnsid to query interface

2017-11-02 Thread Flavio Leitner
From: Jiri Benc 

Currently, when an application gets netnsid from the kernel (for example as
the result of RTM_GETLINK call on one end of the veth pair), it's not much
useful. There's no reliable way to get to the netns fd from the netnsid, nor
does any kernel API accept netnsid.

Extend the RTM_GETLINK call to also accept netnsid. It will operate on the
netns with the given netnsid in such case. Of course, the calling process
needs to have enough capabilities in the target name space; for now, require
CAP_NET_ADMIN. This can be relaxed in the future.

To signal to the calling process that the kernel understood the new
IFLA_IF_NETNSID attribute in the query, it will include it in the response.
This is needed to detect older kernels, as they will just ignore
IFLA_IF_NETNSID and query in the current name space.

This patch implemetns IFLA_IF_NETNSID only for get and dump. For set
operations, this can be extended later.

Signed-off-by: Jiri Benc 
---
 include/uapi/linux/if_link.h |   1 +
 net/core/rtnetlink.c | 103 +++
 2 files changed, 86 insertions(+), 18 deletions(-)

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index b037e0ab1975..ba705219df40 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -159,6 +159,7 @@ enum {
IFLA_XDP,
IFLA_EVENT,
IFLA_NEW_NETNSID,
+   IFLA_IF_NETNSID,
__IFLA_MAX
 };
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index de24d394c69e..8a8c51937edf 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -921,7 +921,8 @@ static noinline size_t if_nlmsg_size(const struct 
net_device *dev,
   + nla_total_size(4)  /* IFLA_EVENT */
   + nla_total_size(4)  /* IFLA_NEW_NETNSID */
   + nla_total_size(1); /* IFLA_PROTO_DOWN */
-
+  + nla_total_size(4)  /* IFLA_IF_NETNSID */
+  + 0;
 }
 
 static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev)
@@ -1370,13 +1371,14 @@ static noinline_for_stack int nla_put_ifalias(struct 
sk_buff *skb,
 }
 
 static int rtnl_fill_link_netnsid(struct sk_buff *skb,
- const struct net_device *dev)
+ const struct net_device *dev,
+ struct net *src_net)
 {
if (dev->rtnl_link_ops && dev->rtnl_link_ops->get_link_net) {
struct net *link_net = dev->rtnl_link_ops->get_link_net(dev);
 
if (!net_eq(dev_net(dev), link_net)) {
-   int id = peernet2id_alloc(dev_net(dev), link_net);
+   int id = peernet2id_alloc(src_net, link_net);
 
if (nla_put_s32(skb, IFLA_LINK_NETNSID, id))
return -EMSGSIZE;
@@ -1427,10 +1429,11 @@ static int rtnl_fill_link_af(struct sk_buff *skb,
return 0;
 }
 
-static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
+static int rtnl_fill_ifinfo(struct sk_buff *skb,
+   struct net_device *dev, struct net *src_net,
int type, u32 pid, u32 seq, u32 change,
unsigned int flags, u32 ext_filter_mask,
-   u32 event, int *new_nsid)
+   u32 event, int *new_nsid, int tgt_netnsid)
 {
struct ifinfomsg *ifm;
struct nlmsghdr *nlh;
@@ -1448,6 +1451,9 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct 
net_device *dev,
ifm->ifi_flags = dev_get_flags(dev);
ifm->ifi_change = change;
 
+   if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_IF_NETNSID, tgt_netnsid))
+   goto nla_put_failure;
+
if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
nla_put_u8(skb, IFLA_OPERSTATE,
@@ -1513,7 +1519,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct 
net_device *dev,
goto nla_put_failure;
}
 
-   if (rtnl_fill_link_netnsid(skb, dev))
+   if (rtnl_fill_link_netnsid(skb, dev, src_net))
goto nla_put_failure;
 
if (new_nsid &&
@@ -1571,6 +1577,7 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
[IFLA_XDP]  = { .type = NLA_NESTED },
[IFLA_EVENT]= { .type = NLA_U32 },
[IFLA_GROUP]= { .type = NLA_U32 },
+   [IFLA_IF_NETNSID]   = { .type = NLA_S32 },
 };
 
 static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
@@ -1674,9 +1681,28 @@ static bool link_dump_filtered(struct net_device *dev,
return false;
 }
 
+static struct net *get_target_net(struct sk_buff *skb, int netnsid)
+{
+   struct net *net;
+
+   net = get_net_ns_by_id(sock_net(skb->sk), netnsid);
+   if (!net)
+   return ERR_PTR(-EINVAL);
+
+   /* For 

[ovs-dev] [PATCH net-next 2/3] openvswitch: reliable interface indentification in port dumps

2017-11-02 Thread Flavio Leitner
From: Jiri Benc 

This patch allows reliable identification of netdevice interfaces connected
to openvswitch bridges. In particular, user space queries the netdev
interfaces belonging to the ports for statistics, up/down state, etc.
Datapath dump needs to provide enough information for the user space to be
able to do that.

Currently, only interface names are returned. This is not sufficient, as
openvswitch allows its ports to be in different name spaces and the
interface name is valid only in its name space. What is needed and generally
used in other netlink APIs, is the pair ifindex+netnsid.

The solution is addition of the ifindex+netnsid pair (or only ifindex if in
the same name space) to vport get/dump operation.

On request side, ideally the ifindex+netnsid pair could be used to
get/set/del the corresponding vport. This is not implemented by this patch
and can be added later if needed.

Signed-off-by: Jiri Benc 
---
 include/uapi/linux/openvswitch.h |  2 ++
 net/openvswitch/datapath.c   | 47 +---
 net/openvswitch/datapath.h   |  4 ++--
 net/openvswitch/dp_notify.c  |  4 ++--
 4 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 0cd6f8833147..c9b638c82941 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -257,6 +257,8 @@ enum ovs_vport_attr {
/* receiving upcalls */
OVS_VPORT_ATTR_STATS,   /* struct ovs_vport_stats */
OVS_VPORT_ATTR_PAD,
+   OVS_VPORT_ATTR_IFINDEX,
+   OVS_VPORT_ATTR_NETNSID,
__OVS_VPORT_ATTR_MAX
 };
 
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index c3aec6227c91..4d38ac044cee 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1848,7 +1848,8 @@ static struct genl_family dp_datapath_genl_family 
__ro_after_init = {
 
 /* Called with ovs_mutex or RCU read lock. */
 static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb,
-  u32 portid, u32 seq, u32 flags, u8 cmd)
+  struct net *net, u32 portid, u32 seq,
+  u32 flags, u8 cmd)
 {
struct ovs_header *ovs_header;
struct ovs_vport_stats vport_stats;
@@ -1864,9 +1865,17 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, 
struct sk_buff *skb,
if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) ||
nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) ||
nla_put_string(skb, OVS_VPORT_ATTR_NAME,
-  ovs_vport_name(vport)))
+  ovs_vport_name(vport)) ||
+   nla_put_u32(skb, OVS_VPORT_ATTR_IFINDEX, vport->dev->ifindex))
goto nla_put_failure;
 
+   if (!net_eq(net, dev_net(vport->dev))) {
+   int id = peernet2id_alloc(net, dev_net(vport->dev));
+
+   if (nla_put_s32(skb, OVS_VPORT_ATTR_NETNSID, id))
+   goto nla_put_failure;
+   }
+
ovs_vport_get_stats(vport, _stats);
if (nla_put_64bit(skb, OVS_VPORT_ATTR_STATS,
  sizeof(struct ovs_vport_stats), _stats,
@@ -1896,8 +1905,8 @@ static struct sk_buff *ovs_vport_cmd_alloc_info(void)
 }
 
 /* Called with ovs_mutex, only via ovs_dp_notify_wq(). */
-struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, u32 portid,
-u32 seq, u8 cmd)
+struct sk_buff *ovs_vport_cmd_build_info(struct vport *vport, struct net *net,
+u32 portid, u32 seq, u8 cmd)
 {
struct sk_buff *skb;
int retval;
@@ -1906,7 +1915,7 @@ struct sk_buff *ovs_vport_cmd_build_info(struct vport 
*vport, u32 portid,
if (!skb)
return ERR_PTR(-ENOMEM);
 
-   retval = ovs_vport_cmd_fill_info(vport, skb, portid, seq, 0, cmd);
+   retval = ovs_vport_cmd_fill_info(vport, skb, net, portid, seq, 0, cmd);
BUG_ON(retval < 0);
 
return skb;
@@ -1920,6 +1929,8 @@ static struct vport *lookup_vport(struct net *net,
struct datapath *dp;
struct vport *vport;
 
+   if (a[OVS_VPORT_ATTR_IFINDEX])
+   return ERR_PTR(-EOPNOTSUPP);
if (a[OVS_VPORT_ATTR_NAME]) {
vport = ovs_vport_locate(net, nla_data(a[OVS_VPORT_ATTR_NAME]));
if (!vport)
@@ -1944,6 +1955,7 @@ static struct vport *lookup_vport(struct net *net,
return vport;
} else
return ERR_PTR(-EINVAL);
+
 }
 
 /* Called with ovs_mutex */
@@ -1983,6 +1995,8 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct 
genl_info *info)
if (!a[OVS_VPORT_ATTR_NAME] || !a[OVS_VPORT_ATTR_TYPE] ||
!a[OVS_VPORT_ATTR_UPCALL_PID])
return -EINVAL;
+   if 

[ovs-dev] [PATCH net-next 1/3] net: export peernet2id_alloc

2017-11-02 Thread Flavio Leitner
From: Jiri Benc 

It will be used by openvswitch.

Signed-off-by: Jiri Benc 
---
 net/core/net_namespace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 6cfdc7c84c48..b797832565d3 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -234,6 +234,7 @@ int peernet2id_alloc(struct net *net, struct net *peer)
rtnl_net_notifyid(net, RTM_NEWNSID, id);
return id;
 }
+EXPORT_SYMBOL_GPL(peernet2id_alloc);
 
 /* This function returns, if assigned, the id of a peer netns. */
 int peernet2id(struct net *net, struct net *peer)
-- 
2.13.6

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


[ovs-dev] [PATCH net-next 0/3] Allow openvswitch to query ports in another netns.

2017-11-02 Thread Flavio Leitner
Today Open vSwitch users are moving internal ports to other namespaces and
although packets are flowing OK, the userspace daemon can't find out basic
information like if the port is UP or DOWN, for instance.

This patchset extends openvswitch API to retrieve the current netnsid of
a port. It will be used by the userspace daemon to find out in which netns
the port is located.

This patchset also extends the rtnetlink getlink call to accept and operate
on a given netnsid.  More details are available in each patch.

Jiri Benc (3):
  net: export peernet2id_alloc
  openvswitch: reliable interface indentification in port dumps
  rtnetlink: use netnsid to query interface

 include/uapi/linux/if_link.h |   1 +
 include/uapi/linux/openvswitch.h |   2 +
 net/core/net_namespace.c |   1 +
 net/core/rtnetlink.c | 103 ---
 net/openvswitch/datapath.c   |  47 +-
 net/openvswitch/datapath.h   |   4 +-
 net/openvswitch/dp_notify.c  |   4 +-
 7 files changed, 127 insertions(+), 35 deletions(-)

-- 
2.13.6

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


[ovs-dev] [PATCHv3] dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

2017-11-02 Thread William Tu
When using the out-of-tree (openvswitch compat) geneve module,
the first time oot tunnel probing returns true (correct).
Without unloading the geneve module, if the userspace ovs-vswitchd
restarts, because the 'geneve_sys_6081' still exists, the probing
incorrectly returns false and loads the in-tree (upstream kernel)
geneve module.

The patch fixes it by querying the geneve device's kind when exists.
The out-of-tree modules uses kind string as 'ovs_geneve', while the
in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> /etc/init.d/openvswitch-switch start
> creat a bridge and attach a geneve port using out-of-tree geneve
> /etc/init.d/openvswitch-switch restart

Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides used 
interface")
Signed-off-by: William Tu 
Cc: Eric Garver 
Cc: Gurucharan Shetty 
---
v2->v3:
Add return code checking for netlink parsing
Fix memory leak
v1->v2:
Add detection of existing module, instead of unconditionally
remote it and create.
---
 lib/dpif-netlink-rtnl.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
index 0c32e7d8ccb4..fe9c8ed7104f 100644
--- a/lib/dpif-netlink-rtnl.c
+++ b/lib/dpif-netlink-rtnl.c
@@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
 
 error = netdev_open("ovs-system-probe", "geneve", );
 if (!error) {
+struct ofpbuf *reply;
 const struct netdev_tunnel_config *tnl_cfg;
 
 tnl_cfg = netdev_get_tunnel_config(netdev);
@@ -448,6 +449,44 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
 }
 
 name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
+
+/* The geneve module exists when ovs-vswitchd crashes
+ * and restarts, handle the case here.
+ */
+error = dpif_netlink_rtnl_getlink(name, );
+if (!error) {
+
+struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)];
+struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)];
+const char *kind;
+
+if (!nl_policy_parse(reply,
+ NLMSG_HDRLEN + sizeof(struct ifinfomsg),
+ rtlink_policy, rtlink,
+ ARRAY_SIZE(rtlink_policy))
+|| !nl_parse_nested(rtlink[IFLA_LINKINFO], linkinfo_policy,
+linkinfo, ARRAY_SIZE(linkinfo_policy))) {
+VLOG_ABORT("Error fetching Geneve tunnel device %s "
+   "linkinfo", name);
+}
+
+kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]);
+
+if (!strcmp(kind, "ovs_geneve")) {
+out_of_tree = true;
+} else if (!strcmp(kind, "geneve")) {
+out_of_tree = false;
+} else {
+VLOG_ABORT("Geneve tunnel device %s with kind %s"
+   " not supported", name, kind);
+}
+
+ofpbuf_delete(reply);
+netdev_close(netdev);
+
+return out_of_tree;
+}
+
 error = dpif_netlink_rtnl_create(tnl_cfg, name, OVS_VPORT_TYPE_GENEVE,
  "ovs_geneve",
  (NLM_F_REQUEST | NLM_F_ACK
-- 
2.7.4

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


[ovs-dev] [PATCH] netdev-dummy: Remove wrong netdev_close

2017-11-02 Thread Yifeng Sun
netdev_dummy_ip6addr() calls netdev_close() twice though it increases netdev's 
reference only once from netdev_from_name(). As a result, Valgrind test 788 
(tunnel_push_pop - action) reports the error below:
==20465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 Invalid read of size 8
at 0x493FE0: netdev_get_name (netdev.c:911)
by 0x5125D3: tnl_port_map_delete_ipdev (tnl-ports.c:470)
by 0x4E551C: __rt_entry_delete (ovs-router.c:252)
by 0x4E64AA: ovs_router_flush (ovs-router.c:478)
by 0x475CA8: call_hooks.part.2 (fatal-signal.c:254)
by 0x5E53FF7: __run_exit_handlers (exit.c:82)
by 0x5E54044: exit (exit.c:104)
by 0x5E3A836: (below main) (libc-start.c:325)
  Address 0x65ea680 is 0 bytes inside a block of size 640 free'd
at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x492BA2: netdev_unref (netdev.c:572)
by 0x41646E: ofport_destroy__ (ofproto.c:2516)
by 0x41FD58: ofproto_destroy (ofproto.c:1645)
by 0x40B96B: bridge_destroy (bridge.c:3273)
by 0x410238: bridge_exit (bridge.c:506)
by 0x40700E: main (ovs-vswitchd.c:135)
  Block was alloc'd at
at 0x4C2FB55: calloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x516A82: xcalloc (util.c:103)
by 0x48D74D: netdev_dummy_alloc (netdev-dummy.c:661)
by 0x4931D1: netdev_open.part.12 (netdev.c:406)
by 0x40A985: iface_do_create (bridge.c:1784)
by 0x40A985: iface_create (bridge.c:1837)
by 0x40A985: bridge_add_ports__ (bridge.c:931)
by 0x40C7EA: bridge_add_ports (bridge.c:947)
by 0x40C7EA: bridge_reconfigure (bridge.c:663)
by 0x410485: bridge_run (bridge.c:2998)
by 0x406F64: main (ovs-vswitchd.c:119)

Signed-off-by: Yifeng Sun 
---
 lib/netdev-dummy.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index f731af1dfd0e..4d85f6fcdb1c 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -1764,7 +1764,6 @@ netdev_dummy_ip6addr(struct unixctl_conn *conn, int argc 
OVS_UNUSED,
 unixctl_command_reply_error(conn, error);
 free(error);
 }
-netdev_close(netdev);
 } else {
 unixctl_command_reply_error(conn, "Unknown Dummy Interface");
 }
-- 
2.7.4

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


Re: [ovs-dev] [PATCH] netdev-linux: Fix wrong ceil rate when max-rate less than 8bit.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 11:07:02AM +0800, fukaige wrote:
> From: Kaige Fu 
> 
> When max-rate is less than 8bit, the hc->max_rate will be set
> as htb->max_rate mistakenly instead of mtu of netdev.
> 
> Fixes: 13c1637 ("smap: New function smap_get_ullong().")
> 
> Signed-off-by: Kaige Fu 

Thanks, I applied this to master and backported as far as 2.6.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH, RFC] tests: Add a default timeout for control utilities

2017-11-02 Thread Ben Pfaff
On Wed, Nov 01, 2017 at 09:53:48PM +, Alin Serdean wrote:
> > -Original Message-
> > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> > boun...@openvswitch.org] On Behalf Of Ben Pfaff
> > Sent: Wednesday, November 1, 2017 12:32 AM
> > To: Alin Gabriel Serdean 
> > Cc: d...@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH, RFC] tests: Add a default timeout for control
> > utilities
> > 
> > On Sat, Sep 02, 2017 at 08:52:38AM -0700, Ben Pfaff wrote:
> > > On Mon, Aug 28, 2017 at 08:14:59PM +0300, Alin Gabriel Serdean wrote:
> > > > Let's suppose that ovsdb-server is running properly, but
> > > > ovs-vswitchd is not responsive/crashed. We try to add a port via
> > > > ovs-vsctl and it will hang.
> > > > This patch aims at that scenario and tries to make life easier when
> > > > debugging hanging tests.
> > > >
> > > > Some shells do not allow dashes in function names (default
> > > > behavior), we shall try to define an alias to overcome dashes if the 
> > > > shell
> > allows it.
> > > >
> > > > Signed-off-by: Alin Gabriel Serdean 
> > > > Suggested-by: Ben Pfaff 
> > >
> > > Acked-by: Ben Pfaff 
> > 
> > I expected that you'd apply this, but, anyway, I've done it just now.
> [Alin Serdean] Thanks Ben! I was convinced I applied this patch before I went 
> on vacation but apparently, I didn't. Sorry!

No problem, I hope you enjoyed your vacation.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] packets: Fix C++ compilation issues when include packets.h

2017-11-02 Thread Ben Pfaff
On Wed, Nov 01, 2017 at 02:40:27PM -0700, Yi-Hung Wei wrote:
> This patch fixes three C++ compilation errors when it includes
> "lib/packets.h".
> 
> 1) Fix in "include/openvswitch/util.h" is to avoid duplicated
> named_member__ in struct pkt_metadata.
> 
> 2) Fix in "lib/packets.h" is because designated initializers are not
> implemented in GNU C++ [1].
> 
> 3) Fix in "lib/util.h" is because __builtin_types_compatible_p and
> __builtin_choose_expr are only supported in GCC. I use one solution
> for C++ that is type-safe and works at compile time from [2].
> 
> [1]: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
> [2]: https://goo.gl/xNe48A
> 
> Signed-off-by: Yi-Hung Wei 

Thanks!  I applied this to master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] ofproto/trace: Fix memory leak in oftrace_push_ct_state()

2017-11-02 Thread Ben Pfaff
On Wed, Nov 01, 2017 at 04:59:52PM -0700, Yi-Hung Wei wrote:
> Free the allocated memory in the pop function.
> 
> Fixes: 0f2f05bbcf743 ("ofproto/trace: Add --ct-next option to ofproto/trace")
> Signed-off-by: Yi-Hung Wei 

Thank you for the fix!  I applied this to master and branch-2.8.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-northd.8: Fix wrong description

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 10:46:58AM +0800, wei wrote:
> ---
>  ovn/northd/ovn-northd.8.xml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
> index e9799e18a..37284301b 100644
> --- a/ovn/northd/ovn-northd.8.xml
> +++ b/ovn/northd/ovn-northd.8.xml
> @@ -1422,7 +1422,7 @@ icmp4 {
>B, a priority-100 flow matches ip 
>ip4.dst == B  inport == GW,
>where GW is the logical router gateway port, with an
> -  action ct_snat; next;.
> +  action ct_snat;.
>  
>  
>  

Thanks for the patch!

Can you provide a Signed-off-by?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 11:41:17PM +0530, Numan Siddique wrote:
> On Thu, Nov 2, 2017 at 11:15 PM, Ben Pfaff  wrote:
> 
> > On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> > > From: Numan Siddique 
> > >
> > > Presently if the user wants to start OVN db servers as separate
> > containers, 'ovn-ctl'
> > > script is not useful as '--detach' option is passed when ovsdb-servers
> > are started.
> > > If the container command is 'ovn-ctl start_nb_ovsdb', the  container
> > exits as soon as
> > > ovn-ctl exits.
> > >
> > > This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach'
> > and
> > > '--db-sb-detach' which can take 'yes/no'. This will be really useful for
> > the above
> > > mentioned requirement. The user can start NB ovsdb-server with the
> > command
> > > 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> > >
> > > Without this option, the user may have to first generate the db by
> > running 'ovsdb-tool'
> > > and then start the container with the command 'ovsdb-server ovnnb_db.db
> > ' and this
> > > is very inconvenient. This option will be useful only if the OVN db
> > servers are started
> > > in separate containers.
> > >
> > > This patch also updates the missing documentation in ovn-ctl.8.xml.
> > >
> > > Signed-off-by: Numan Siddique 
> >
> > Despite the small patch, this is a major change in actual functionality,
> > since, with this option, ovn-ctl changes from a fast-running script that
> > just starts or stops a daemon, to a long-running script that waits for
> > the daemon to exit.
> >
> > I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
> > run_sb_ovsdb.  These could be implemented internally by just adding the
> > option, I guess.
> >
> > Another way might be to add a command to wait for a service to exit.
> >
> > The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
> > not too important.
> >
> > --detach and --monitor are independent.  Is there a reason to remove
> > --monitor when removing --detach?
> >
> 
> Thanks Ben. I agree. I will work based on your suggestions.
> In the case of containers, I thnk monitor is not required. The life of the
> container in the case of ovsdb-server would be till it runs.
> In case the ovsdb-server exits unexpectedly, the container
> management service (like docker) can restart the container if "restart"
> flag is set when starting the container.
> Please let me know if this doesn't sound fine.

I think that's OK, then.

It would be good to explain what this does, and why, and when might want
to use it, in the ovn-ctl manpage.

Thanks,

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


Re: [ovs-dev] [PATCH] Documentation: Add the Open vSwitch project charter.

2017-11-02 Thread Ben Pfaff
I'd appreciate it if someone would review this change.  It is
documentation only.

On Tue, Oct 24, 2017 at 09:33:07AM -0700, Ben Pfaff wrote:
> It always seems odd that this isn't in the repo, so this adds it, with
> internal links properly directed.
> 
> Signed-off-by: Ben Pfaff 
> ---
>  Documentation/automake.mk   |   1 +
>  Documentation/index.rst |   3 +-
>  Documentation/internals/charter.rst | 204 
> 
>  Documentation/internals/index.rst   |   1 +
>  4 files changed, 208 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/internals/charter.rst
> 
> diff --git a/Documentation/automake.mk b/Documentation/automake.mk
> index 6f38912f264b..6a2a169d3b21 100644
> --- a/Documentation/automake.mk
> +++ b/Documentation/automake.mk
> @@ -78,6 +78,7 @@ DOC_SOURCE = \
>   Documentation/internals/index.rst \
>   Documentation/internals/authors.rst \
>   Documentation/internals/bugs.rst \
> + Documentation/internals/charter.rst \
>   Documentation/internals/committer-grant-revocation.rst \
>   Documentation/internals/committer-responsibilities.rst \
>   Documentation/internals/documentation.rst \
> diff --git a/Documentation/index.rst b/Documentation/index.rst
> index 836c37fc3de9..904e4442b1da 100644
> --- a/Documentation/index.rst
> +++ b/Documentation/index.rst
> @@ -105,7 +105,8 @@ Learn more about the Open vSwitch project and about how 
> you can contribute:
>:doc:`internals/contributing/coding-style` |
>:doc:`internals/contributing/coding-style-windows`
>  
> -- **Maintaining:** :doc:`internals/maintainers` |
> +- **Maintaining:** :doc:`internals/charter` |
> +  :doc:`internals/maintainers` |
>:doc:`internals/committer-responsibilities` |
>:doc:`internals/committer-grant-revocation`
>  
> diff --git a/Documentation/internals/charter.rst 
> b/Documentation/internals/charter.rst
> new file mode 100644
> index ..1c8c46ede5a2
> --- /dev/null
> +++ b/Documentation/internals/charter.rst
> @@ -0,0 +1,204 @@
> +The Linux Foundation Open vSwitch Project Charter
> +=
> +
> +Effective August 9, 2016
> +
> +1. Mission of Open vSwitch Project (“OVS”).
> +
> +   The mission of OVS is to:
> +
> +   a. create an open source, production quality virtual networking
> +  platform, including a software switch, control plane, and
> +  related components, that supports standard management interfaces
> +  and opens the forwarding functions to programmatic extension and
> +  control; and
> +
> +   b. host the infrastructure for an OVS community, establishing a
> +  neutral home for community assets, infrastructure, meetings,
> +  events and collaborative discussions.
> +
> +2. Technical Steering Committee (“TSC”)
> +
> +   a. A TSC shall be composed of the Committers for OVS. The list of 
> Committers
> +  on the TSC are available at :doc:`/internals/maintainers`.
> +
> +   b. TSC projects generally will involve Committers and Contributors:
> +
> +  i. Contributors: anyone in the technical community that
> + contributes code, documentation or other technical artifacts
> + to the OVS codebase.
> +
> +  ii. Committers: Contributors who have the ability to commit
> +  directly to a project’s main branch or repository on an OVS
> +  project.
> +
> +   c. Participation in as a Contributor and/or Committer is open to
> +  anyone under the terms of this Charter.  The TSC may:
> +
> +  i. establish work flows and procedures for the submission,
> + approval and closure or archiving of projects,
> +
> +  ii. establish criteria and processes for the promotion of Contributors 
> to
> +  Committer status, available at
> +  :doc:`/internals/committer-grant-revocation`. and
> +
> +  iii. amend, adjust and refine the roles of Contributors and Committers
> +listed in Section 2.b., create new roles and publicly document
> +responsibilities and expectations for such roles, as it sees fit,
> +available at :doc:`/internals/committer-responsibilities`.
> +
> +   d. Responsibilities: The TSC is responsible for overseeing OVS
> +  activities and making decisions that impact the mission of OVS,
> +  including:
> +
> +  i. coordinating the technical direction of OVS;
> +
> +  ii. approving project proposals (including, but not limited to,
> +  incubation, deprecation and changes to a project’s charter
> +  or scope);
> +
> +  iii. creating sub-committees or working groups to focus on
> +   cross-project technical issues and requirements;
> +
> +  iv. communicating with external and industry organizations
> +  concerning OVS technical matters;
> +
> +  v. appointing representatives to work with other open source or
> + standards communities;
> +
> +  vi. establishing 

Re: [ovs-dev] [PATCH] ofproto-dpif-upcall: Fix null pointer dereference on exit.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 06:58:39PM +0100, Jakub Sitnicki wrote:
> On Thu, 2 Nov 2017 18:53:02 +0100
> Jakub Sitnicki  wrote:
> 
> > On Fri, 27 Oct 2017 08:40:23 -0700
> > Ben Pfaff  wrote:
> > 
> > > When revalidation occurs at the same time that a bridge is being removed
> > > or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
> > > the ofproto.  This caused a null pointer dereference if revalidation lost
> > > the race.  This commit fixes the problem.
> > > 
> > > Reported-by: Jakub Sitnicki 
> > > Signed-off-by: Ben Pfaff 
> > > ---
> > 
> > Tested-by: Jakub Sitnicki 
> > 
> > Thank you for the patch. I'm seeing less than before tests
> > failing or hanging with it applied of on top of master.
> 
> Forgot to ask - any chance it could be also applied back to branch-2.7?

I backported to branch-2.8, but branch-2.7 doesn't have the code that
causes this problem.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ofproto-dpif-upcall: Fix null pointer dereference on exit.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 06:53:02PM +0100, Jakub Sitnicki wrote:
> On Fri, 27 Oct 2017 08:40:23 -0700
> Ben Pfaff  wrote:
> 
> > When revalidation occurs at the same time that a bridge is being removed
> > or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
> > the ofproto.  This caused a null pointer dereference if revalidation lost
> > the race.  This commit fixes the problem.
> > 
> > Reported-by: Jakub Sitnicki 
> > Signed-off-by: Ben Pfaff 
> > ---
> 
> Tested-by: Jakub Sitnicki 
> 
> Thank you for the patch. I'm seeing less than before tests
> failing or hanging with it applied of on top of master.

Thanks.  I applied this to master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v3 0/4] Add support for IPv6 load balancers

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 11:13:55AM -0500, Mark Michelson wrote:
> This patchset adds the necessary items in order to support IPv6 load
> balancers in OVN. No syntax has changed in ovn-nbctl or in the
> northbound database to support this. Appropriate tests have been
> added to the testsuite as well.
> 
> v2 -> v3:
> * The patchset has been rebased.
> * Patch 2 has been updated to get rid of a warning produced by clang 3.8
>   due to some variable shadowing.
> 
> v1 -> v2:
> * The patchset has been rebased and conflicts resolved. The only
>   patch with noticeable differences is patch 3 of 4. This is because
>   add_router_lb_flow had to be modified to not attempt to add
>   undnat flows for IPv6 load balancers.
> * ovn-northd manpage has been updated to detail flows that are installed
>   for IPv6 load balancers. This change is in patch 3 as well.

Thanks a lot for implementing this feature!  I applied these patches to
master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Greg Rose

On 11/02/2017 11:07 AM, Ben Pfaff wrote:

On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:
> On certain Ubuntu systems running the 4.4 based kernel depmod
> may not correctly search for module dependencies when newer
> openvswitch kernel modules have been installed in the extra
> directory at /lib/modules/$(uname -r)/extra.  A symptom of
> this are the following messages in system log that can be
> printed with the dmesg command:

Thanks for figuring out the problem and documenting a fix.  I really
appreciate documentation patches.

> +#!/bin/sh
> +
> +check_ubuntu_depmod_config() {
> +if [ -e /etc/depmod.d/ubuntu.conf ]; then
> +if ! grep -q extra /etc/depmod.d/ubuntu.conf
> +then
> +sed -i s\/search\/"search extra"\/ 
/etc/depmod.d/ubuntu.conf
> +/sbin/depmod -a
> +fi
> +fi
> +}

I wonder about the details of this particular fix.  Usually, when there
is a configuration file in a .d directory, like depmod.d, it is possible
to add more files to the same directory that also get used for
configuration.  When that works, it is usually better to add files to
the directory rather than changing existing files, because it behaves
better on upgrade.  So, in this case, I wonder whether it is possible to
add a new file that would have something like:

 search extra

or

 override kmod * extra

The latter is suggested by depmod.d(5).


I'll give it a try and get back with the results.

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


Re: [ovs-dev] [PATCH v2 2/4] ovn: Allow ct_lb actions to take IPv6 address arguments.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 02:57:00PM +, Mark Michelson wrote:
> On Wed, Nov 1, 2017 at 4:53 PM Ben Pfaff  wrote:
> 
> > On Tue, Oct 31, 2017 at 09:27:02AM -0500, Mark Michelson wrote:
> > > The ct_lb action previously assumed that any address arguments were
> > > IPv4. This patch expands the parsing, formatting, and encoding of ct_lb
> > > to be amenable to IPv6 addresses as well.
> > >
> > > Signed-off-by: Mark Michelson 
> >
> > Thanks for working on this.
> >
> > With this change, I get the following warning from Clang 3.8:
> >
> > ../ovn/lib/actions.c:939:32: error: variable 'dst' is used
> > uninitialized whenever 'if' condition is false
> > [-Werror,-Wsometimes-uninitialized]
> > ../ovn/lib/actions.c:953:30: note: uninitialized use occurs here
> > ../ovn/lib/actions.c:939:28: note: remove the 'if' if its condition is
> > always true
> > ../ovn/lib/actions.c:932:21: error: variable 'dst' is used
> > uninitialized whenever 'if' condition is false
> > [-Werror,-Wsometimes-uninitialized]
> > ../ovn/lib/actions.c:953:30: note: uninitialized use occurs here
> > ../ovn/lib/actions.c:932:17: note: remove the 'if' if its condition is
> > always true
> > ../ovn/lib/actions.c:886:13: note: variable 'dst' is declared here
> >
> > I can't figure out what it's talking about, and I can't figure out a
> > simple way to suppress it.  Do you have any idea?
> >
> 
> I see what's wrong. There is a declaration of a "dst" variable in an inner
> scope that shadows the declaration of a "dst" variable in an outer scope.
> In the case where the if statement is false, the inner scope "dst" gets
> declared and its parameters set. What we want is for the outer scope "dst"
> to have its parameters set in that case. The easy solution is just to
> remove the inner scope declaration of dst. I'll do that and repost the
> patch.

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


Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Numan Siddique
On Thu, Nov 2, 2017 at 11:15 PM, Ben Pfaff  wrote:

> On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> > From: Numan Siddique 
> >
> > Presently if the user wants to start OVN db servers as separate
> containers, 'ovn-ctl'
> > script is not useful as '--detach' option is passed when ovsdb-servers
> are started.
> > If the container command is 'ovn-ctl start_nb_ovsdb', the  container
> exits as soon as
> > ovn-ctl exits.
> >
> > This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach'
> and
> > '--db-sb-detach' which can take 'yes/no'. This will be really useful for
> the above
> > mentioned requirement. The user can start NB ovsdb-server with the
> command
> > 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> >
> > Without this option, the user may have to first generate the db by
> running 'ovsdb-tool'
> > and then start the container with the command 'ovsdb-server ovnnb_db.db
> ' and this
> > is very inconvenient. This option will be useful only if the OVN db
> servers are started
> > in separate containers.
> >
> > This patch also updates the missing documentation in ovn-ctl.8.xml.
> >
> > Signed-off-by: Numan Siddique 
>
> Despite the small patch, this is a major change in actual functionality,
> since, with this option, ovn-ctl changes from a fast-running script that
> just starts or stops a daemon, to a long-running script that waits for
> the daemon to exit.
>
> I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
> run_sb_ovsdb.  These could be implemented internally by just adding the
> option, I guess.
>
> Another way might be to add a command to wait for a service to exit.
>
> The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
> not too important.
>
> --detach and --monitor are independent.  Is there a reason to remove
> --monitor when removing --detach?
>

Thanks Ben. I agree. I will work based on your suggestions.
In the case of containers, I thnk monitor is not required. The life of the
container in the case of ovsdb-server would be till it runs.
In case the ovsdb-server exits unexpectedly, the container
management service (like docker) can restart the container if "restart"
flag is set when starting the container.
Please let me know if this doesn't sound fine.

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


Re: [ovs-dev] [PATCH] Documentation: Document module install issues

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 10:46:48AM -0700, Greg Rose wrote:
> On certain Ubuntu systems running the 4.4 based kernel depmod
> may not correctly search for module dependencies when newer
> openvswitch kernel modules have been installed in the extra
> directory at /lib/modules/$(uname -r)/extra.  A symptom of
> this are the following messages in system log that can be
> printed with the dmesg command:

Thanks for figuring out the problem and documenting a fix.  I really
appreciate documentation patches.

> +#!/bin/sh
> +
> +check_ubuntu_depmod_config() {
> +if [ -e /etc/depmod.d/ubuntu.conf ]; then
> +if ! grep -q extra /etc/depmod.d/ubuntu.conf
> +then
> +sed -i s\/search\/"search extra"\/ 
> /etc/depmod.d/ubuntu.conf
> +/sbin/depmod -a
> +fi
> +fi
> +}

I wonder about the details of this particular fix.  Usually, when there
is a configuration file in a .d directory, like depmod.d, it is possible
to add more files to the same directory that also get used for
configuration.  When that works, it is usually better to add files to
the directory rather than changing existing files, because it behaves
better on upgrade.  So, in this case, I wonder whether it is possible to
add a new file that would have something like:

search extra

or

override kmod * extra

The latter is suggested by depmod.d(5).
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] ofproto-dpif-upcall: Fix null pointer dereference on exit.

2017-11-02 Thread Jakub Sitnicki
On Thu, 2 Nov 2017 18:53:02 +0100
Jakub Sitnicki  wrote:

> On Fri, 27 Oct 2017 08:40:23 -0700
> Ben Pfaff  wrote:
> 
> > When revalidation occurs at the same time that a bridge is being removed
> > or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
> > the ofproto.  This caused a null pointer dereference if revalidation lost
> > the race.  This commit fixes the problem.
> > 
> > Reported-by: Jakub Sitnicki 
> > Signed-off-by: Ben Pfaff 
> > ---
> 
> Tested-by: Jakub Sitnicki 
> 
> Thank you for the patch. I'm seeing less than before tests
> failing or hanging with it applied of on top of master.

Forgot to ask - any chance it could be also applied back to branch-2.7?

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


Re: [ovs-dev] [PATCH] ofproto-dpif-upcall: Fix null pointer dereference on exit.

2017-11-02 Thread Jakub Sitnicki
On Fri, 27 Oct 2017 08:40:23 -0700
Ben Pfaff  wrote:

> When revalidation occurs at the same time that a bridge is being removed
> or ovs-vswitchd is exiting, xlate_lookup_ofproto() races with deletion of
> the ofproto.  This caused a null pointer dereference if revalidation lost
> the race.  This commit fixes the problem.
> 
> Reported-by: Jakub Sitnicki 
> Signed-off-by: Ben Pfaff 
> ---

Tested-by: Jakub Sitnicki 

Thank you for the patch. I'm seeing less than before tests
failing or hanging with it applied of on top of master.

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


Re: [ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 04:55:14PM +0530, nusid...@redhat.com wrote:
> From: Numan Siddique 
> 
> Presently if the user wants to start OVN db servers as separate containers, 
> 'ovn-ctl'
> script is not useful as '--detach' option is passed when ovsdb-servers are 
> started.
> If the container command is 'ovn-ctl start_nb_ovsdb', the  container exits as 
> soon as
> ovn-ctl exits.
> 
> This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach' and
> '--db-sb-detach' which can take 'yes/no'. This will be really useful for the 
> above
> mentioned requirement. The user can start NB ovsdb-server with the command
> 'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.
> 
> Without this option, the user may have to first generate the db by running 
> 'ovsdb-tool'
> and then start the container with the command 'ovsdb-server ovnnb_db.db ' 
> and this
> is very inconvenient. This option will be useful only if the OVN db servers 
> are started
> in separate containers.
> 
> This patch also updates the missing documentation in ovn-ctl.8.xml.
> 
> Signed-off-by: Numan Siddique 

Despite the small patch, this is a major change in actual functionality,
since, with this option, ovn-ctl changes from a fast-running script that
just starts or stops a daemon, to a long-running script that waits for
the daemon to exit.

I wonder whether this would warrant new commands, e.g. run_nb_ovsdb and
run_sb_ovsdb.  These could be implemented internally by just adding the
option, I guess.

Another way might be to add a command to wait for a service to exit.

The "ovn-[sn]bctl init" commands won't run, in this case.  Maybe that is
not too important.

--detach and --monitor are independent.  Is there a reason to remove
--monitor when removing --detach?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv2] dpif-netlink-rtnl: Fix ovs_geneve probing after restart.

2017-11-02 Thread Eric Garver
On Wed, Nov 01, 2017 at 12:35:40PM -0700, William Tu wrote:
> When using the out-of-tree (openvswitch compat) geneve module,
> the first time oot tunnel probing returns true (correct).
> Without unloading the geneve module, if the userspace ovs-vswitchd
> restarts, because the 'geneve_sys_6081' still exists, the probing
> incorrectly returns false and loads the in-tree (upstream kernel)
> geneve module.
> 
> The patch fixes it by querying the geneve device's kind when exists.
> The out-of-tree modules uses kind string as 'ovs_geneve', while the
> in-tree module uses 'geneve'.  To reproduce the issue, start the ovs
> > /etc/init.d/openvswitch-switch start
> > creat a bridge and attach a geneve port using out-of-tree geneve
> > /etc/init.d/openvswitch-switch restart
> 
> Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides 
> used interface")
> Signed-off-by: William Tu 
> Cc: Eric Garver 
> Cc: Gurucharan Shetty 
> ---
> v1->v2:
> Add detection of existing module, instead of unconditionally
> remote it and create.
> ---
>  lib/dpif-netlink-rtnl.c | 35 +++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 0c32e7d8ccb4..b19b862d308b 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -440,6 +440,7 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  
>  error = netdev_open("ovs-system-probe", "geneve", );
>  if (!error) {
> +struct ofpbuf *reply;
>  const struct netdev_tunnel_config *tnl_cfg;
>  
>  tnl_cfg = netdev_get_tunnel_config(netdev);
> @@ -448,6 +449,36 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  }
>  
>  name = netdev_vport_get_dpif_port(netdev, namebuf, sizeof namebuf);
> +
> +/* The geneve module exists when ovs-vswitchd crashes
> + * and restarts, handle the case here.
> + */
> +error = dpif_netlink_rtnl_getlink(name, );
> +if (!error) {
> +
> +struct nlattr *linkinfo[ARRAY_SIZE(linkinfo_policy)];
> +struct nlattr *rtlink[ARRAY_SIZE(rtlink_policy)];
> +const char *kind;
> +
> +nl_policy_parse(reply, NLMSG_HDRLEN + sizeof(struct ifinfomsg),
> +rtlink_policy, rtlink,
> +ARRAY_SIZE(rtlink_policy));
> +nl_parse_nested(rtlink[IFLA_LINKINFO], linkinfo_policy,
> +linkinfo, ARRAY_SIZE(linkinfo_policy));

Should check the return code of these two.

> +kind = nl_attr_get_string(linkinfo[IFLA_INFO_KIND]);
> +
> +if (!strcmp(kind, "ovs_geneve")) {
> +out_of_tree = true;
> +goto exit;
> +} else if (!strcmp(kind, "geneve")) {
> +out_of_tree = false;
> +goto exit;
> +} else {
> +VLOG_ABORT("Geneve tunnel device %s with kind %s"
> +   " not supported", name, kind);
> +}

Need to free reply somewhere, ofpbuf_delete(reply)

> +}
> +
>  error = dpif_netlink_rtnl_create(tnl_cfg, name, 
> OVS_VPORT_TYPE_GENEVE,
>   "ovs_geneve",
>   (NLM_F_REQUEST | NLM_F_ACK
> @@ -458,6 +489,10 @@ dpif_netlink_rtnl_probe_oot_tunnels(void)
>  }
>  out_of_tree = true;
>  }
> +}
> +
> +exit:
> +if (!error) {
>  netdev_close(netdev);
>  }

This is not right. netdev_open() may succeed, but
dpif_netlink_rtnl_create() can fail. Which means netdev will not be
freed here.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH] datapath: Remove redundant check for IFF_NO_QUEUE

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 08:51:59AM +0800, Kaige Fu wrote:
> On 2017/11/2 4:19, Ben Pfaff wrote:
> > On Wed, Nov 01, 2017 at 08:43:20AM -0700, Greg Rose wrote:
> >> On 10/30/2017 06:13 PM, fukaige wrote:
> >>> From: Kaige Fu 
> >>>
> >>> IFF_NO_QUEUE is checked twice. This cause a situation
> >>> that HAVE_IFF_NO_QUEUE is defined no matter whether
> >>> the flag IFF_NO_QUEUE is defined in kernel or not.
> >>>
> >>> Signed-off-by: Kaige Fu 
> >>> ---
> >>>  datapath/linux/compat/include/linux/netdevice.h | 3 ---
> >>>  1 file changed, 3 deletions(-)
> >>>
> >>> diff --git a/datapath/linux/compat/include/linux/netdevice.h 
> >>> b/datapath/linux/compat/include/linux/netdevice.h
> >>> index a5d4ee8..3c3cf42 100644
> >>> --- a/datapath/linux/compat/include/linux/netdevice.h
> >>> +++ b/datapath/linux/compat/include/linux/netdevice.h
> >>> @@ -22,9 +22,6 @@ struct net;
> >>>  #define IFF_LIVE_ADDR_CHANGE 0
> >>>  #endif
> >>> -#ifndef IFF_NO_QUEUE
> >>> -#define IFF_NO_QUEUE 0
> >>> -#endif
> >>>  #ifndef IFF_OPENVSWITCH
> >>>  #define IFF_OPENVSWITCH 0
> >>>  #endif
> >>>
> >> Looks correct to me.
> >>
> >> Reviewed-by: Greg Rose 
> > Thanks Kaige and Greg.  I applied this to master.  Let me know if it
> > should be backported.
> >
> > .
> 
> Thanks for applying this patch. It should be backported to 
> branch-2.8/branch-2.7/branch-2.6.

Thanks for the advice.  These backports are done now.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 6/6] installer-windows: Add x64 installer build via command line

2017-11-02 Thread Alin Balutoiu
Acked-by: Alin Balutoiu 

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Gabriel Serdean
> Sent: Tuesday, October 31, 2017 6:26 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean 
> Subject: [ovs-dev] [PATCH 6/6] installer-windows: Add x64 installer build via
> command line
> 
> Add a new variable to know on which platform we are compiling.
> 
> Make the msbuild command to be aware of the platform we want to build.
> 
> Shorter the msbuild parameters from `property:`->`p:`. Change slashes to
> double slashes so msys does not get confused.
> 
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  Makefile.am | 1 +
>  m4/openvswitch.m4   | 3 +++
>  windows/automake.mk | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index ebbc045..5d19f08 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -20,6 +20,7 @@ AM_CPPFLAGS += $(PTHREAD_INCLUDES)
> AM_CPPFLAGS += $(MSVC_CFLAGS)  AM_LDFLAGS +=
> $(PTHREAD_LDFLAGS)  AM_LDFLAGS += $(MSVC64_LDFLAGS)
> +PLATFORM = $(MSVC_PLATFORM)
>  endif
> 
>  AM_CPPFLAGS += -I $(top_srcdir)/include diff --git a/m4/openvswitch.m4
> b/m4/openvswitch.m4 index 59e1352..5b13baa 100644
> --- a/m4/openvswitch.m4
> +++ b/m4/openvswitch.m4
> @@ -79,11 +79,14 @@ AC_DEFUN([OVS_CHECK_WIN64],
>   if (cl) 2>&1 | grep 'x64' >/dev/null 2>&1; then
> cl_cv_x64=yes
> MSVC64_LDFLAGS=" /MACHINE:X64 "
> +   MSVC_PLATFORM="x64"
>   else
> cl_cv_x64=no
> MSVC64_LDFLAGS=""
> +   MSVC_PLATFORM="x86"
>   fi])
>   AC_SUBST([MSVC64_LDFLAGS])
> + AC_SUBST([MSVC_PLATFORM])
>  ])
> 
>  dnl Checks for WINDOWS.
> diff --git a/windows/automake.mk b/windows/automake.mk index
> 11ab4c7..80dca14 100644
> --- a/windows/automake.mk
> +++ b/windows/automake.mk
> @@ -35,7 +35,7 @@ windows_installer: all
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.cat
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.cat
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.inf
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.inf
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.sys
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.sys
> - MSBuild.exe windows/ovs-windows-installer.sln //nologo
> /target:Build /property:Configuration="Release"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe windows/ovs-windows-installer.sln //nologo
> //target:Build
> +//p:Configuration="Release" //p:Version="$(PACKAGE_VERSION)"
> +//p:Platform=$(PLATFORM)
> 
>  EXTRA_DIST += \
>   windows/automake.mk \
> --
> 2.10.2.windows.1
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 5/6] installer-windows: Modify installer so it can be compiled on x64

2017-11-02 Thread Alin Balutoiu
Minor comment inline.

Acked-by: Alin Balutoiu 

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Gabriel Serdean
> Sent: Tuesday, October 31, 2017 6:26 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean 
> Subject: [ovs-dev] [PATCH 5/6] installer-windows: Modify installer so it can
> be compiled on x64
> 
> Add variables to know for which platform we are building.
> 
> They are needed for the installer to know if it should install in `Program 
> Files
> (x86)` or `Program Files` and which registry it needs to update.
> 
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  windows/ovs-windows-installer/Product.wxs | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/windows/ovs-windows-installer/Product.wxs b/windows/ovs-
> windows-installer/Product.wxs
> index 599fd43..e1d4f17 100644
> --- a/windows/ovs-windows-installer/Product.wxs
> +++ b/windows/ovs-windows-installer/Product.wxs
> @@ -16,6 +16,16 @@
>  under the License.
>
>  -->
> +
> +
> +  
> +  
> +
> +  
> ++?>
>  http://schemas.microsoft.com/wix/2006/wi;
>   xmlns:util="http://schemas.microsoft.com/wix/UtilExtension;>
> @@ -93,7 +103,7 @@
> 
>
>  
> -  
> +  
>  
>
>
> --
> 2.10.2.windows.1
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 4/6] installer-windows: Call WIX binaries outside of MSBuild on x64

2017-11-02 Thread Alin Balutoiu

Acked-by: Alin Balutoiu 

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Gabriel Serdean
> Sent: Tuesday, October 31, 2017 6:26 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean 
> Subject: [ovs-dev] [PATCH 4/6] installer-windows: Call WIX binaries outside
> of MSBuild on x64
> 
> Unfortunately all WIX binaries (candle, heat, etc) are only 32 bit (up to the
> latest version 3.11).
> 
> For performance reasons they are run as .NET assemblies inside the MSBuild
> process. Running 32 bit assemblies inside a 64 bit process (MSBuild) makes
> them segfault.
> 
> Add a new option for heat to be run as an individual process when the
> platform is not x86.
> 
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  windows/ovs-windows-installer/ovs-windows-installer.wixproj | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/windows/ovs-windows-installer/ovs-windows-installer.wixproj
> b/windows/ovs-windows-installer/ovs-windows-installer.wixproj
> index a8256ed..241d605 100644
> --- a/windows/ovs-windows-installer/ovs-windows-installer.wixproj
> +++ b/windows/ovs-windows-installer/ovs-windows-installer.wixproj
> @@ -13,6 +13,7 @@
>  1.0.0.0
>
>
> +true
>  bin\$(Configuration)\
> 
> obj\$(Configuration)\ >
> 
> BinariesPath=Binaries;SymbolsPath=Symbols;Version=$(
> Version)
> @@ -21,6 +22,7 @@
>  1076;
>
>
> +true
> 
> BinariesPath=Binaries;SymbolsPath=Symbols;Version=$(
> Version)
>  False
>  False
> @@ -67,9 +69,9 @@
>
>
>
> - Directory="Binaries" ComponentGroupName="BinariesComponentGroup"
> ToolPath="$(WixToolPath)" PreprocessorVariable="var.BinariesPath"
> GenerateGuidsNow="true" SuppressCom="true" SuppressRegistry="true"
> KeepEmptyDirectories="true" SuppressRootDirectory="true">
> + + DirectoryRefId="BINARIESDIR" OutputFile="Binaries.wxs"
> + Directory="Binaries" ComponentGroupName="BinariesComponentGroup"
> + ToolPath="$(WixToolPath)" PreprocessorVariable="var.BinariesPath"
> + GenerateGuidsNow="true" SuppressCom="true" SuppressRegistry="true"
> + KeepEmptyDirectories="true" SuppressRootDirectory="true">
>  
> - Directory="Symbols" ComponentGroupName="SymbolsComponentGroup"
> ToolPath="$(WixToolPath)" PreprocessorVariable="var.SymbolsPath"
> GenerateGuidsNow="true" SuppressCom="true" SuppressRegistry="true"
> KeepEmptyDirectories="true" SuppressRootDirectory="true">
> + + DirectoryRefId="SYMBOLSDIR" OutputFile="Symbols.wxs"
> + Directory="Symbols"
> ComponentGroupName="SymbolsComponentGroup"
> + ToolPath="$(WixToolPath)" PreprocessorVariable="var.SymbolsPath"
> + GenerateGuidsNow="true" SuppressCom="true" SuppressRegistry="true"
> + KeepEmptyDirectories="true" SuppressRootDirectory="true">
>  
>
> 2.10.2.windows.1
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 3/6] installer-windows: Resolve WIX solution build type

2017-11-02 Thread Alin Balutoiu
Acked-by: Alin Balutoiu 

> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Gabriel Serdean
> Sent: Tuesday, October 31, 2017 6:26 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean 
> Subject: [ovs-dev] [PATCH 3/6] installer-windows: Resolve WIX solution build
> type
> 
> Until now the x64 build of the installer solution was pointing to the
> x86 build of the WIX project.
> 
> This patch changes for them to match.
> 
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  windows/ovs-windows-installer.sln | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/windows/ovs-windows-installer.sln b/windows/ovs-windows-
> installer.sln
> index 09311f9..f563438 100644
> --- a/windows/ovs-windows-installer.sln
> +++ b/windows/ovs-windows-installer.sln
> @@ -10,8 +10,8 @@ Global
>   Release|x86 = Release|x86
>   EndGlobalSection
>   GlobalSection(ProjectConfigurationPlatforms) = postSolution
> - {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x64.ActiveCfg = Release|x86
> - {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x64.Build.0 = Release|x86
> + {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x64.ActiveCfg = Release|x64
> + {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x64.Build.0 = Release|x64
>   {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x86.ActiveCfg = Release|x86
>   {259905A2-7434-4190-8A33-
> 8FBA67171DD6}.Release|x86.Build.0 = Release|x86
>   EndGlobalSection
> --
> 2.10.2.windows.1
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 1/6] build-windows: Suppress output from MSBuild

2017-11-02 Thread Alin Balutoiu
Acked-by: Alin Balutoiu 


> -Original Message-
> From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev-
> boun...@openvswitch.org] On Behalf Of Alin Gabriel Serdean
> Sent: Tuesday, October 31, 2017 6:26 PM
> To: d...@openvswitch.org
> Cc: Alin Gabriel Serdean 
> Subject: [ovs-dev] [PATCH 1/6] build-windows: Suppress output from
> MSBuild
> 
> Add `nologo` parameter to MSBuild to suppress the banner.
> 
> This will make tidier log messages.
> 
> Signed-off-by: Alin Gabriel Serdean 
> ---
>  Makefile.am  | 8 
>  datapath-windows/automake.mk | 4 ++--
>  windows/automake.mk  | 2 +-
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 5ceb382..ebbc045 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -406,13 +406,13 @@ CLEANFILES += manpage-dep-check  if
> VSTUDIO_DDK  ALL_LOCAL += ovsext
>  ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-
> windows/include/OvsDpInterface.h
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> 
>  CLEAN_LOCAL += ovsext_clean
>  ovsext_clean: datapath-windows/ovsext.sln
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
> /property:Version="$(PACKAGE_VERSION)"
>  endif
>  .PHONY: ovsext
> 
> diff --git a/datapath-windows/automake.mk b/datapath-
> windows/automake.mk index 36018ea..3820041 100644
> --- a/datapath-windows/automake.mk
> +++ b/datapath-windows/automake.mk
> @@ -86,5 +86,5 @@ EXTRA_DIST += \
>   datapath-windows/ovsext/resource.h
> 
>  datapath_windows_analyze: all
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8.1Analyze"
> - MSBuild.exe //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8Analyze"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8.1Analyze"
> + MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln
> /target:Build /property:Configuration="Win8Analyze"
> diff --git a/windows/automake.mk b/windows/automake.mk index
> 4fec99e..11ab4c7 100644
> --- a/windows/automake.mk
> +++ b/windows/automake.mk
> @@ -35,7 +35,7 @@ windows_installer: all
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.cat
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.cat
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.inf
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.inf
>   cp -f $(top_srcdir)/datapath-
> windows/x64/Win8.1$(VSTUDIO_CONFIG)/package/ovsext.sys
> windows/ovs-windows-installer/Driver/Win8.1/ovsext.sys
> - MSBuild.exe windows/ovs-windows-installer.sln /target:Build
> /property:Configuration="Release"
> /property:Version="$(PACKAGE_VERSION)"
> + MSBuild.exe windows/ovs-windows-installer.sln //nologo
> /target:Build /property:Configuration="Release"
> /property:Version="$(PACKAGE_VERSION)"
> 
>  EXTRA_DIST += \
>   windows/automake.mk \
> --
> 2.10.2.windows.1
> 
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to include/openvswitch

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 01:35:11PM +, Alin Serdean wrote:
> 
> 
> > -Original Message-
> > From: Xiao Liang [mailto:shaw.l...@gmail.com]
> > Sent: Thursday, November 2, 2017 4:32 AM
> > To: Alin Serdean 
> > Cc: Ben Pfaff ; d...@openvswitch.org
> > Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
> > include/openvswitch
> > 
> > On Thu, Nov 2, 2017 at 5:51 AM, Alin Serdean
> >  wrote:
> > >
> > >
> > >> -Original Message-
> > >> From: Ben Pfaff [mailto:b...@ovn.org]
> > >> Sent: Tuesday, October 31, 2017 9:34 PM
> > >> To: Xiao Liang ; Alin Serdean
> > >> 
> > >> Cc: d...@openvswitch.org
> > >> Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
> > >> include/openvswitch
> > >>
> > >> On Thu, Aug 17, 2017 at 12:06:25AM +0800, Xiao Liang wrote:
> > >> > Poll-loop is the core to implement main loop. It should be
> > >> > available in libopenvswitch.
> > >> >
> > >> > Signed-off-by: Xiao Liang 
> > >>
> > >> I'm concerned about the way that this adds a definition of HANDLE in
> > >> a public header.  That seems unfriendly to code that might want to
> > >> include both this header and Win32 headers that properly define HANDLE.
> > >>
> > >> Alin, what's the right thing to do here?
> > > [Alin Serdean] First the type definition is wrong (HANDLE is VOID*).
> > > I would avoid adding the definition to HANDLE. Maybe add an include to
> >  or  to include/windows/poll.h .
> > 
> > Since include/windows is not installed as public header, is it safe to 
> > remove
> > inclusion of poll.h and add windows.h in poll-loop.h?
> That sounds reasonable to me. Ben do you agree?

 is definitely needed on non-Windows platforms for the
definition of POLLIN and POLLOUT, so it would have to be conditional.  I
don't object to including , on Windows, but I don't know the
full implications of doing it.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] OVN: Add support for periodic router advertisements.

2017-11-02 Thread Ben Pfaff
On Thu, Nov 02, 2017 at 02:50:13PM +, Mark Michelson wrote:
> On Wed, Nov 1, 2017 at 4:38 PM Ben Pfaff  wrote:
> 
> > On Wed, Oct 18, 2017 at 11:53:49AM -0500, Mark Michelson wrote:
> > > This change adds three new options to the Northbound
> > > Logical_Router_Port's ipv6_ra_configs option:
> > >
> > > * send_periodic: If set to "true", then OVN will send periodic router
> > > advertisements out of this router port.
> > > * max_interval: The maximum amount of time to wait between sending
> > > periodic router advertisements.
> > > * min_interval: The minimum amount of time to wait between sending
> > > periodic router advertisements.
> > >
> > > When send_periodic is true, then IPv6 RA configs, as well as some layer
> > > 2 and layer 3 information about the router port, are copied to the
> > > southbound database. From there, ovn-controller can use this information
> > > to know when to send periodic RAs and what to send in them.
> > >
> > > Because periodic RAs originate from each ovn-controller, the new
> > > keep-local flag is set on the packet so that ports don't receive an
> > > overabundance of RAs.
> > >
> > > Signed-off-by: Mark Michelson 
> >
> > Thanks a lot for working on this.  It addresses a feature we've been
> > missing for a long time.
> >
> > I get several application failures:
> >
> >Applying: OVN: Add support for periodic router advertisements.
> >error: patch failed: ovn/controller/pinctrl.c:88
> >error: ovn/controller/pinctrl.c: patch does not apply
> >error: patch failed: ovn/northd/ovn-northd.c:4375
> >error: ovn/northd/ovn-northd.c: patch does not apply
> >error: patch failed: ovn/ovn-nb.xml:1369
> >error: ovn/ovn-nb.xml: patch does not apply
> >Patch failed at 0001 OVN: Add support for periodic router
> > advertisements.
> >
> > Would you mind rebasing and reposting?  Thanks a lot.
> >
> 
> Thanks for having a look Ben.
> 
> I'm not sure if you saw, but in the cover letter for this patchset, I
> mentioned that it was dependent on Numan Siddique's patchset that adds
> support for responses to router solicitations, etc (I provided the series
> ID from patchwork). If that patchset was not applied before this one, then
> there would be lots of errors when attempting to patch, and even more when
> attempting to compile.

I didn't notice that.  OK.

> That being said, I will need to rebase and repost again anyway, because
> Numan's patchset has been updated and reposted today. I also need to make
> the manpage adjustments that you suggested for patch 1. I'll get that done
> as soon as I can.

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


[ovs-dev] [PATCH v3 4/4] ovn: Add IPv6 capability to ovn-nbctl lb-add

2017-11-02 Thread Mark Michelson
ovn-nbctl will now accept IPv6 addresses for load balancer VIPs and
desetination addresses.

In addition, the ovn-nbctl lb-list, lr-lb-list, and ls-lb-list have been
modified to be able to fit IPv6 addresses on screen.

Signed-off-by: Mark Michelson 
---
 ovn/utilities/ovn-nbctl.8.xml |  14 +-
 ovn/utilities/ovn-nbctl.c | 175 ++-
 tests/ovn-nbctl.at| 379 +++---
 3 files changed, 459 insertions(+), 109 deletions(-)

diff --git a/ovn/utilities/ovn-nbctl.8.xml b/ovn/utilities/ovn-nbctl.8.xml
index a20828088..3688d35b3 100644
--- a/ovn/utilities/ovn-nbctl.8.xml
+++ b/ovn/utilities/ovn-nbctl.8.xml
@@ -600,13 +600,15 @@
  Creates a new load balancer named lb with the provided
  vip and ips or adds the vip to
  an existing lb.  vip should be a
- virtual IPv4 address (or an IPv4 address and a port number with
+ virtual IP address (or an IP address and a port number with
  : as a separator).  Examples for vip are
- 192.168.1.4 and 192.168.1.5:8080.
- ips should be comma separated IPv4 endpoints (or comma
- separated IPv4 addresses and port numbers with : as a
- separator).  Examples for ips are 10.0.0.1,10.0.0.2
- or 20.0.0.10:8800,20.0.0.11:8800.
+ 192.168.1.4, fd0f::1, and
+ 192.168.1.5:8080. ips should be comma
+ separated IP endpoints (or comma separated IP addresses and port
+ numbers with : as a separator).  ips must
+ be the same address family as vip.  Examples for
+ ips are 10.0.0.1,10.0.0.2or
+ [fdef::1]:8800,[fdef::2]:8800.
 
 
 
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index 77889961f..34904cf5b 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -1553,40 +1553,76 @@ nbctl_lb_add(struct ctl_context *ctx)
 }
 }
 
-ovs_be32 ipv4 = 0;
-ovs_be16 port = 0;
-char *error = ip_parse_port(lb_vip, , );
+struct sockaddr_storage ss_vip;
+char *error;
+error = ipv46_parse(lb_vip, PORT_OPTIONAL, _vip);
 if (error) {
 free(error);
-if (!ip_parse(lb_vip, )) {
-ctl_fatal("%s: should be an IPv4 address (or an IPv4 address "
-"and a port number with : as a separator).", lb_vip);
+ctl_fatal("%s: should be an IP address (or an IP address "
+  "and a port number with : as a separator).", lb_vip);
+}
+
+char lb_vip_normalized[INET6_ADDRSTRLEN + 8];
+char normalized_ip[INET6_ADDRSTRLEN];
+if (ss_vip.ss_family == AF_INET) {
+struct sockaddr_in *sin = ALIGNED_CAST(struct sockaddr_in *, _vip);
+inet_ntop(AF_INET, >sin_addr, normalized_ip,
+  sizeof normalized_ip);
+if (sin->sin_port) {
+is_vip_with_port = true;
+snprintf(lb_vip_normalized, sizeof lb_vip_normalized, "%s:%d",
+ normalized_ip, ntohs(sin->sin_port));
+} else {
+is_vip_with_port = false;
+ovs_strlcpy(lb_vip_normalized, normalized_ip,
+sizeof lb_vip_normalized);
 }
-
-if (is_update_proto) {
-ctl_fatal("Protocol is unnecessary when no port of vip "
-"is given.");
+} else {
+struct sockaddr_in6 *sin6 = ALIGNED_CAST(struct sockaddr_in6 *,
+ _vip);
+inet_ntop(AF_INET6, >sin6_addr, normalized_ip,
+  sizeof normalized_ip);
+if (sin6->sin6_port) {
+is_vip_with_port = true;
+snprintf(lb_vip_normalized, sizeof lb_vip_normalized, "[%s]:%d",
+ normalized_ip, ntohs(sin6->sin6_port));
+} else {
+is_vip_with_port = false;
+ovs_strlcpy(lb_vip_normalized, normalized_ip,
+sizeof lb_vip_normalized);
 }
-is_vip_with_port = false;
+}
+
+if (!is_vip_with_port && is_update_proto) {
+ctl_fatal("Protocol is unnecessary when no port of vip "
+  "is given.");
 }
 
 char *token = NULL, *save_ptr = NULL;
 struct ds lb_ips_new = DS_EMPTY_INITIALIZER;
 for (token = strtok_r(lb_ips, ",", _ptr);
 token != NULL; token = strtok_r(NULL, ",", _ptr)) {
-if (is_vip_with_port) {
-error = ip_parse_port(token, , );
-if (error) {
-free(error);
-ds_destroy(_ips_new);
-ctl_fatal("%s: should be an IPv4 address and a port "
+struct sockaddr_storage ss_dst;
+
+error = ipv46_parse(token, is_vip_with_port
+? PORT_REQUIRED
+: PORT_FORBIDDEN,
+_dst);
+
+if (error) {
+free(error);
+if (is_vip_with_port) {
+ctl_fatal("%s: should be an IP address and a port "
  

[ovs-dev] [PATCH v3 3/4] ovn: Allow northd to install IPv6 ct_lb logical flows.

2017-11-02 Thread Mark Michelson
For this commit, ovn-northd will now accept both IPv4 and IPv6 addresses
in the northbound database for a load balancer VIP or destination
addresses. For IPv4, the behavior remains the same. For IPv6, the
following logical flows will be added to the southbound database:

* An ND_NA response for incoming ND_NS requests for the load balancer
  VIP.
* A ct_lb flow with the configured IPv6 addresses.

The ovn-northd manpage has been updated to indicate what flows are
added for load balancers with IPv6 VIPs.

Signed-off-by: Mark Michelson 
---
 ovn/northd/ovn-northd.8.xml |  68 ++---
 ovn/northd/ovn-northd.c | 182 ++--
 ovn/ovn-nb.xml  |  22 +++---
 3 files changed, 163 insertions(+), 109 deletions(-)

diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index e9799e18a..b31106521 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -243,8 +243,10 @@
   balancing rules with virtual IP addresses (and ports) are configured in
   OVN_Northbound database for a logical switch datapath, a
   priority-100 flow is added for each configured virtual IP address
-  VIP with a match ip  ip4.dst == VIP
-   that sets an action reg0[0] = 1; next; to act as a
+  VIP. For IPv4 VIPs, the match is ip
+   ip4.dst == VIP.  For IPv6 VIPs,
+  the match is ip  ip6.dst == VIP. The
+  flow sets an action reg0[0] = 1; next; to act as a
   hint for table Pre-stateful to send IP packets to the
   connection tracker for packet de-fragmentation before eventually
   advancing to ingress table LB.
@@ -383,21 +385,29 @@
   
 For all the configured load balancing rules for a switch in
 OVN_Northbound database that includes a L4 port
-PORT of protocol P and IPv4 address
-VIP, a priority-120 flow that matches on
-ct.new  ip  ip4.dst == VIP
- P  P.dst == PORT
- with an action of ct_lb(args),
-where args contains comma separated IPv4 addresses (and
-optional port numbers) to load balance to.
+PORT of protocol P and IP address
+VIP, a priority-120 flow is added.  For IPv4 VIPs
+, the flow matches ct.new  ip 
+ip4.dst == VIP  P 
+P.dst == PORT.  For IPv6 VIPs,
+the flow matches ct.new  ip  ip6.dst == 
+VIP  P  P.dst == 
+PORT. The flow's action is ct_lb(args)
+, where args contains comma separated IP addresses
+(and optional port numbers) to load balance to.  The address family of
+the IP addresses of args is the same as the address family
+of VIP
   
   
 For all the configured load balancing rules for a switch in
 OVN_Northbound database that includes just an IP address
-VIP to match on, a priority-110 flow that matches on
-ct.new  ip  ip4.dst == VIP
-with an action of ct_lb(args), where
-args contains comma separated IPv4 addresses.
+VIP to match on, OVN adds a priority-110 flow.  For IPv4
+VIPs, the flow matches ct.new  ip 
+ip4.dst == VIP. For IPv6 VIPs,
+the flow matches ct.new  ip  ip6.dst == 
+VIP. The action on this flow is 
+ct_lb(args), where args contains comma
+separated IP addresses of the same address family as VIP.
   
   
 A priority-100 flow commits packets to connection tracker using
@@ -1113,7 +1123,7 @@ output;
 
   These flows reply to ARP requests for the virtual IP addresses
   configured in the router for DNAT or load balancing.  For a
-  configured DNAT IP address or a load balancer VIP A,
+  configured DNAT IP address or a load balancer IPv4 VIP A,
   for each router port P with Ethernet
   address E, a priority-90 flow matches
   inport == P  arp.op == 1 
@@ -1190,13 +1200,13 @@ arp.sha = external_mac;
 
   Reply to IPv6 Neighbor Solicitations.  These flows reply to
   Neighbor Solicitation requests for the router's own IPv6
-  address and populate the logical router's mac binding table.
-  For each router port P that owns IPv6 address
-  A, solicited node address S, and
-  Ethernet address E, a priority-90 flow matches
-  inport == P  nd_ns 
-  ip6.dst == {A, E}  nd.target
-  == A with the following actions:
+  address and load balancing IPv6 VIPs and populate the logical
+  router's mac binding table. For each router port P that
+  owns IPv6 address or has load balancing VIP A, solicited
+  node address S, and Ethernet address E, a
+  priority-90 flow matches inport == P 
+  nd_ns  ip6.dst == {A, E} 
+  nd.target == A with the following actions:
 
 
 
@@ -1364,10 +1374,12 @@ icmp4 {
   to the next table.  If load balancing rules with 

[ovs-dev] [PATCH v3 2/4] ovn: Allow ct_lb actions to take IPv6 address arguments.

2017-11-02 Thread Mark Michelson
The ct_lb action previously assumed that any address arguments were
IPv4. This patch expands the parsing, formatting, and encoding of ct_lb
to be amenable to IPv6 addresses as well.

Signed-off-by: Mark Michelson 
---
 include/ovn/actions.h |  6 +++-
 ovn/lib/actions.c | 98 ---
 tests/ovn.at  |  8 -
 3 files changed, 90 insertions(+), 22 deletions(-)

diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index 0a04af7aa..63885da3c 100644
--- a/include/ovn/actions.h
+++ b/include/ovn/actions.h
@@ -200,7 +200,11 @@ struct ovnact_ct_nat {
 };
 
 struct ovnact_ct_lb_dst {
-ovs_be32 ip;
+int family;
+union {
+struct in6_addr ipv6;
+ovs_be32 ipv4;
+};
 uint16_t port;
 };
 
diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index c9876436d..2aace1487 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -883,23 +883,62 @@ parse_ct_lb_action(struct action_context *ctx)
 
 if (lexer_match(ctx->lexer, LEX_T_LPAREN)) {
 while (!lexer_match(ctx->lexer, LEX_T_RPAREN)) {
-if (ctx->lexer->token.type != LEX_T_INTEGER
-|| mf_subvalue_width(>lexer->token.value) > 32) {
-free(dsts);
-lexer_syntax_error(ctx->lexer, "expecting IPv4 address");
-return;
-}
+struct ovnact_ct_lb_dst dst;
+if (lexer_match(ctx->lexer, LEX_T_LSQUARE)) {
+/* IPv6 address and port */
+if (ctx->lexer->token.type != LEX_T_INTEGER
+|| ctx->lexer->token.format != LEX_F_IPV6) {
+free(dsts);
+lexer_syntax_error(ctx->lexer, "expecting IPv6 address");
+return;
+}
+dst.family = AF_INET6;
+dst.ipv6 = ctx->lexer->token.value.ipv6;
 
-/* Parse IP. */
-ovs_be32 ip = ctx->lexer->token.value.ipv4;
-lexer_get(ctx->lexer);
+lexer_get(ctx->lexer);
+if (!lexer_match(ctx->lexer, LEX_T_RSQUARE)) {
+free(dsts);
+lexer_syntax_error(ctx->lexer, "no closing square "
+   "bracket");
+return;
+}
+dst.port = 0;
+if (lexer_match(ctx->lexer, LEX_T_COLON)
+&& !action_parse_port(ctx, )) {
+free(dsts);
+return;
+}
+} else {
+if (ctx->lexer->token.type != LEX_T_INTEGER
+|| (ctx->lexer->token.format != LEX_F_IPV4
+&& ctx->lexer->token.format != LEX_F_IPV6)) {
+free(dsts);
+lexer_syntax_error(ctx->lexer, "expecting IP address");
+return;
+}
 
-/* Parse optional port. */
-uint16_t port = 0;
-if (lexer_match(ctx->lexer, LEX_T_COLON)
-&& !action_parse_port(ctx, )) {
-free(dsts);
-return;
+/* Parse IP. */
+if (ctx->lexer->token.format == LEX_F_IPV4) {
+dst.family = AF_INET;
+dst.ipv4 = ctx->lexer->token.value.ipv4;
+} else {
+dst.family = AF_INET6;
+dst.ipv6 = ctx->lexer->token.value.ipv6;
+}
+
+lexer_get(ctx->lexer);
+dst.port = 0;
+if (lexer_match(ctx->lexer, LEX_T_COLON)) {
+if (dst.family == AF_INET6) {
+free(dsts);
+lexer_syntax_error(ctx->lexer, "IPv6 address needs "
+"square brackets if port is included");
+return;
+} else if (!action_parse_port(ctx, )) {
+free(dsts);
+return;
+}
+}
 }
 lexer_match(ctx->lexer, LEX_T_COMMA);
 
@@ -907,7 +946,7 @@ parse_ct_lb_action(struct action_context *ctx)
 if (n_dsts >= allocated_dsts) {
 dsts = x2nrealloc(dsts, _dsts, sizeof *dsts);
 }
-dsts[n_dsts++] = (struct ovnact_ct_lb_dst) { ip, port };
+dsts[n_dsts++] = dst;
 }
 }
 
@@ -929,9 +968,19 @@ format_CT_LB(const struct ovnact_ct_lb *cl, struct ds *s)
 }
 
 const struct ovnact_ct_lb_dst *dst = >dsts[i];
-ds_put_format(s, IP_FMT, IP_ARGS(dst->ip));
-if (dst->port) {
-ds_put_format(s, ":%"PRIu16, dst->port);
+if (dst->family == AF_INET) {
+ds_put_format(s, IP_FMT, IP_ARGS(dst->ipv4));
+if (dst->port) {
+ds_put_format(s, ":%"PRIu16, 

[ovs-dev] [PATCH v3 1/4] Add general-purpose IP/port parsing function.

2017-11-02 Thread Mark Michelson
OVS has functions for parsing IPv4 addresses, parsing IPv4 addresses
with a port, and parsing IPv6 addresses. What is lacking though is a
function that can take an IPv4 or IPv6 address, with or without a port.

This commit adds ipv46_parse(), which breaks the given input string into
its component parts and stores them in a sockaddr_storage structure. The
function accepts flags that determine how it should behave if a port is
present in the input string.

Signed-off-by: Mark Michelson 
---
 lib/packets.c | 78 +++
 lib/packets.h | 10 
 2 files changed, 88 insertions(+)

diff --git a/lib/packets.c b/lib/packets.c
index 74d87eda8..51044df4c 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -22,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "byte-order.h"
 #include "csum.h"
 #include "crc32c.h"
@@ -656,6 +658,82 @@ ip_parse_cidr(const char *s, ovs_be32 *ip, unsigned int 
*plen)
 return error;
 }
 
+/* Parses the string into an IPv4 or IPv6 address.
+ * The port flags act as follows:
+ * * PORT_OPTIONAL: A port may be present but is not required
+ * * PORT_REQUIRED: A port must be present
+ * * PORT_FORBIDDEN: A port must not be present
+ */
+char * OVS_WARN_UNUSED_RESULT
+ipv46_parse(const char *s, enum port_flags flags, struct sockaddr_storage *ss)
+{
+char *error = NULL;
+
+char *copy;
+copy = xstrdup(s);
+
+char *addr;
+char *port;
+if (*copy == '[') {
+char *end;
+
+addr = copy + 1;
+end = strchr(addr, ']');
+if (!end) {
+error = xasprintf("No closing bracket on address %s", s);
+goto finish;
+}
+*end++ = '\0';
+if (*end == ':') {
+port = end + 1;
+} else {
+port = NULL;
+}
+} else {
+addr = copy;
+port = strchr(copy, ':');
+if (port) {
+if (strchr(port + 1, ':')) {
+port = NULL;
+} else {
+*port++ = '\0';
+}
+}
+}
+
+if (port && !*port) {
+error = xasprintf("Port is an empty string");
+goto finish;
+}
+
+if (port && flags == PORT_FORBIDDEN) {
+error = xasprintf("Port forbidden in address %s", s);
+goto finish;
+} else if (!port && flags == PORT_REQUIRED) {
+error = xasprintf("Port required in address %s", s);
+goto finish;
+}
+
+struct addrinfo hints = {
+.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV,
+.ai_family = AF_UNSPEC,
+};
+struct addrinfo *res;
+int status;
+status = getaddrinfo(addr, port, , );
+if (status) {
+error = xasprintf("Error parsing address %s: %s",
+s, gai_strerror(status));
+goto finish;
+}
+memcpy(ss, res->ai_addr, res->ai_addrlen);
+freeaddrinfo(res);
+
+finish:
+free(copy);
+return error;
+}
+
 /* Parses string 's', which must be an IPv6 address.  Stores the IPv6 address
  * into '*ip'.  Returns true if successful, otherwise false. */
 bool
diff --git a/lib/packets.h b/lib/packets.h
index 057935cbf..c5915a0f8 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -1339,6 +1339,16 @@ struct in6_addr ipv6_create_mask(int mask);
 int ipv6_count_cidr_bits(const struct in6_addr *netmask);
 bool ipv6_is_cidr(const struct in6_addr *netmask);
 
+enum port_flags {
+PORT_OPTIONAL,
+PORT_REQUIRED,
+PORT_FORBIDDEN,
+};
+
+char *ipv46_parse(const char *s, enum port_flags flags,
+  struct sockaddr_storage *ss)
+OVS_WARN_UNUSED_RESULT;
+
 bool ipv6_parse(const char *s, struct in6_addr *ip);
 char *ipv6_parse_masked(const char *s, struct in6_addr *ipv6,
 struct in6_addr *mask);
-- 
2.13.5

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


Re: [ovs-dev] [PATCH] dpif-netlink-rtnl: Fix ovs_geneve probing after restart

2017-11-02 Thread William Tu
On Wed, Nov 1, 2017 at 8:29 AM, Eric Garver  wrote:
> On Mon, Oct 30, 2017 at 10:36:29AM -0700, William Tu wrote:
>> Thanks for the review.
>>
>> Guru and I had some offline discussion. We have concern about possible
>> packet lost when unconditionally remove the interface and bring it
>> again. Currently if the userspace ovs-vswitchd dies, since the kernel
>> datapath module still remains, packets can still go through.
>> If restarting ovs-vswitch restarts the geneve device, then we might
>> see more packets lost. So I'm thinking about another way to fix it
>> without deleting the device.
>
> You can use dpif_netlink_rtnl_getlink() if the device already exists.
> Then check IFLA_INFO_KIND == "ovs_geneve".
>
Thanks Eric,
I followed your suggestion and submit v2 here:
https://mail.openvswitch.org/pipermail/ovs-dev/2017-November/340357.html

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


Re: [ovs-dev] [PATCH 2/2] OVN: Add support for periodic router advertisements.

2017-11-02 Thread Mark Michelson
On Wed, Nov 1, 2017 at 4:38 PM Ben Pfaff  wrote:

> On Wed, Oct 18, 2017 at 11:53:49AM -0500, Mark Michelson wrote:
> > This change adds three new options to the Northbound
> > Logical_Router_Port's ipv6_ra_configs option:
> >
> > * send_periodic: If set to "true", then OVN will send periodic router
> > advertisements out of this router port.
> > * max_interval: The maximum amount of time to wait between sending
> > periodic router advertisements.
> > * min_interval: The minimum amount of time to wait between sending
> > periodic router advertisements.
> >
> > When send_periodic is true, then IPv6 RA configs, as well as some layer
> > 2 and layer 3 information about the router port, are copied to the
> > southbound database. From there, ovn-controller can use this information
> > to know when to send periodic RAs and what to send in them.
> >
> > Because periodic RAs originate from each ovn-controller, the new
> > keep-local flag is set on the packet so that ports don't receive an
> > overabundance of RAs.
> >
> > Signed-off-by: Mark Michelson 
>
> Thanks a lot for working on this.  It addresses a feature we've been
> missing for a long time.
>
> I get several application failures:
>
>Applying: OVN: Add support for periodic router advertisements.
>error: patch failed: ovn/controller/pinctrl.c:88
>error: ovn/controller/pinctrl.c: patch does not apply
>error: patch failed: ovn/northd/ovn-northd.c:4375
>error: ovn/northd/ovn-northd.c: patch does not apply
>error: patch failed: ovn/ovn-nb.xml:1369
>error: ovn/ovn-nb.xml: patch does not apply
>Patch failed at 0001 OVN: Add support for periodic router
> advertisements.
>
> Would you mind rebasing and reposting?  Thanks a lot.
>

Thanks for having a look Ben.

I'm not sure if you saw, but in the cover letter for this patchset, I
mentioned that it was dependent on Numan Siddique's patchset that adds
support for responses to router solicitations, etc (I provided the series
ID from patchwork). If that patchset was not applied before this one, then
there would be lots of errors when attempting to patch, and even more when
attempting to compile.

That being said, I will need to rebase and repost again anyway, because
Numan's patchset has been updated and reposted today. I also need to make
the manpage adjustments that you suggested for patch 1. I'll get that done
as soon as I can.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to include/openvswitch

2017-11-02 Thread Alin Serdean


> -Original Message-
> From: Xiao Liang [mailto:shaw.l...@gmail.com]
> Sent: Thursday, November 2, 2017 4:32 AM
> To: Alin Serdean 
> Cc: Ben Pfaff ; d...@openvswitch.org
> Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
> include/openvswitch
> 
> On Thu, Nov 2, 2017 at 5:51 AM, Alin Serdean
>  wrote:
> >
> >
> >> -Original Message-
> >> From: Ben Pfaff [mailto:b...@ovn.org]
> >> Sent: Tuesday, October 31, 2017 9:34 PM
> >> To: Xiao Liang ; Alin Serdean
> >> 
> >> Cc: d...@openvswitch.org
> >> Subject: Re: [ovs-dev] [PATCH 2/2] lib: Move lib/poll-loop.h to
> >> include/openvswitch
> >>
> >> On Thu, Aug 17, 2017 at 12:06:25AM +0800, Xiao Liang wrote:
> >> > Poll-loop is the core to implement main loop. It should be
> >> > available in libopenvswitch.
> >> >
> >> > Signed-off-by: Xiao Liang 
> >>
> >> I'm concerned about the way that this adds a definition of HANDLE in
> >> a public header.  That seems unfriendly to code that might want to
> >> include both this header and Win32 headers that properly define HANDLE.
> >>
> >> Alin, what's the right thing to do here?
> > [Alin Serdean] First the type definition is wrong (HANDLE is VOID*).
> > I would avoid adding the definition to HANDLE. Maybe add an include to
>  or  to include/windows/poll.h .
> 
> Since include/windows is not installed as public header, is it safe to remove
> inclusion of poll.h and add windows.h in poll-loop.h?
That sounds reasonable to me. Ben do you agree?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH net-next v15] openvswitch: enable NSH support

2017-11-02 Thread Yang, Yi
On Thu, Nov 02, 2017 at 05:06:47AM -0700, Pravin Shelar wrote:
> On Wed, Nov 1, 2017 at 7:50 PM, Yang, Yi  wrote:
> > On Thu, Nov 02, 2017 at 08:52:40AM +0800, Pravin Shelar wrote:
> >> On Tue, Oct 31, 2017 at 9:03 PM, Yi Yang  wrote:
> >> >
> >> > OVS master and 2.8 branch has merged NSH userspace
> >> > patch series, this patch is to enable NSH support
> >> > in kernel data path in order that OVS can support
> >> > NSH in compat mode by porting this.
> >> >
> >> > Signed-off-by: Yi Yang 
> >> > ---
> >> I have comment related to checksum, otherwise patch looks good to me.
> >
> > Pravin, thank you for your comments, the below part is incremental patch
> > for checksum, please help check it, I'll send out v16 with this after
> > you confirm.
> >
> This change looks good to me.
> I noticed couple of more issues.
> 1. Can you move the ovs_key_nsh to the union of ipv4 an ipv6?
> ipv4/ipv6/nsh key data is mutually exclusive so there is no need for
> separate space for nsh key in the ovs key.
> 2. We need to fix match_validate() with nsh check. Datapath can not
> allow any l3 or l4 match if the flow key contains nsh match and
> vice-versa. such flow key should be rejected.

Ok, I'll fix them ASAP.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH net-next v15] openvswitch: enable NSH support

2017-11-02 Thread Pravin Shelar
On Wed, Nov 1, 2017 at 7:50 PM, Yang, Yi  wrote:
> On Thu, Nov 02, 2017 at 08:52:40AM +0800, Pravin Shelar wrote:
>> On Tue, Oct 31, 2017 at 9:03 PM, Yi Yang  wrote:
>> >
>> > OVS master and 2.8 branch has merged NSH userspace
>> > patch series, this patch is to enable NSH support
>> > in kernel data path in order that OVS can support
>> > NSH in compat mode by porting this.
>> >
>> > Signed-off-by: Yi Yang 
>> > ---
>> I have comment related to checksum, otherwise patch looks good to me.
>
> Pravin, thank you for your comments, the below part is incremental patch
> for checksum, please help check it, I'll send out v16 with this after
> you confirm.
>
This change looks good to me.
I noticed couple of more issues.
1. Can you move the ovs_key_nsh to the union of ipv4 an ipv6?
ipv4/ipv6/nsh key data is mutually exclusive so there is no need for
separate space for nsh key in the ovs key.
2. We need to fix match_validate() with nsh check. Datapath can not
allow any l3 or l4 match if the flow key contains nsh match and
vice-versa. such flow key should be rejected.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] ovn-ctl: Provide the option to detach the OVN db servers or not when starting

2017-11-02 Thread nusiddiq
From: Numan Siddique 

Presently if the user wants to start OVN db servers as separate containers, 
'ovn-ctl'
script is not useful as '--detach' option is passed when ovsdb-servers are 
started.
If the container command is 'ovn-ctl start_nb_ovsdb', the  container exits as 
soon as
ovn-ctl exits.

This patch adds 2 new options to the 'ovn-ctl' script - '--db-nb-detach' and
'--db-sb-detach' which can take 'yes/no'. This will be really useful for the 
above
mentioned requirement. The user can start NB ovsdb-server with the command
'ovn-ctl start_nb_ovsdb --db-nb-detach=no'.

Without this option, the user may have to first generate the db by running 
'ovsdb-tool'
and then start the container with the command 'ovsdb-server ovnnb_db.db ' 
and this
is very inconvenient. This option will be useful only if the OVN db servers are 
started
in separate containers.

This patch also updates the missing documentation in ovn-ctl.8.xml.

Signed-off-by: Numan Siddique 
---
 ovn/utilities/ovn-ctl   | 15 +--
 ovn/utilities/ovn-ctl.8.xml |  9 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
index 3e247a1c6..8261b82c7 100755
--- a/ovn/utilities/ovn-ctl
+++ b/ovn/utilities/ovn-ctl
@@ -100,7 +100,10 @@ start_nb_ovsdb() {
 
 set ovsdb-server
 
-set "$@" --detach --monitor
+if test X"$DB_NB_DETACH" = Xyes; then
+set "$@" --detach --monitor
+fi
+
 set "$@" $OVN_NB_LOG --log-file=$OVN_NB_LOGFILE
 set "$@" --remote=punix:$DB_NB_SOCK --pidfile=$DB_NB_PID
 set "$@" --remote=db:OVN_Northbound,NB_Global,connections
@@ -135,7 +138,10 @@ start_sb_ovsdb() {
 
 set ovsdb-server
 
-set "$@" --detach --monitor
+if test X"$DB_SB_DETACH" = Xyes; then
+set "$@" --detach --monitor
+fi
+
 set "$@" $OVN_SB_LOG --log-file=$OVN_SB_LOGFILE
 set "$@" --remote=punix:$DB_SB_SOCK --pidfile=$DB_SB_PID
 set "$@" --remote=db:OVN_Southbound,SB_Global,connections
@@ -383,6 +389,9 @@ set_defaults () {
 DB_NB_CREATE_INSECURE_REMOTE="no"
 
 MONITOR="yes"
+
+DB_NB_DETACH="yes"
+DB_SB_DETACH="yes"
 }
 
 set_option () {
@@ -469,6 +478,8 @@ File location options:
   --db-sb-sync-from-port=ADDR OVN Southbound active db tcp port (default: 
$DB_SB_SYNC_FROM_PORT)
   --db-sb-sync-from-proto=PROTO OVN Southbound active db transport (default: 
$DB_SB_SYNC_FROM_PROTO)
   --db-sb-create-insecure-remote=yes|no Create ptcp OVN Southbound remote 
(default: $DB_SB_CREATE_INSECURE_REMOTE)
+  --db-nb-detach=yes|no OVN_Northbound detach server (default: $DB_NB_DETACH)
+  --db-sb-detach=yes|no OVN_Southbound detach server (default: $DB_SB_DETACH)
 
 Default directories with "configure" option and environment variable override:
   logs: /usr/local/var/log/openvswitch (--with-logdir, OVS_LOGDIR)
diff --git a/ovn/utilities/ovn-ctl.8.xml b/ovn/utilities/ovn-ctl.8.xml
index 7b090aee4..457475c19 100644
--- a/ovn/utilities/ovn-ctl.8.xml
+++ b/ovn/utilities/ovn-ctl.8.xml
@@ -28,6 +28,13 @@
   demote_ovnsb
   status_ovnnb
   status_ovnsb
+  start_ovsdb
+  start_nb_ovsdb
+  start_sb_ovsdb
+  stop_ovsdb
+  stop_nb_ovsdb
+  stop_sb_ovsdb
+  restart_ovsdb
 
 
 Options
@@ -35,6 +42,8 @@
 --ovn-northd-wrapper=WRAPPER
 --ovn-controller-priority=NICE
 --ovn-controller-wrapper=WRAPPER
+--db-nb-detach=yes|no
+--db-sb-detach=yes|no
 -h | --help
 
 File location options
-- 
2.13.5

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


[ovs-dev] Your first payment of $7.000.00 From Money Gram.

2017-11-02 Thread Rose Amadi
Attn Pls.

Your compensation payment sum of $4,700,000.00 usd has been released
from Ministry Of Finance Benin Republic. We are hereby to let you know
that the first payment of $7000 per day with the Reference: through
Money Gram have been transferred to your Name for you to pick up but
you have to renew it before you can pick up the $7000. Contact now so
that we can give you the Receivers name also to renew your account in
our Money Gram Centeral system to enable you collect the $7000 within
45 minutes.

Contact information:
(DR)JAMES OTI
DIRECTOR MONEY GRAM

Respond as soon as you receive this message.
Regard
Mrs.Rose Amadi
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] BUSINESS OPPORTUNITY

2017-11-02 Thread Peter Alexandra
Hello

I am Mr. Peter Alexandra, representing the operation and corporate
affairs in contract related matters of Exxon Mobil in London
(http://www.exxonmobil.com).  Exxon Mobil is one of the World Largest
oil producing and Management Company with over 1.2 Trillion pounds
Capital contract Investment.

As a senior operational and corporate affairs representative of Exxon
Mobil that handle contract related matters, I successfully over
invoiced a contract few years back which is not known by anybody and,
I need your full cooperation and partnership to re-profile this
contract funds amounting to US$12.2M to your name as the contractor
that executed this contract in Asia few years.

The fund will be paid to you through a Finance Company where it is
presently deposited as soon as the filing and documentation process is
concluded in your name because the contract was executed by Exxon
Mobil United Kingdom in Asia.

Most importantly, you will be required to fill your data's stated
below to enable me arrange legal documents that will proof you as a
sole contractor with EXXON MOBIL:

(1). Stand as the beneficiary / contractor with Exxon Mobil to receive
the funds as I will present you before the firm with legal documents.

(2). Receive the funds into a business/personal bank account in your country.

(3). At the completion of this transaction, the sharing rates shall be
60% for me, 40% for you.

(4) Full Names;
(5) Contact Address:
(6) Direct Telephone No:
(7) Occupation:
(8) Age and Marital Status:
(9) Means of Identification:

Note: Do not contact my office number or company email for security
reasons. Get back to me as soon as possible For more details about the
funds.

Best Regards.
Mr. Peter Alexandra,
Operation and Corporate Affairs Officer
ExxonMobil London
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v4 2/2] netdev-dpdk: Enable optional dequeue zero copy for vHost User

2017-11-02 Thread Ciara Loftus
Enabled per port like so:
ovs-vsctl set Interface dpdkvhostuserclient0 options:dq-zero-copy=true

The feature is disabled by default and can only be enabled/disabled when
a vHost port is down.

When packets from a vHost device with zero copy enabled are destined for
a 'dpdk' port, the number of tx descriptors on that 'dpdk' port must be
set to a smaller value. 128 is recommended. This can be achieved like
so:

ovs-vsctl set Interface dpdkport options:n_txq_desc=128

Signed-off-by: Ciara Loftus 
---
v4:
* Rebase

 Documentation/howto/dpdk.rst | 33 
 Documentation/topics/dpdk/vhost-user.rst | 58 +
 NEWS |  3 ++
 lib/netdev-dpdk.c| 89 +++-
 vswitchd/vswitch.xml | 11 
 5 files changed, 193 insertions(+), 1 deletion(-)

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index d123819..3e1b8f8 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -709,3 +709,36 @@ devices to bridge ``br0``. Once complete, follow the below 
steps:
Check traffic on multiple queues::
 
$ cat /proc/interrupts | grep virtio
+
+PHY-VM-PHY (vHost Dequeue Zero Copy)
+
+
+vHost dequeue zero copy functionality can  be validated using the
+PHY-VM-PHY configuration. To begin, follow the steps described in
+:ref:`dpdk-phy-phy` to create and initialize the database, start
+ovs-vswitchd and add ``dpdk``-type and ``dpdkvhostuser``-type devices
+and flows to bridge ``br0``. Once complete, follow the below steps:
+
+1. Enable dequeue zero copy on the vHost devices.
+
+   $ ovs-vsctl set Interface dpdkvhostuser0 options:dq-zero-copy=true
+   $ ovs-vsctl set Interface dpdkvhostuser1 options:dq-zero-copy=true
+
+The following log should be observed for each device:
+
+   netdev_dpdk|INFO|Zero copy enabled for vHost socket 
+
+2. Reduce the number of txq descriptors on the phy ports.
+
+   $ ovs-vsctl set Interface phy0 options:n_txq_desc=128
+   $ ovs-vsctl set Interface phy1 options:n_txq_desc=128
+
+3. Proceed with the test by launching the VM and configuring guest
+forwarding, be it via the vHost loopback method or kernel forwarding
+method, and sending traffic. The following log should be oberved for
+each device as it becomes active during VM boot:
+
+   VHOST_CONFIG: dequeue zero copy is enabled
+
+It is essential that step 1 is performed before booting the VM, otherwise
+the feature will not be enabled.
diff --git a/Documentation/topics/dpdk/vhost-user.rst 
b/Documentation/topics/dpdk/vhost-user.rst
index 74ac06e..2636d5a 100644
--- a/Documentation/topics/dpdk/vhost-user.rst
+++ b/Documentation/topics/dpdk/vhost-user.rst
@@ -408,3 +408,61 @@ Sample XML
 
 
 .. _QEMU documentation: 
http://git.qemu-project.org/?p=qemu.git;a=blob;f=docs/specs/vhost-user.txt;h=7890d7169;hb=HEAD
+
+vhost-user Dequeue Zero Copy
+-
+
+Normally when dequeuing a packet from a vHost User device, a memcpy operation
+must be used to copy that packet from guest address space to host address
+space. This memcpy can be removed by enabling dequeue zero-copy like so:
+
+$ ovs-vsctl set Interface dpdkvhostuserclient0 options:dq-zero-copy=true
+
+With this feature enabled, a reference (pointer) to the packet is passed to
+the host, instead of a copy of the packet. Removing this memcpy can give a
+performance improvement for some use cases, for example switching large packets
+between different VMs.
+
+Note that the feature is disabled by default and must be explicitly enabled
+by using the command above.
+
+The feature cannot be enabled when the device is active (ie. VM booted). If
+you wish to enable the feature after the VM has booted, you must shutdown
+the VM and bring it back up.
+
+The same logic applies for disabling the feature - it must be disabled when
+the device is inactive, for example before VM boot. To disable the feature:
+
+$ ovs-vsctl set Interface dpdkvhostuserclient0 options:dq-zero-copy=false
+
+The feature is available to both dpdkvhostuser and dpdkvhostuserclient port
+types.
+
+A limitation exists whereby if packets from a vHost port with dq-zero-copy=true
+are destined for a 'dpdk' type port, the number of tx descriptors (n_txq_desc)
+for that port must be reduced to a smaller number, 128 being the recommended
+value. This can be achieved by issuing the following command:
+
+$ ovs-vsctl set Interface dpdkport options:n_txq_desc=128
+
+More information on the n_txq_desc option can be found in the "DPDK Physical
+Port Queue Sizes" section of the  `intro/install/dpdk.rst` guide.
+
+The reason for this limitation is due to how the zero copy functionality is
+implemented. The vHost device's 'tx used vring', a virtio structure used for
+tracking used ie. sent descriptors, will only be updated when the NIC frees

[ovs-dev] [PATCH v4 1/2] netdev-dpdk: Helper function for vHost device setup

2017-11-02 Thread Ciara Loftus
dpdkvhostuser and dpdkvhostuserclient ports share a lot of the same
setup & configuration code. Create a common function they can share in
order to remove some duplication of code.

Signed-off-by: Ciara Loftus 
---
 lib/netdev-dpdk.c | 113 +-
 1 file changed, 52 insertions(+), 61 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 1e9d78f..4643f6f 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -991,35 +991,27 @@ vhost_common_construct(struct netdev *netdev)
 }
 
 static int
-netdev_dpdk_vhost_construct(struct netdev *netdev)
+dpdk_setup_vhost_device(struct netdev_dpdk *dev, bool client_mode)
 {
-struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
-const char *name = netdev->name;
-int err;
+const char *name = dev->up.name;
+uint64_t flags = dev->vhost_driver_flags;
+int err = 0;
 
-/* 'name' is appended to 'vhost_sock_dir' and used to create a socket in
- * the file system. '/' or '\' would traverse directories, so they're not
- * acceptable in 'name'. */
-if (strchr(name, '/') || strchr(name, '\\')) {
-VLOG_ERR("\"%s\" is not a valid name for a vhost-user port. "
- "A valid name must not include '/' or '\\'",
- name);
-return EINVAL;
+if (client_mode) {
+flags |= RTE_VHOST_USER_CLIENT;
 }
 
-ovs_mutex_lock(_mutex);
-/* Take the name of the vhost-user port and append it to the location where
- * the socket is to be created, then register the socket.
- */
-snprintf(dev->vhost_id, sizeof dev->vhost_id, "%s/%s",
- dpdk_get_vhost_sock_dir(), name);
-
-dev->vhost_driver_flags &= ~RTE_VHOST_USER_CLIENT;
-err = rte_vhost_driver_register(dev->vhost_id, dev->vhost_driver_flags);
+err = rte_vhost_driver_register(dev->vhost_id, flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
  dev->vhost_id);
-goto out;
+return err;
+} else if (client_mode) {
+/* Configuration successful */
+dev->vhost_driver_flags |= RTE_VHOST_USER_CLIENT;
+VLOG_INFO("vHost User device '%s' created in 'client' mode, "
+  "using client socket '%s'",
+  name, dev->vhost_id);
 } else {
 fatal_signal_add_file_to_unlink(dev->vhost_id);
 VLOG_INFO("Socket %s created for vhost-user port %s\n",
@@ -1027,11 +1019,11 @@ netdev_dpdk_vhost_construct(struct netdev *netdev)
 }
 
 err = rte_vhost_driver_callback_register(dev->vhost_id,
-_net_device_ops);
+ _net_device_ops);
 if (err) {
 VLOG_ERR("rte_vhost_driver_callback_register failed for vhost user "
  "port: %s\n", name);
-goto out;
+return err;
 }
 
 err = rte_vhost_driver_disable_features(dev->vhost_id,
@@ -1041,13 +1033,46 @@ netdev_dpdk_vhost_construct(struct netdev *netdev)
 if (err) {
 VLOG_ERR("rte_vhost_driver_disable_features failed for vhost user "
  "port: %s\n", name);
-goto out;
+return err;
 }
 
 err = rte_vhost_driver_start(dev->vhost_id);
 if (err) {
 VLOG_ERR("rte_vhost_driver_start failed for vhost user "
- "port: %s\n", name);
+"port: %s\n", name);
+return err;
+}
+
+return err;
+}
+
+static int
+netdev_dpdk_vhost_construct(struct netdev *netdev)
+{
+struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+const char *name = netdev->name;
+int err;
+
+/* 'name' is appended to 'vhost_sock_dir' and used to create a socket in
+ * the file system. '/' or '\' would traverse directories, so they're not
+ * acceptable in 'name'. */
+if (strchr(name, '/') || strchr(name, '\\')) {
+VLOG_ERR("\"%s\" is not a valid name for a vhost-user port. "
+ "A valid name must not include '/' or '\\'",
+ name);
+return EINVAL;
+}
+
+ovs_mutex_lock(_mutex);
+/* Take the name of the vhost-user port and append it to the location where
+ * the socket is to be created, then register the socket.
+ */
+snprintf(dev->vhost_id, sizeof dev->vhost_id, "%s/%s",
+ dpdk_get_vhost_sock_dir(), name);
+
+dev->vhost_driver_flags &= ~RTE_VHOST_USER_CLIENT;
+err = dpdk_setup_vhost_device(dev, false);
+if (err) {
 goto out;
 }
 
@@ -3316,42 +3341,8 @@ netdev_dpdk_vhost_client_reconfigure(struct netdev 
*netdev)
 if (!(dev->vhost_driver_flags & RTE_VHOST_USER_CLIENT)
 && strlen(dev->vhost_id)) {
 /* Register client-mode device */
-err = rte_vhost_driver_register(dev->vhost_id,
-RTE_VHOST_USER_CLIENT);
-if (err) {
-

[ovs-dev] [PATCH v4 0/2] vHost Dequeue Zero Copy

2017-11-02 Thread Ciara Loftus
This patch enables optional dequeue zero copy for vHost ports.
This gives a performance increase for some use cases. I'm using
the cover letter to report my results.

vhost (vm1) -> vhost (vm2)
Using testpmd to source (txonly) in vm1 and sink (rxonly) in vm2.
4C1Q 64B packets: 5.05Mpps -> 5.52Mpps = 9.2% improvement
256B:4.69 vs 5.42 Mpps (+~16%)
512B:4.04 vs 4.90 Mpps (+~21%)
1518B:2.51 vs 3.05 Mpps (+~22%)

vhost (virtio_user backend 1) -> vhost (virtio_user backend 2)
Using 2 instances of testpmd, each with a virtio_user backend
connected to one of the two vhost ports created in OVS.
2C1Q 1518B packets: 2.59Mpps -> 3.09Mpps = 19.3% improvement

vhost -> phy
Using testpmd to source (txonly) and sink in the NIC
1C1Q 64B packets: 6.81Mpps -> 7.76Mpps = 13.9% improvement

phy -> vhost -> phy
No improvement measured

v4:
* Rebase

v3:
* Documentation updates:
** Style fixes
** Elaborate on expected logs
** Describe how to disable the feature
** Describe NIC descriptors limitation in more detail

v2 changes:
* Mention feature is disabled by default in the documentation
* Add PHY-VM-PHY with vHost dequeue zero copy documentation guide
* Line wrap link to DPDK documentation
* Rename zc_enabled to dq_zc_enabled for future-proofing
* Mention feature is available for both vHost port types in the docs
* In practise, rebooting the VM doesn't always enable the feature if
enabled post-boot, so update the documentation to suggest a shutdown
rather than a reboot. The reason why this doesn't work is probably
because the total downtime during reboot isn't enough to allow a vhost
device unregister & re-register with the new feature, so when the VM
starts again it doesn't pick up the new device as it hasn't been
re-registered in time.

Ciara Loftus (2):
  netdev-dpdk: Helper function for vHost device setup
  netdev-dpdk: Enable optional dequeue zero copy for vHost User

 Documentation/howto/dpdk.rst |  33 +
 Documentation/topics/dpdk/vhost-user.rst |  58 +
 NEWS |   3 +
 lib/netdev-dpdk.c| 202 +--
 vswitchd/vswitch.xml |  11 ++
 5 files changed, 245 insertions(+), 62 deletions(-)

-- 
2.7.5

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