Re: [ovs-dev] [PATCHv5] DNS: Add basic support for asynchronous DNS resolving

2018-07-06 Thread Ben Pfaff
On Tue, Jun 26, 2018 at 02:06:21PM -0700, Yifeng Sun wrote:
> This patch is a simple implementation for the proposal discussed in   
>   
> https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337038.html and
>   
> https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/340013.html.  
>   
>   
>   
> It enables ovs-vswitchd and other utilities to use DNS names when specifying  
>  
> OpenFlow and OVSDB remotes.   
>   

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


Re: [ovs-dev] [PATCHv5] DNS: Add basic support for asynchronous DNS resolving

2018-06-27 Thread Yifeng Sun
Hi Shashank,

libunbound also supports windows. I think this is one of reasons we
selected libunbound.

Best,
Yifeng

On Tue, Jun 26, 2018 at 7:27 PM, Shashank Ram  wrote:

>
>
> On Tue, Jun 26, 2018 at 7:08 PM Yifeng Sun  wrote:
>
>> This patch is a simple implementation for the proposal discussed in
>>
>> https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337038.html
>> and
>> https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/340013.html.
>>
>>
>> It enables ovs-vswitchd and other utilities to use DNS names when
>> specifying
>> OpenFlow and OVSDB remotes.
>>
>>
>> Below are some of the features and limitations of this patch:
>>
>> - Resolving is asynchornous in daemon context, avoiding blocking main
>> loop;
>> - Resolving is synchronous in general utility context;
>>
>> - Both IPv4 and IPv6 are supported;
>>
>> - The resolving API is thread-safe;
>>
>> - Depends on the unbound library;
>>
>> - When multiple ip addresses are returned, only the first one is
>> used;
>> - /etc/nsswitch.conf isn't respected as unbound library doesn't look
>> at it;
>> - For async-resolving, caller need to retry later; there is no
>> callback.
>>
>> Signed-off-by: Yifeng Sun 
>> ---
>>
>
> Could you consider using the asynchronous DnsQuerEx() API for Windows?
> https://docs.microsoft.com/en-us/windows/desktop/api/windns/
> nf-windns-dnsqueryex
>
> Thanks,
> Shashank
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv5] DNS: Add basic support for asynchronous DNS resolving

2018-06-26 Thread Shashank Ram
On Tue, Jun 26, 2018 at 7:08 PM Yifeng Sun  wrote:

> This patch is a simple implementation for the proposal discussed in
>
> https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337038.html
> and
> https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/340013.html.
>
>
> It enables ovs-vswitchd and other utilities to use DNS names when
> specifying
> OpenFlow and OVSDB remotes.
>
>
> Below are some of the features and limitations of this patch:
>
> - Resolving is asynchornous in daemon context, avoiding blocking main
> loop;
> - Resolving is synchronous in general utility context;
>
> - Both IPv4 and IPv6 are supported;
>
> - The resolving API is thread-safe;
>
> - Depends on the unbound library;
>
> - When multiple ip addresses are returned, only the first one is
> used;
> - /etc/nsswitch.conf isn't respected as unbound library doesn't look
> at it;
> - For async-resolving, caller need to retry later; there is no
> callback.
>
> Signed-off-by: Yifeng Sun 
> ---
>

Could you consider using the asynchronous DnsQuerEx() API for Windows?
https://docs.microsoft.com/en-us/windows/desktop/api/windns/nf-windns-dnsqueryex

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


[ovs-dev] [PATCHv5] DNS: Add basic support for asynchronous DNS resolving

2018-06-26 Thread Yifeng Sun
This patch is a simple implementation for the proposal discussed in 
https://mail.openvswitch.org/pipermail/ovs-dev/2017-August/337038.html and  
https://mail.openvswitch.org/pipermail/ovs-dev/2017-October/340013.html.

It enables ovs-vswitchd and other utilities to use DNS names when specifying
   
OpenFlow and OVSDB remotes. 

Below are some of the features and limitations of this patch:   
- Resolving is asynchornous in daemon context, avoiding blocking main loop; 
  
- Resolving is synchronous in general utility context;  
- Both IPv4 and IPv6 are supported; 
- The resolving API is thread-safe; 
- Depends on the unbound library;   
- When multiple ip addresses are returned, only the first one is used;  
- /etc/nsswitch.conf isn't respected as unbound library doesn't look at it; 
- For async-resolving, caller need to retry later; there is no callback.


Signed-off-by: Yifeng Sun 
---
v1 -> v2: Refactored and improved code based on reviewer's comments.
v2 -> v3: Added commit message. 
  
v3 -> v4: Added synchronous resolving for utilities.
  Made fixes and documented changes based on reviewer's comments.
v4 -> v5: Fixed documentation to explicitly mention unbound library at places
  where DNS name can be used.
  Updated travis files, and actual travis run passed.
  Fixed an issue related with resolution time and TTL, as pointed out
  by Ben.
  Added unbound dependancy in rhel specs, and yum-builddep running
  shows no issue.
  Added unbound dependancy for debian config, and dpkg-buildpackage
  running shows no issue.

 .travis.yml   |   2 +
 Documentation/intro/install/general.rst   |   4 +
 Documentation/ref/ovsdb.7.rst |  14 +-
 NEWS  |   5 +
 configure.ac  |   1 +
 debian/control|   4 +-
 lib/automake.mk   |   7 +
 lib/dns-resolve-stub.c|  36 +++
 lib/dns-resolve.c | 310 ++
 lib/dns-resolve.h |  26 +++
 lib/socket-util.c |  48 +++-
 lib/stream.c  |   8 +-
 lib/vconn-active.man  |  14 +-
 lib/vconn-passive.man |  10 +-
 lib/vconn.c   |   8 +-
 m4/openvswitch.m4 |  10 +
 ovn/controller-vtep/ovn-controller-vtep.8.xml |  28 +--
 ovn/ovn-nb.xml|  47 ++--
 ovn/ovn-sb.xml|  51 +++--
 python/ovs/stream.py  |   4 +-
 rhel/openvswitch-fedora.spec.in   |   3 +-
 rhel/openvswitch.spec.in  |   1 +
 vswitchd/ovs-vswitchd.c   |   3 +
 vswitchd/vswitch.xml  |  94 
 vtep/vtep.xml |  34 +--
 25 files changed, 607 insertions(+), 165 deletions(-)
 create mode 100644 lib/dns-resolve-stub.c
 create mode 100644 lib/dns-resolve.c
 create mode 100644 lib/dns-resolve.h

diff --git a/.travis.yml b/.travis.yml
index ff2fa2e4810c..4d7bbd857306 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,6 +19,8 @@ addons:
   - python-sphinx
   - libelf-dev
   - selinux-policy-dev
+  - libunbound-dev
+  - libunbound-dev:i386
 
 before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
 
diff --git a/Documentation/intro/install/general.rst 
b/Documentation/intro/install/general.rst
index 474c9e861572..fe30c19ad57d 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -93,6 +93,10 @@ need the following software:
 - Python 2.7. You must also have the Python ``six`` library version 1.4.0
   or later.
 
+- Unbound library, from http://www.unbound.net, is optional but recommended if
+  you want to enable ovs-vswitchd and other utilities to use DNS names when
+  specifying OpenFlow and OVSDB remotes. If unbound library is already
+  installed, then Open vSwitch will automatically build with support for it.
 
 On Linux, you may choose to compile the kernel module that comes with the Open
 vSwitch distribution or to use the kernel module built into the Linux kernel
diff --git a/Documentat