Skip to contentSkip to conversation

minimal change to PUSH_DEFINED

PATCH In review Neil Brown 2 participants 3 messages Jul 26, 2004 – Jul 27, 2004

lore
Share & tools
lore

Neil Brown

author
#0 lore raw

PATCH 1/1 minimal change to PUSH_DEFINED

This patch is of little import, but I thought I would submit it anyway.

openvpn has a "PUSH_DEFINED" macro which is used to determine how the configuration summary, which is exchanged for consistency checking, is created.

PUSH_DEFINE should be equivalent to "something might get pushed". It is currently true iff push_list is non-NULL. However there is another case when things are pushed. i.e. if ifconfig_pool is defined. So this patch corrects PUSH_DEFINED.

Thanks,
NeilBrown

### Diffstat output

 ./options.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
options.h renamed from options.h~current~ +1 -1
diff ./options.h~current~ ./options.h
@@ -340,7 +340,7 @@ struct options
 
 #if P2MP
 #define PULL_DEFINED(opt) ((opt)->pull)
-#define PUSH_DEFINED(opt) ((opt)->push_list)
+#define PUSH_DEFINED(opt) ((opt)->push_list || (opt)->ifconfig_pool_defined)
 #else
 #define PULL_DEFINED(opt) (false)
 #define PUSH_DEFINED(opt) (false)
#1 lore raw

PUSH_DEFINED is currently unused, so overall I don't have any problem with this. Probably when something gets written that needs PUSH_DEFINED, the subtletes of how it should operate will become more apparent.

James

Quoted 34 lines · Neil Brown

This patch is of little import, but I thought I would submit it anyway.

openvpn has a "PUSH_DEFINED" macro which is used to determine how the configuration summary, which is exchanged for consistency checking, is created.

PUSH_DEFINE should be equivalent to "something might get pushed". It is currently true iff push_list is non-NULL. However there is another case when things are pushed. i.e. if ifconfig_pool is defined. So this patch corrects PUSH_DEFINED.

Thanks,
NeilBrown

### Diffstat output

 ./options.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff ./options.h~current~ ./options.h

options.h renamed from options.h~current~ +1 -1
@@ -340,7 +340,7 @@ struct options
 
 #if P2MP
 #define PULL_DEFINED(opt) ((opt)->pull)
-#define PUSH_DEFINED(opt) ((opt)->push_list)
+#define PUSH_DEFINED(opt) ((opt)->push_list || (opt)->ifconfig_pool_defined)
 #else
 #define PULL_DEFINED(opt) (false)
 #define PUSH_DEFINED(opt) (false)
author
#2 lore raw
Quoted 4 lines · On Tuesday July 27, [email protected]... wrote:

PUSH_DEFINED is currently unused, so overall I don't have any problem with this. Probably when something gets written that needs PUSH_DEFINED, the subtletes of how it should operate will become more apparent.

It was used in beta6 which is what I was working on when I found the need for this patch.
In options_string, it read:
if (tt && !PUSH_DEFINED(o) && !PULL_DEFINED(o))

    {
      const char *ios = ifconfig_options_string (tt, remote, o->ifconfig_nowarn, gc);
      if (ios && strlen (ios))
	buf_printf (&out, ",ifconfig %s", ios);
    }

beta7 reads
if (tt && o->mode == MODE_POINT_TO_POINT && !PULL_DEFINED(o))

    {
      const char *ios = ifconfig_options_string (tt, remote, o->ifconfig_nowarn, gc);
      if (ios && strlen (ios))
	buf_printf (&out, ",ifconfig %s", ios);
    }

which may well be fixing the same problem that I saw.

NeilBrown