[Openvpn-devel] [PATCH] move variable declaration to top of function

2012-02-17 Thread Heiko Hund
MSVC chokes on this as it's not according to C89.

Signed-off-by: Heiko Hund 
---
 buffer.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/buffer.c b/buffer.c
index 6800e6e..391085b 100644
--- a/buffer.c
+++ b/buffer.c
@@ -321,9 +321,9 @@ gc_malloc (size_t size, bool clear, struct gc_arena *a)
 #endif
 {
   void *ret;
+  struct gc_entry *e;
   ASSERT (NULL != a);

-  struct gc_entry *e;
 #ifdef DMALLOC
   e = (struct gc_entry *) openvpn_dmalloc (file, line, size + sizeof (struct 
gc_entry));
 #else
-- 
1.7.5.4




Re: [Openvpn-devel] [PATCH 2/4] do not use mode_t on Windows

2012-02-17 Thread Heiko Hund
Alon,

On Thursday 16 February 2012 18:34:34 Alon Bar-Lev wrote:
> Anyway, this is not the correct solution.
> Correct solution is to have config-msvc.h and have:
> ---
> #define mode_t int

I don't think that a MSVC specific header will do good. mode_t shouldn't 
actually be used in mingw either, even if they define it. I stumbled over such 
glue code a couple of times and the only reason I can come up with why they 
have it is backwards compatibility with old code. So it's rather a general 
WIN32 thing. And I absolutely agree that putting all the WIN32 stuff into 
win32.[ch] would make the code prettier. I just don't feel enough itch to 
approach this scratching myself.

Heiko
-- 
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200
Astaro a Sophos Company | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Commercial Register: Mannheim HRA 702710 | Headquarter Location: Karlsruhe
 
Represented by the General Partner Astaro Verwaltungs GmbH
Amalienbadstraße 41 Bau 52 | 76227 Karlsruhe | Germany 
Commercial Register: Mannheim HRB 708248 | Executive Board: Gert Hansen,
Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen




Re: [Openvpn-devel] [PATCH 4/4] make MSVC link against shell32 as well

2012-02-17 Thread Heiko Hund
Alon,

On Thursday 16 February 2012 18:37:21 Alon Bar-Lev wrote:
> On Thu, Feb 16, 2012 at 7:30 PM, Heiko Hund  wrote:
> > Windows API CommandLineToArgvW(), introduced in Windows unicode path
> > commit 71bbbd76c62630c88441237d72fe5b61f0b45b2a, is defined therein.
> 
> Usually this should be avoided and get command-line from wmain().

the general idea is to make Unicode things happen without changing the openvpn 
code too much in a very Windows specific way. Converting UCS-2 to UTF-8 
directly where input and output is happening and passing it through the rest 
of openvpn as char* does that. I don't see any benefit in converting openvpn 
into a native unicode binary.

Regards
Heiko
-- 
Heiko Hund | Software Engineer | Phone +49-721-25516-237 | Fax -200
Astaro a Sophos Company | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Commercial Register: Mannheim HRA 702710 | Headquarter Location: Karlsruhe
 
Represented by the General Partner Astaro Verwaltungs GmbH
Amalienbadstraße 41 Bau 52 | 76227 Karlsruhe | Germany 
Commercial Register: Mannheim HRB 708248 | Executive Board: Gert Hansen,
Markus Hennig, Jan Hichert, Günter Junk, Dr. Frank Nellissen




Re: [Openvpn-devel] [PATCH 4/4] make MSVC link against shell32 as well

2012-02-17 Thread Alon Bar-Lev
On Fri, Feb 17, 2012 at 11:51 AM, Heiko Hund  wrote:
> Alon,
>
> On Thursday 16 February 2012 18:37:21 Alon Bar-Lev wrote:
>> On Thu, Feb 16, 2012 at 7:30 PM, Heiko Hund  wrote:
>> > Windows API CommandLineToArgvW(), introduced in Windows unicode path
>> > commit 71bbbd76c62630c88441237d72fe5b61f0b45b2a, is defined therein.
>>
>> Usually this should be avoided and get command-line from wmain().
>
> the general idea is to make Unicode things happen without changing the openvpn
> code too much in a very Windows specific way. Converting UCS-2 to UTF-8
> directly where input and output is happening and passing it through the rest
> of openvpn as char* does that. I don't see any benefit in converting openvpn
> into a native unicode binary.

I agree.
Compiling entry point as wmain and not main is not bigger change than
any other change in the unicode patch.
Anyway as it seem we have an opportunity window to cleanup the mess,
so apply whatever needed in orderer to make it work and then we revise
it.
Personally, I don't think this unicode patch was ready to be merged...

Alon.



Re: [Openvpn-devel] [PATCH 2/4] do not use mode_t on Windows

2012-02-17 Thread Alon Bar-Lev
On Fri, Feb 17, 2012 at 11:39 AM, Heiko Hund  wrote:
> Alon,
>
> On Thursday 16 February 2012 18:34:34 Alon Bar-Lev wrote:
>> Anyway, this is not the correct solution.
>> Correct solution is to have config-msvc.h and have:
>> ---
>> #define mode_t int
>
> I don't think that a MSVC specific header will do good. mode_t shouldn't
> actually be used in mingw either, even if they define it. I stumbled over such
> glue code a couple of times and the only reason I can come up with why they
> have it is backwards compatibility with old code. So it's rather a general
> WIN32 thing. And I absolutely agree that putting all the WIN32 stuff into
> win32.[ch] would make the code prettier. I just don't feel enough itch to
> approach this scratching myself.
>

You will  be surprised how mingw is better in this sense.
Anyway, as I wrote commit whatever you need for now, we will clean up
the build system soon.

Alon.



Re: [Openvpn-devel] MSVC fixes

2012-02-17 Thread David Sommerseth
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 16/02/12 18:30, Heiko Hund wrote:
> Hi,
> 
> this patch series fixes several issues when building for Windows with
> the MSVC buildsystem discovered today:
> 
> [PATCH 1/4] replace check for TARGET_WIN32 with WIN32 [PATCH 2/4] do
> not use mode_t on Windows [PATCH 3/4] use the underscore version of
> stat on Windows [PATCH 4/4] make MSVC link against shell32 as well
> 
> For details check the commit messages of the individual patches.

All patches applied to master on -testing and -stable trees.
For patch 3/4, a v2 patch was applied.


commit 76a3c405549bf02902846a9bd0e7d0f3a25a5b4d
Author: Heiko Hund 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Thu Feb 16 18:30:38 2012 +0100

replace check for TARGET_WIN32 with WIN32

Use of TARGET_WIN32 breaks MSVC builds as it is only defined
for mingw builds done with the autotools buildsystem.

Signed-off-by: Heiko Hund 
Acked-by: Gert Doering 
Signed-off-by: David Sommerseth 

commit d0109cbf459409a84963668c78f444c97ec2b349
Author: Heiko Hund 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Thu Feb 16 18:30:39 2012 +0100

do not use mode_t on Windows

The MSVC headers do not define mode_t. open() uses an int for
the permissions instead. Fixes building with the MSVC based
buildsystem.

Signed-off-by: Heiko Hund 
Acked-by: Gert Doering 
Signed-off-by: David Sommerseth 

commit a13cd253ca1ce987e4feca7d80bd19ff749f7787
Author: Heiko Hund 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Thu Feb 16 18:30:40 2012 +0100

use the underscore version of stat on Windows

MSVC does not know wstat(). Instead _wstat() must be used here.
Unfortunately _wstat() takes a 'struct _stat'. A type 'stat_t' is
introduced to handle this situation in a portable way.

[v2: Use openvpn_stat_t instead of stat_t (David Sommerseth)]

Signed-off-by: Heiko Hund 
Signed-off-by: David Sommerseth 
Acked-by: Gert Doering 

commit 67fe36f888d72d2c9c2b8dac849159a229400367
Author: Heiko Hund 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Thu Feb 16 18:30:41 2012 +0100

make MSVC link against shell32 as well

Windows API CommandLineToArgvW(), introduced in Windows unicode path
commit 71bbbd76c62630c88441237d72fe5b61f0b45b2a, is defined therein.

Signed-off-by: Heiko Hund 
Acked-by: Gert Doering 
Signed-off-by: David Sommerseth 


kind regards,

David Sommerseth

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8+KHgACgkQDC186MBRfrrEQwCfSZXxIf3+E+iR3+0h+HI6R5KV
utwAn36V2rzrGZvdeStrp6rjG/mOtZME
=XnhK
-END PGP SIGNATURE-



Re: [Openvpn-devel] [PATCH] move variable declaration to top of function

2012-02-17 Thread David Sommerseth
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 17/02/12 09:39, Heiko Hund wrote:
> MSVC chokes on this as it's not according to C89.
> 
> Signed-off-by: Heiko Hund  --- buffer.c |2
> +- 1 files changed, 1 insertions(+), 1 deletions(-)

ACK!  Applied to master on -testing and stable trees.

commit 175383fec9cd2d891cfd3f2673b6549822fdfa47
Author: Heiko Hund 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Fri Feb 17 09:39:35 2012 +0100

move variable declaration to top of function

MSVC chokes on this as it's not according to C89.

Signed-off-by: Heiko Hund 
Acked-by: David Sommerseth 
Signed-off-by: David Sommerseth 


kind regards,

David Sommerseth
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8+KQYACgkQDC186MBRfrpetwCfXPs76FCzCiLbmDzS0wD77cxZ
+j8AoJ+pYBXQfyplScerR77HQlhKX89E
=ZIdx
-END PGP SIGNATURE-



Re: [Openvpn-devel] [PATCH] move variable declaration to top of function

2012-02-17 Thread Gert Doering
Hi,

On Fri, Feb 17, 2012 at 09:39:35AM +0100, Heiko Hund wrote:
> MSVC chokes on this as it's not according to C89.
> 
> Signed-off-by: Heiko Hund 
> ---
>  buffer.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/buffer.c b/buffer.c
> index 6800e6e..391085b 100644
> --- a/buffer.c
> +++ b/buffer.c
> @@ -321,9 +321,9 @@ gc_malloc (size_t size, bool clear, struct gc_arena *a)
>  #endif
>  {
>void *ret;
> +  struct gc_entry *e;
>ASSERT (NULL != a);
>  
> -  struct gc_entry *e;

Ack.  This has bitten me as well :)

gert
-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpWNZtzPrVnO.pgp
Description: PGP signature


[Openvpn-devel] [PATCH] Makefile.am referenced a now non-existing config-win32.h

2012-02-17 Thread David Sommerseth
This file was moved to win/config.h.in and is the template used
by the Python build tools in win/.  This happened in
commit 4b312378e9e7084a0699ca6d4b895bdadb7540db

For all other autotools based environments, ./configure will take
care of creating the proper config.h

Signed-off-by: David Sommerseth 
---
 Makefile.am |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ab86cc1..2029389 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,7 +85,6 @@ openvpn_SOURCES = \
clinat.c clinat.h \
common.h \
compat.h compat.c \
-   config-win32.h \
crypto.c crypto.h crypto_backend.h \
crypto_openssl.c crypto_openssl.h \
crypto_polarssl.c crypto_polarssl.h \
-- 
1.7.4.4




Re: [Openvpn-devel] [PATCH] Makefile.am referenced a now non-existing config-win32.h

2012-02-17 Thread Alon Bar-Lev
When did this file gone?
Anyway, this was required with compiling using MSVC...

On Fri, Feb 17, 2012 at 1:13 PM, David Sommerseth  wrote:
> This file was moved to win/config.h.in and is the template used
> by the Python build tools in win/.  This happened in
> commit 4b312378e9e7084a0699ca6d4b895bdadb7540db
>
> For all other autotools based environments, ./configure will take
> care of creating the proper config.h
>
> Signed-off-by: David Sommerseth 
> ---
>  Makefile.am |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index ab86cc1..2029389 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -85,7 +85,6 @@ openvpn_SOURCES = \
>        clinat.c clinat.h \
>        common.h \
>        compat.h compat.c \
> -       config-win32.h \
>        crypto.c crypto.h crypto_backend.h \
>        crypto_openssl.c crypto_openssl.h \
>        crypto_polarssl.c crypto_polarssl.h \
> --
> 1.7.4.4
>
>
> --
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> ___
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel



Re: [Openvpn-devel] [PATCH] Makefile.am referenced a now non-existing config-win32.h

2012-02-17 Thread David Sommerseth
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 17/02/12 12:18, Alon Bar-Lev wrote:
> When did this file gone? Anyway, this was required with compiling 
> using MSVC...

This is the commit referenced:

commit 4b312378e9e7084a0699ca6d4b895bdadb7540db
Author: Samuli Seppänen 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Tue Mar 15 16:37:41 2011 +0200

Replaced config-win32.h with win/config.h.in

The original config-win32.h - a static header file - has been
superceded by both "domake-win" script and the new Python-based
buildsystem. Transformed it into a template file, win/config.h.in,
which obtains the most commonly used build parameters from
win/settings.in.

Added support code to win/config.py and win/wb.py to preprocess
win/config.h.in and copy it to config.h, from where source and header
files can find it.

Removed all references to config-win32.h. Also removed obsolete
PACKAGE_BUGREPORT and USE_PTHREAD variables from the win/config.h.in
file.

Signed-off-by: Samuli Seppänen 
Acked-by: James Yonan 
Signed-off-by: David Sommerseth 


kind regards,

David Sommerseth
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8+ONwACgkQDC186MBRfrociQCfTopQrINB9mjNUnqgPShF7hvA
d7gAoJvf0XjI59upjzKdKdqDVqh7n3Eo
=vB7z
-END PGP SIGNATURE-



[Openvpn-devel] [PATCH] Makefile.am was missing ssl_common.h

2012-02-17 Thread David Sommerseth
In commit 9a160b796e1a40f9635231e5533ce40d46dba25f ssl_common.h
was introduced, but never listed as a source file in Makefile.am

Signed-off-by: David Sommerseth 
---
 Makefile.am |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2029389..26b80f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -146,6 +146,7 @@ openvpn_SOURCES = \
ssl.c ssl.h  ssl_backend.h \
ssl_openssl.c ssl_openssl.h \
ssl_polarssl.c ssl_polarssl.h \
+   ssl_common.h \
ssl_verify.c ssl_verify.h ssl_verify_backend.h \
ssl_verify_openssl.c ssl_verify_openssl.h \
ssl_verify_polarssl.c ssl_verify_polarssl.h \
-- 
1.7.4.4




Re: [Openvpn-devel] [PATCH] Makefile.am was missing ssl_common.h

2012-02-17 Thread Gert Doering
Hi,

On Fri, Feb 17, 2012 at 12:30:33PM +0100, David Sommerseth wrote:
> In commit 9a160b796e1a40f9635231e5533ce40d46dba25f ssl_common.h
> was introduced, but never listed as a source file in Makefile.am

ACK, together with the other one.

(Side remark: buildbot should do "make distcheck", at least on one of
the instances - so we see this right away when moving around files)

gert
-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpMONukGpucf.pgp
Description: PGP signature


Re: [Openvpn-devel] [PATCH] Makefile.am was missing ssl_common.h

2012-02-17 Thread David Sommerseth
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 17/02/12 12:30, David Sommerseth wrote:
> In commit 9a160b796e1a40f9635231e5533ce40d46dba25f ssl_common.h was 
> introduced, but never listed as a source file in Makefile.am
> 
> Signed-off-by: David Sommerseth  --- Makefile.am | 
> 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
> 

Applied to master branch on -testing and -stable trees.

commit 5e1e5495328bb491a186d72544d2e57f49dfdedc
Author: David Sommerseth 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Fri Feb 17 12:29:27 2012 +0100

Makefile.am was missing ssl_common.h

In commit 9a160b796e1a40f9635231e5533ce40d46dba25f ssl_common.h
was introduced, but never listed as a source file in Makefile.am

Signed-off-by: David Sommerseth 
Acked-by: Gert Doering 


kind regards,

David Sommerseth
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8+SYoACgkQDC186MBRfrqq2gCglwyqhnfiCCuE6sUMlQ324paz
vsMAoI5WpwMbYWhaDHISphVi7xW5c0rs
=IPb6
-END PGP SIGNATURE-



Re: [Openvpn-devel] [PATCH] Makefile.am referenced a now non-existing config-win32.h

2012-02-17 Thread David Sommerseth
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 17/02/12 12:13, David Sommerseth wrote:
> This file was moved to win/config.h.in and is the template used by the
> Python build tools in win/.  This happened in commit
> 4b312378e9e7084a0699ca6d4b895bdadb7540db
> 
> For all other autotools based environments, ./configure will take care
> of creating the proper config.h
> 
> Signed-off-by: David Sommerseth  --- Makefile.am |
> 1 - 1 files changed, 0 insertions(+), 1 deletions(-)

Applied to master branch on -testing and -stable trees.

commit ec3a7814d436076a442979ec656d3e8431d55d73
Author: David Sommerseth 
List-Post: openvpn-devel@lists.sourceforge.net
Date:   Fri Feb 17 12:09:51 2012 +0100

Makefile.am referenced a now non-existing config-win32.h

Signed-off-by: David Sommerseth 
Acked-by: Gert Doering 


kind regards,

David Sommerseth
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8+ScEACgkQDC186MBRfrog7wCdF8hRIHwbz/I4tvd0nSP3jB72
gvsAnAx39dBmgUStmzlm+FV2u+tqDU+k
=oCO7
-END PGP SIGNATURE-



[Openvpn-devel] [PATCH] Bogus check for negative values on an unsigned number.

2012-02-17 Thread Frank de Brabander
This causes compiler warnings when using Clang instead of default GCC.

Signed-off-by: Frank de Brabander 
---
 mroute.c |   24 +---
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/mroute.c b/mroute.c
index 285b151..0213a3e 100644
--- a/mroute.c
+++ b/mroute.c
@@ -516,29 +516,23 @@ void
 mroute_helper_add_iroute6 (struct mroute_helper *mh,
const struct iroute_ipv6 *ir6)
 {
-  if (ir6->netbits >= 0)
-{
-  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
-  ++mh->cache_generation;
-  ++mh->net_len_refcount[ir6->netbits];
-  if (mh->net_len_refcount[ir6->netbits] == 1)
+  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
+  ++mh->cache_generation;
+  ++mh->net_len_refcount[ir6->netbits];
+  if (mh->net_len_refcount[ir6->netbits] == 1)
mroute_helper_regenerate (mh);
-}
 }

 void
 mroute_helper_del_iroute6 (struct mroute_helper *mh,
   const struct iroute_ipv6 *ir6)
 {
-  if (ir6->netbits >= 0)
-{
-  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
-  ++mh->cache_generation;
-  --mh->net_len_refcount[ir6->netbits];
-  ASSERT (mh->net_len_refcount[ir6->netbits] >= 0);
-  if (!mh->net_len_refcount[ir6->netbits])
+  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
+  ++mh->cache_generation;
+  --mh->net_len_refcount[ir6->netbits];
+  ASSERT (mh->net_len_refcount[ir6->netbits] >= 0);
+  if (!mh->net_len_refcount[ir6->netbits])
mroute_helper_regenerate (mh);
-}
 }

 void
-- 
1.7.5.4



[Openvpn-devel] [PATCH] Bogus check for negative values on an unsigned number.

2012-02-17 Thread Frank de Brabander
This causes compiler warnings when using Clang instead of default GCC.

Signed-off-by: Frank de Brabander 
---
 mroute.c |   24 +---
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/mroute.c b/mroute.c
index 285b151..0213a3e 100644
--- a/mroute.c
+++ b/mroute.c
@@ -516,29 +516,23 @@ void
 mroute_helper_add_iroute6 (struct mroute_helper *mh, 
const struct iroute_ipv6 *ir6)
 {
-  if (ir6->netbits >= 0)
-{
-  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
-  ++mh->cache_generation;
-  ++mh->net_len_refcount[ir6->netbits];
-  if (mh->net_len_refcount[ir6->netbits] == 1)
+  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
+  ++mh->cache_generation;
+  ++mh->net_len_refcount[ir6->netbits];
+  if (mh->net_len_refcount[ir6->netbits] == 1)
mroute_helper_regenerate (mh);
-}
 }

 void
 mroute_helper_del_iroute6 (struct mroute_helper *mh, 
   const struct iroute_ipv6 *ir6)
 {
-  if (ir6->netbits >= 0)
-{
-  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
-  ++mh->cache_generation;
-  --mh->net_len_refcount[ir6->netbits];
-  ASSERT (mh->net_len_refcount[ir6->netbits] >= 0);
-  if (!mh->net_len_refcount[ir6->netbits])
+  ASSERT (ir6->netbits < MR_HELPER_NET_LEN);
+  ++mh->cache_generation;
+  --mh->net_len_refcount[ir6->netbits];
+  ASSERT (mh->net_len_refcount[ir6->netbits] >= 0);
+  if (!mh->net_len_refcount[ir6->netbits])
mroute_helper_regenerate (mh);
-}
 }

 void
-- 
1.7.5.4




Re: [Openvpn-devel] [PATCH] Bogus check for negative values on an unsigned number.

2012-02-17 Thread Gert Doering
Hi,

On Fri, Feb 17, 2012 at 10:04:50PM +0100, Frank de Brabander wrote:
> This causes compiler warnings when using Clang instead of default GCC.

I'm not particularily interested in source code fixes "just to silence
a compiler warning" - but Clang is right, of course, that this variable
cannot ever be negative, and thus it should be cleaned up :-)

I'm not ACKing this patch anyway, because I think the issue is bigger - I
want to look at the IPv4 code paths and see whether the IPv4 "netbits"
structure element can ever be negative - and if yes, figure out whether
this should be possible for IPv6, and if not, convert the IPv4 netbits
to "unsigned int" as well, and get rid of the if() statement there as
well.

Thanks for reporting this.  I'll look into it.

gert

-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpfMMRNqX6VR.pgp
Description: PGP signature