Message-ID: <50445995.30700@...1227...> Date: Mon, 03 Sep 2012 09:17:41 +0200 From: Arne Schwabe MIME-Version: 1.0 References: <1343837470-3923-5-git-send-email-arne@...1227...> <1346654982-25059-1-git-send-email-arne@...1227...> <20120903070957.GL18296@...1296...> In-Reply-To: <20120903070957.GL18296@...1296...> Content-Type: multipart/alternative; boundary="------------010909050008070704030105" Subject: Re: [Openvpn-devel] [PATCH] Simplify print_sockaddr_ex function, merge duplicate ipv4/ipv6 logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gert Doering Cc: openvpn-devel@lists.sourceforge.net This is a multi-part message in MIME format. --------------010909050008070704030105 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 03.09.12 09:09, schrieb Gert Doering: > Hi, > > On Mon, Sep 03, 2012 at 08:49:42AM +0200, Arne Schwabe wrote: >> Some BSD need the right salen, max(sizeof(v4),sizeof(v6)) does not work. Since sa_len is not a member in sockaddr for Linux and Windows and SA_LEN is no available on Darwin, NetBSD explicitly set salem > > "Something sneaked into your keyboard"... > >> + getnameinfo(&addr->addr.sa, sizeof (struct sockaddr_in6), >> + buf, sizeof (buf), NULL, 0, NI_NUMERICHOST); > > ... this very much looks like v1 of the patch...? :-) > > Anyway, what about defining an openvpn_sa_len() macro that will either > use SA_LEN() if it exists, or fall back to > > #define openvpn_sa_len(addr) ( addr->sa.sa_family == AF_INET? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6) ) > > this will, of course, bite us when we implement IPv8, but should be fine > for 2.3... I will try to avoid this for now... I hope to convert openvpn to fully using getnameinfo/getaddrinfo one day so that we do not need these deep look into the sockaddr anymore. > (Is there something magic in Autoconf to solve this? Must be a standard > problem...) > > I think most people don't deal with raw sockaddr structs. getaddrinfo returns ai_addrlen. Arne -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBEWZUACgkQe8+cMNS4zRf5/QCeKPwCJKva6l05i18OWv4tZJFB BuQAn36NT4DZoi5e9RTqm3XAfBQqiWup =e27Z -----END PGP SIGNATURE----- --------------010909050008070704030105 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 03.09.12 09:09, schrieb Gert Doering:
> Hi,
>
> On Mon, Sep 03, 2012 at 08:49:42AM +0200, Arne Schwabe wrote:
>> Some BSD need the right salen, max(sizeof(v4),sizeof(v6)) does not work. Since sa_len is not a member in sockaddr for Linux and Windows and SA_LEN is no available on Darwin, NetBSD explicitly set salem
>
> "Something sneaked into your keyboard"...
>
>> + getnameinfo(&addr->addr.sa, sizeof (struct sockaddr_in6),
>> + buf, sizeof (buf), NULL, 0, NI_NUMERICHOST);
>
> ... this very much looks like v1 of the patch...? :-)
>
> Anyway, what about defining an openvpn_sa_len() macro that will either
> use SA_LEN() if it exists, or fall back to
>
> #define openvpn_sa_len(addr) ( addr->sa.sa_family == AF_INET? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6) )
>
> this will, of course, bite us when we implement IPv8, but should be fine
> for 2.3...


I will try to avoid this for now... I hope to convert openvpn to fully using getnameinfo/getaddrinfo
one day so that we do not need these deep look into the sockaddr anymore.


> (Is there something magic in Autoconf to solve this? Must be a standard
> problem...)
>
>

I think most people don't deal with raw sockaddr structs. getaddrinfo returns ai_addrlen.

Arne
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Darwin)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlBEWZUACgkQe8+cMNS4zRf5/QCeKPwCJKva6l05i18OWv4tZJFB
BuQAn36NT4DZoi5e9RTqm3XAfBQqiWup
=e27Z
-----END PGP SIGNATURE-----

--------------010909050008070704030105--