Re: [naviserver-devel] IPv6 for NaviServer

2016-02-26 Thread Gustaf Neumann

Great,

this means, we do not have to "emulate" it - as done in previous versions.
I've done some more cleanup for MSVC and activated IPV6 per default
(everything untested)

-g
[1] 
https://bitbucket.org/naviserver/naviserver/commits/432a251c4e8ee567327b1228cee8e25a726af5bc



Am 25.02.16 um 18:04 schrieb Maurizio Martignano:


Dear Gustaf,

Thank you for your inputs.

I implemented all your changes but the system was still not working.

I had a careful look at it and eventually I found the cause (at least 
in my configuration):


The problem in caused by the function inet_ntop in nswin32.c. After 
removing it, everything works fine.


The system seems now OK to me.

Thank you,

Maurizio

*From:*Gustaf Neumann [mailto:neum...@wu.ac.at]
*Sent:* 25 February 2016 12:33
*To:* naviserver-devel@lists.sourceforge.net
*Subject:* Re: [naviserver-devel] IPv6 for NaviServer

Hi Maurizio,

thanks for the fixes. as such, they could not work, but they point
out things, where one has to watch out. I have fixed these
things in a way it could work under windows.

By looking at the differences, it seems as if you compiled just a
IPv4 version (no IPv6 enabled). i would have expected this
to go more smoothly. In case you tried the sample
nsd-config.tcl script, that could not work with IPv4, since
IPv6 addresses were hard-coded.

all the best
-g

Am 24.02.16 um 18:00 schrieb Maurizio Martignano:

Dear Gustaf,

   Thank you as always for all your work.

About Windows I cannot really talk about MinGW nor Cygwin. I'm just using

Visual Studio 2015 with 64 bit as target.

With this configuration I tried to modify the file sockaddr.c (to make it

compile), but I'm not sure about the changes I made.

I also had to modify the file nswin32.c as I could not find anywhere the

function "NsSockGetPort".

Well the resulting system compiles... but nothing works.

I need much more time to do a proper testing/tuning and I can't do that at

the moment.

As soon as I discover more, I'll let you know.

Back to your delivery of the 16th of February.

Once again thank you,

Maurizio

-Original Message-

From: Gustaf Neumann [mailto:neum...@wu.ac.at]

Sent: 24 February 2016 14:01

To: Navidevel<naviserver-devel@lists.sourceforge.net>
<mailto:naviserver-devel@lists.sourceforge.net>

Subject: [naviserver-devel] IPv6 for NaviServer

Dear all,

over the last week, i've worked on IPv6 support for NaviServer.

For this task, i took the following path:

1) build a version of NaviServer for IPv6

2) build a single code source for compiling either for IPv4 or IPv6

3) let the IPv6 version run the setup-files for IPv4 in the IPv6 version

4) Run regression test suite under IPv4 and/IPv6

5) Allow mixed mode (handle IPv4 and IPv6 by the same binary)

 (requires some interface changes to handle generic sockaddrs)

Everything seems to work fine, one can work with the same config files as

before, and everything works as expected, but one can as well listen on IPv6

addresses (e.g.

the IPv6 unspecified address "::"). IPv4->6 mapping is activated, or the

kernel allows to deliver as well

IPv4 traffic to the IPv6 interface, then one can talk also multiple

protocols. The mileage may vary depending on the OS and kernel.

It is as well possible to deactivate IPv6 support at compile time via

--disable-ipv6.

Here is a summary of the necessary changes:

- Added a amall Abstraction API for IP-version agnostic calls:

Ns_LogSockaddr(), Ns_SockaddrGetPort(),

Ns_SockaddrGetSockLen(), Ns_SockaddrMask(), Ns_SockaddrMaskBits(),

Ns_SockaddrSetPort(), ns_inet_ntop(), ns_inet_pton()

- Replaced in interface more places where "sockaddr_in" (the IPv4

version of the sockaddr) with the generic (version agnostic)

sockaddr (also in IPv4 code to obtain API consistency when no IPv6

is available): Ns_BindSock(), Ns_ConnSetPeer(), Ns_GetSockAddr(),

Ns_SockBind(), Ns_SockBindUdp()

- The Ns_Sock structure contained sockaddr_in, which is not sufficient

to store IPv6 addresses. Therefore it was necessary to change

that to "sockaddr_storage" which guarantees to be large enough

to keep all kind of addresses. This affects as well driver modules

which communicate via the NaviServer managed sockets. Old drivers

might crash with the new structure. Therefore, I've bumped

NS_DRIVER_VERSION to 3 such that driver modules (also binaries)

can communicate that they support IPv6. In IPv6 mode, NaviServer

refuses to work with versions <3.

- Replaced all usages of ns_inet_ntoa() by ns_intet_ntop()

(except for legacy an minimal library support)

- Added log file warnings on various places, where Na

Re: [naviserver-devel] IPv6 for NaviServer

2016-02-25 Thread Maurizio Martignano
Dear all,

   To complement my previous message, I have observed that the
system compiled with HAVE_IPV4 works.

On the contrary, if compiled with HAVE_IPV6, still presents some few
problems.

So the Windows-OpenACS distribution will have at the moment Naviserver
compiled with HAVE_IPV4.

In the meantime and with no rush I will try to investigate the problems of
the HAVE_IPV6 version.

 

Thank you,

Maurizio

 

 

From: Maurizio Martignano [mailto:maurizio.martign...@spazioit.com] 
Sent: 25 February 2016 22:20
To: naviserver-devel@lists.sourceforge.net
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Dear all,

   This is a comment to my previous message.

 

Unfortunately, the compiled system is still not working properly. I need to
investigate more in details what the problems are.

 

In the mean time I put back in the Windows-OpenACS, the Naviserver commit of
the 24th of February, the one without IPV6 Support.

 

Thank you,

Maurizio

 

 

From: Maurizio Martignano [mailto:maurizio.martign...@spazioit.com] 
Sent: 25 February 2016 18:05
To: naviserver-devel@lists.sourceforge.net
<mailto:naviserver-devel@lists.sourceforge.net> 
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Dear Gustaf,

   Thank you for your inputs.

I implemented all your changes but the system was still not working.

I had a careful look at it and eventually I found the cause (at least in my
configuration):



The problem in caused by the function inet_ntop in nswin32.c. After removing
it, everything works fine.

The system seems now OK to me.

 

Thank you,

Maurizio

 

 

 

 

From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 25 February 2016 12:33
To: naviserver-devel@lists.sourceforge.net
<mailto:naviserver-devel@lists.sourceforge.net> 
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Hi Maurizio,

thanks for the fixes. as such, they could not work, but they point
out things, where one has to watch out. I have fixed these
things in a way it could work under windows.

By looking at the differences, it seems as if you compiled just a 
IPv4 version (no IPv6 enabled). i would have expected this
to go more smoothly. In case you tried the sample 
nsd-config.tcl script, that could not work with IPv4, since
IPv6 addresses were hard-coded.

all the best
-g

Am 24.02.16 um 18:00 schrieb Maurizio Martignano:

Dear Gustaf,
  Thank you as always for all your work.
 
About Windows I cannot really talk about MinGW nor Cygwin. I'm just using
Visual Studio 2015 with 64 bit as target.
With this configuration I tried to modify the file sockaddr.c (to make it
compile), but I'm not sure about the changes I made.
I also had to modify the file nswin32.c as I could not find anywhere the
function "NsSockGetPort".
Well the resulting system compiles... but nothing works.
I need much more time to do a proper testing/tuning and I can't do that at
the moment.
As soon as I discover more, I'll let you know.
 
Back to your delivery of the 16th of February.
 
Once again thank you,
Maurizio
 
 
-Original Message-
From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 24 February 2016 14:01
To: Navidevel  <mailto:naviserver-devel@lists.sourceforge.net>
<naviserver-devel@lists.sourceforge.net>
Subject: [naviserver-devel] IPv6 for NaviServer
 
Dear all,
 
over the last week, i've worked on IPv6 support for NaviServer.
For this task, i took the following path:
1) build a version of NaviServer for IPv6
2) build a single code source for compiling either for IPv4 or IPv6
3) let the IPv6 version run the setup-files for IPv4 in the IPv6 version
4) Run regression test suite under IPv4 and/IPv6
5) Allow mixed mode (handle IPv4 and IPv6 by the same binary)
(requires some interface changes to handle generic sockaddrs)
 
Everything seems to work fine, one can work with the same config files as
before, and everything works as expected, but one can as well listen on IPv6
addresses (e.g.
the IPv6 unspecified address "::"). IPv4->6 mapping is activated, or the
kernel allows to deliver as well
IPv4 traffic to the IPv6 interface, then one can talk also multiple
protocols. The mileage may vary depending on the OS and kernel.
 
It is as well possible to deactivate IPv6 support at compile time via
--disable-ipv6.
 
Here is a summary of the necessary changes:
- Added a amall Abstraction API for IP-version agnostic calls:
   Ns_LogSockaddr(), Ns_SockaddrGetPort(),
   Ns_SockaddrGetSockLen(), Ns_SockaddrMask(), Ns_SockaddrMaskBits(),
   Ns_SockaddrSetPort(), ns_inet_ntop(), ns_inet_pton()
 
- Replaced in interface more places where "sockaddr_in" (the IPv4
   version of the sockaddr) with the generic (version agnostic)
   sockaddr (also in IPv4 code to obtain API consistency when no IPv6
   is available): Ns_BindSock(), Ns_ConnSetPeer(), Ns_GetSockAddr(),
   Ns_SockBind(), Ns_SockBindUdp()
 
- The Ns_Sock structure contained sockaddr_in, whic

Re: [naviserver-devel] IPv6 for NaviServer

2016-02-25 Thread Maurizio Martignano
Dear all,

   This is a comment to my previous message.

 

Unfortunately, the compiled system is still not working properly. I need to
investigate more in details what the problems are.

 

In the mean time I put back in the Windows-OpenACS, the Naviserver commit of
the 24th of February, the one without IPV6 Support.

 

Thank you,

Maurizio

 

 

From: Maurizio Martignano [mailto:maurizio.martign...@spazioit.com] 
Sent: 25 February 2016 18:05
To: naviserver-devel@lists.sourceforge.net
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Dear Gustaf,

   Thank you for your inputs.

I implemented all your changes but the system was still not working.

I had a careful look at it and eventually I found the cause (at least in my
configuration):



The problem in caused by the function inet_ntop in nswin32.c. After removing
it, everything works fine.

The system seems now OK to me.

 

Thank you,

Maurizio

 

 

 

 

From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 25 February 2016 12:33
To: naviserver-devel@lists.sourceforge.net
<mailto:naviserver-devel@lists.sourceforge.net> 
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Hi Maurizio,

thanks for the fixes. as such, they could not work, but they point
out things, where one has to watch out. I have fixed these
things in a way it could work under windows.

By looking at the differences, it seems as if you compiled just a 
IPv4 version (no IPv6 enabled). i would have expected this
to go more smoothly. In case you tried the sample 
nsd-config.tcl script, that could not work with IPv4, since
IPv6 addresses were hard-coded.

all the best
-g

Am 24.02.16 um 18:00 schrieb Maurizio Martignano:

Dear Gustaf,
  Thank you as always for all your work.
 
About Windows I cannot really talk about MinGW nor Cygwin. I'm just using
Visual Studio 2015 with 64 bit as target.
With this configuration I tried to modify the file sockaddr.c (to make it
compile), but I'm not sure about the changes I made.
I also had to modify the file nswin32.c as I could not find anywhere the
function "NsSockGetPort".
Well the resulting system compiles... but nothing works.
I need much more time to do a proper testing/tuning and I can't do that at
the moment.
As soon as I discover more, I'll let you know.
 
Back to your delivery of the 16th of February.
 
Once again thank you,
Maurizio
 
 
-Original Message-
From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 24 February 2016 14:01
To: Navidevel  <mailto:naviserver-devel@lists.sourceforge.net>
<naviserver-devel@lists.sourceforge.net>
Subject: [naviserver-devel] IPv6 for NaviServer
 
Dear all,
 
over the last week, i've worked on IPv6 support for NaviServer.
For this task, i took the following path:
1) build a version of NaviServer for IPv6
2) build a single code source for compiling either for IPv4 or IPv6
3) let the IPv6 version run the setup-files for IPv4 in the IPv6 version
4) Run regression test suite under IPv4 and/IPv6
5) Allow mixed mode (handle IPv4 and IPv6 by the same binary)
(requires some interface changes to handle generic sockaddrs)
 
Everything seems to work fine, one can work with the same config files as
before, and everything works as expected, but one can as well listen on IPv6
addresses (e.g.
the IPv6 unspecified address "::"). IPv4->6 mapping is activated, or the
kernel allows to deliver as well
IPv4 traffic to the IPv6 interface, then one can talk also multiple
protocols. The mileage may vary depending on the OS and kernel.
 
It is as well possible to deactivate IPv6 support at compile time via
--disable-ipv6.
 
Here is a summary of the necessary changes:
- Added a amall Abstraction API for IP-version agnostic calls:
   Ns_LogSockaddr(), Ns_SockaddrGetPort(),
   Ns_SockaddrGetSockLen(), Ns_SockaddrMask(), Ns_SockaddrMaskBits(),
   Ns_SockaddrSetPort(), ns_inet_ntop(), ns_inet_pton()
 
- Replaced in interface more places where "sockaddr_in" (the IPv4
   version of the sockaddr) with the generic (version agnostic)
   sockaddr (also in IPv4 code to obtain API consistency when no IPv6
   is available): Ns_BindSock(), Ns_ConnSetPeer(), Ns_GetSockAddr(),
   Ns_SockBind(), Ns_SockBindUdp()
 
- The Ns_Sock structure contained sockaddr_in, which is not sufficient
   to store IPv6 addresses. Therefore it was necessary to change
   that to "sockaddr_storage" which guarantees to be large enough
   to keep all kind of addresses. This affects as well driver modules
   which communicate via the NaviServer managed sockets. Old drivers
   might crash with the new structure. Therefore, I've bumped
   NS_DRIVER_VERSION to 3 such that driver modules (also binaries)
   can communicate that they support IPv6. In IPv6 mode, NaviServer
   refuses to work with versions <3.
 
- Replaced all usages of ns_inet_ntoa() by ns_intet_ntop()
   (except for legacy an minimal library support)
 
- Added log file warnings on various

Re: [naviserver-devel] IPv6 for NaviServer

2016-02-25 Thread Maurizio Martignano
Dear Gustaf,

   Thank you for your inputs.

I implemented all your changes but the system was still not working.

I had a careful look at it and eventually I found the cause (at least in my
configuration):



The problem in caused by the function inet_ntop in nswin32.c. After removing
it, everything works fine.

The system seems now OK to me.

 

Thank you,

Maurizio

 

 

 

 

From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 25 February 2016 12:33
To: naviserver-devel@lists.sourceforge.net
Subject: Re: [naviserver-devel] IPv6 for NaviServer

 

Hi Maurizio,

thanks for the fixes. as such, they could not work, but they point
out things, where one has to watch out. I have fixed these
things in a way it could work under windows.

By looking at the differences, it seems as if you compiled just a 
IPv4 version (no IPv6 enabled). i would have expected this
to go more smoothly. In case you tried the sample 
nsd-config.tcl script, that could not work with IPv4, since
IPv6 addresses were hard-coded.

all the best
-g

Am 24.02.16 um 18:00 schrieb Maurizio Martignano:

Dear Gustaf,
  Thank you as always for all your work.
 
About Windows I cannot really talk about MinGW nor Cygwin. I'm just using
Visual Studio 2015 with 64 bit as target.
With this configuration I tried to modify the file sockaddr.c (to make it
compile), but I'm not sure about the changes I made.
I also had to modify the file nswin32.c as I could not find anywhere the
function "NsSockGetPort".
Well the resulting system compiles... but nothing works.
I need much more time to do a proper testing/tuning and I can't do that at
the moment.
As soon as I discover more, I'll let you know.
 
Back to your delivery of the 16th of February.
 
Once again thank you,
Maurizio
 
 
-Original Message-
From: Gustaf Neumann [mailto:neum...@wu.ac.at] 
Sent: 24 February 2016 14:01
To: Navidevel  <mailto:naviserver-devel@lists.sourceforge.net>
<naviserver-devel@lists.sourceforge.net>
Subject: [naviserver-devel] IPv6 for NaviServer
 
Dear all,
 
over the last week, i've worked on IPv6 support for NaviServer.
For this task, i took the following path:
1) build a version of NaviServer for IPv6
2) build a single code source for compiling either for IPv4 or IPv6
3) let the IPv6 version run the setup-files for IPv4 in the IPv6 version
4) Run regression test suite under IPv4 and/IPv6
5) Allow mixed mode (handle IPv4 and IPv6 by the same binary)
(requires some interface changes to handle generic sockaddrs)
 
Everything seems to work fine, one can work with the same config files as
before, and everything works as expected, but one can as well listen on IPv6
addresses (e.g.
the IPv6 unspecified address "::"). IPv4->6 mapping is activated, or the
kernel allows to deliver as well
IPv4 traffic to the IPv6 interface, then one can talk also multiple
protocols. The mileage may vary depending on the OS and kernel.
 
It is as well possible to deactivate IPv6 support at compile time via
--disable-ipv6.
 
Here is a summary of the necessary changes:
- Added a amall Abstraction API for IP-version agnostic calls:
   Ns_LogSockaddr(), Ns_SockaddrGetPort(),
   Ns_SockaddrGetSockLen(), Ns_SockaddrMask(), Ns_SockaddrMaskBits(),
   Ns_SockaddrSetPort(), ns_inet_ntop(), ns_inet_pton()
 
- Replaced in interface more places where "sockaddr_in" (the IPv4
   version of the sockaddr) with the generic (version agnostic)
   sockaddr (also in IPv4 code to obtain API consistency when no IPv6
   is available): Ns_BindSock(), Ns_ConnSetPeer(), Ns_GetSockAddr(),
   Ns_SockBind(), Ns_SockBindUdp()
 
- The Ns_Sock structure contained sockaddr_in, which is not sufficient
   to store IPv6 addresses. Therefore it was necessary to change
   that to "sockaddr_storage" which guarantees to be large enough
   to keep all kind of addresses. This affects as well driver modules
   which communicate via the NaviServer managed sockets. Old drivers
   might crash with the new structure. Therefore, I've bumped
   NS_DRIVER_VERSION to 3 such that driver modules (also binaries)
   can communicate that they support IPv6. In IPv6 mode, NaviServer
   refuses to work with versions <3.
 
- Replaced all usages of ns_inet_ntoa() by ns_intet_ntop()
   (except for legacy an minimal library support)
 
- Added log file warnings on various places, where NaviServer
   was ignoring error states in socket communications silently.
 
- Transformed hash table for open listen ports to string keys
   (the old code used 32bit IPv4-addresses as keys in hash tables)
- added test for ns_listencallback
 
- Ns_HttpParseHost: new abstraction for parsing host and port number.
   Reason: IPv6 literal notation contains many colons, parsing
   IP-literal notation according to RFC 3986 section 3.2.2 is necessary
   (removed places where code was searching for ':' to expect the port)
 
- Added [ns_info ipv6] to obtain information whether the binary
   supports IPv6 or not
 

Re: [naviserver-devel] IPv6 for NaviServer

2016-02-25 Thread Gustaf Neumann

Hi Maurizio,

thanks for the fixes. as such, they could not work, but they point
out things, where one has to watch out. I have fixed these
things in a way it could work under windows.

By looking at the differences, it seems as if you compiled just a
IPv4 version (no IPv6 enabled). i would have expected this
to go more smoothly. In case you tried the sample
nsd-config.tcl script, that could not work with IPv4, since
IPv6 addresses were hard-coded.

all the best
-g

Am 24.02.16 um 18:00 schrieb Maurizio Martignano:

Dear Gustaf,
Thank you as always for all your work.

About Windows I cannot really talk about MinGW nor Cygwin. I'm just using
Visual Studio 2015 with 64 bit as target.
With this configuration I tried to modify the file sockaddr.c (to make it
compile), but I'm not sure about the changes I made.
I also had to modify the file nswin32.c as I could not find anywhere the
function "NsSockGetPort".
Well the resulting system compiles... but nothing works.
I need much more time to do a proper testing/tuning and I can't do that at
the moment.
As soon as I discover more, I'll let you know.

Back to your delivery of the 16th of February.

Once again thank you,
Maurizio


-Original Message-
From: Gustaf Neumann [mailto:neum...@wu.ac.at]
Sent: 24 February 2016 14:01
To: Navidevel 
Subject: [naviserver-devel] IPv6 for NaviServer

Dear all,

over the last week, i've worked on IPv6 support for NaviServer.
For this task, i took the following path:
1) build a version of NaviServer for IPv6
2) build a single code source for compiling either for IPv4 or IPv6
3) let the IPv6 version run the setup-files for IPv4 in the IPv6 version
4) Run regression test suite under IPv4 and/IPv6
5) Allow mixed mode (handle IPv4 and IPv6 by the same binary)
 (requires some interface changes to handle generic sockaddrs)

Everything seems to work fine, one can work with the same config files as
before, and everything works as expected, but one can as well listen on IPv6
addresses (e.g.
the IPv6 unspecified address "::"). IPv4->6 mapping is activated, or the
kernel allows to deliver as well
IPv4 traffic to the IPv6 interface, then one can talk also multiple
protocols. The mileage may vary depending on the OS and kernel.

It is as well possible to deactivate IPv6 support at compile time via
--disable-ipv6.

Here is a summary of the necessary changes:
- Added a amall Abstraction API for IP-version agnostic calls:
Ns_LogSockaddr(), Ns_SockaddrGetPort(),
Ns_SockaddrGetSockLen(), Ns_SockaddrMask(), Ns_SockaddrMaskBits(),
Ns_SockaddrSetPort(), ns_inet_ntop(), ns_inet_pton()

- Replaced in interface more places where "sockaddr_in" (the IPv4
version of the sockaddr) with the generic (version agnostic)
sockaddr (also in IPv4 code to obtain API consistency when no IPv6
is available): Ns_BindSock(), Ns_ConnSetPeer(), Ns_GetSockAddr(),
Ns_SockBind(), Ns_SockBindUdp()

- The Ns_Sock structure contained sockaddr_in, which is not sufficient
to store IPv6 addresses. Therefore it was necessary to change
that to "sockaddr_storage" which guarantees to be large enough
to keep all kind of addresses. This affects as well driver modules
which communicate via the NaviServer managed sockets. Old drivers
might crash with the new structure. Therefore, I've bumped
NS_DRIVER_VERSION to 3 such that driver modules (also binaries)
can communicate that they support IPv6. In IPv6 mode, NaviServer
refuses to work with versions <3.

- Replaced all usages of ns_inet_ntoa() by ns_intet_ntop()
(except for legacy an minimal library support)

- Added log file warnings on various places, where NaviServer
was ignoring error states in socket communications silently.

- Transformed hash table for open listen ports to string keys
(the old code used 32bit IPv4-addresses as keys in hash tables)
- added test for ns_listencallback

- Ns_HttpParseHost: new abstraction for parsing host and port number.
Reason: IPv6 literal notation contains many colons, parsing
IP-literal notation according to RFC 3986 section 3.2.2 is necessary
(removed places where code was searching for ':' to expect the port)

- Added [ns_info ipv6] to obtain information whether the binary
supports IPv6 or not

- Added configure flag --disable-ipv6 to build NaviServer just with
IPv4 support.

- provide defines for core differences between IPv4 and IPv6 #ifdef
HAVE_IPV6
# define NS_IP_LOOPBACK "::1"
# define NS_IP_UNSPECIFIED  "::"
# define NS_SOCKADDR_IN sockaddr_storage
# define NS_IPADDR_SIZE INET6_ADDRSTRLEN
#else
# define NS_IP_LOOPBACK "127.0.0.1"
# define NS_IP_UNSPECIFIED  "0.0.0.0"
# define NS_SOCKADDR_IN sockaddr_in
# define NS_IPADDR_SIZE INET_ADDRSTRLEN
#endif

   - nsperm:
* Aligned implementation with the documentation
  (hosts.allow/deny have comma-separated entries)
* Added submask specification in the form /xxx