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>
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
      (e.g. ::1/64)
    * Use binary IPv4 and IPv6 values for hash and mask lookup
    * Generalizing masking functions
    * Refactor code to avoid memory leaks
    * Updated documentation

- modules:
    * nsudp and nsssl are now IPv6 aware/compliant

TODOs:
- more platform testing
    (probably changes for Windows necessary, help is appreciated)
- remove commented out debug statements

- make more modules IPv6 compliant
- documentation updates

I've tested the generic and IPv4 only version via regression test and random
browsing on Mac OS X and Linux. If you have other platforms, testing would
be appreciated. There are some adjustments for windows probably necessary
(in the absence of "configure", one has to add manually "HAVE_IPV4" to the
compile flags). Any help is welcome.

best regards
-gustaf neumann


----------------------------------------------------------------------------
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance APM +
Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor
end-to-end web transactions and take corrective actions now Troubleshoot
faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140


_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


--
Univ.Prof. Dr. Gustaf Neumann
WU Vienna
Institute of Information Systems and New Media
Welthandelsplatz 1, A-1020 Vienna, Austria

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to