Browse code

Remove ENABLE_CONNECTIONS ifdefs

Connections were always on for a long time. Note that ENABLE_MAMAGEMENT_REMOTE
was only depending on ENABLE_CONNECTIONS and is removed as well

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: James Yonan <james@openvpn.net>
Message-Id: 1340044749-10694-5-git-send-email-arne@rfc2549.org
URL: http://article.gmane.org/gmane.network.openvpn.devel/6744
Signed-off-by: David Sommerseth <davids@redhat.com>

Arne Schwabe authored on 2012/06/19 03:39:07
Showing 6 changed files
... ...
@@ -206,8 +206,6 @@ management_callback_http_proxy_fallback_cmd (void *arg, const char *server, cons
206 206
 
207 207
 #endif
208 208
 
209
-#if MANAGEMENT_QUERY_REMOTE
210
-
211 209
 static bool
212 210
 management_callback_remote_cmd (void *arg, const char **p)
213 211
 {
... ...
@@ -288,15 +286,12 @@ ce_management_query_remote (struct context *c, const char *remote_ip_hint)
288 288
   return ret;
289 289
 }
290 290
 
291
-#endif
292
-
293 291
 /*
294 292
  * Initialize and possibly randomize connection list.
295 293
  */
296 294
 static void
297 295
 init_connection_list (struct context *c)
298 296
 {
299
-#ifdef ENABLE_CONNECTION
300 297
   struct connection_list *l = c->options.connection_list;
301 298
   if (l)
302 299
     {
... ...
@@ -317,7 +312,6 @@ init_connection_list (struct context *c)
317 317
 	    }
318 318
 	}
319 319
     }
320
-#endif
321 320
 }
322 321
 
323 322
 #if 0 /* fixme -- disable for production */
... ...
@@ -350,7 +344,6 @@ show_connection_list (const struct connection_list *l)
350 350
 static void
351 351
 next_connection_entry (struct context *c)
352 352
 {
353
-#ifdef ENABLE_CONNECTION
354 353
   struct connection_list *l = c->options.connection_list;
355 354
   if (l)
356 355
     {
... ...
@@ -404,7 +397,6 @@ next_connection_entry (struct context *c)
404 404
 
405 405
 	c->options.ce = *ce;
406 406
 
407
-#if MANAGEMENT_QUERY_REMOTE
408 407
 	if (ce_defined && management && management_query_remote_enabled(management))
409 408
 	  {
410 409
 	    /* allow management interface to override connection entry details */
... ...
@@ -412,7 +404,6 @@ next_connection_entry (struct context *c)
412 412
 	    if (IS_SIG (c))
413 413
 	      break;
414 414
 	  } else
415
-#endif
416 415
 	if (remote_ip_hint)
417 416
 	  c->options.ce.remote = remote_ip_hint;
418 417
 
... ...
@@ -424,7 +415,6 @@ next_connection_entry (struct context *c)
424 424
 #endif
425 425
       } while (!ce_defined);
426 426
     }
427
-#endif
428 427
   update_options_ce_post (&c->options);
429 428
 }
430 429
 
... ...
@@ -3178,9 +3168,7 @@ init_management_callback_p2p (struct context *c)
3178 3178
 #if HTTP_PROXY_FALLBACK
3179 3179
       cb.http_proxy_fallback_cmd = management_callback_http_proxy_fallback_cmd;
3180 3180
 #endif
3181
-#if MANAGEMENT_QUERY_REMOTE
3182 3181
       cb.remote_cmd = management_callback_remote_cmd;
3183
-#endif
3184 3182
       management_set_callback (management, &cb);
3185 3183
     }
3186 3184
 #endif
... ...
@@ -92,9 +92,7 @@ man_help ()
92 92
   msg (M_CLIENT, "                         where action is reply string.");
93 93
   msg (M_CLIENT, "net                    : (Windows only) Show network info and routing table.");
94 94
   msg (M_CLIENT, "password type p        : Enter password p for a queried OpenVPN password.");
95
-#if MANAGEMENT_QUERY_REMOTE
96 95
   msg (M_CLIENT, "remote type [host port] : Override remote directive, type=ACCEPT|MOD|SKIP.");
97
-#endif
98 96
   msg (M_CLIENT, "pid                    : Show process ID of the current OpenVPN process.");
99 97
 #ifdef ENABLE_PKCS11
100 98
   msg (M_CLIENT, "pkcs11-id-count        : Get number of available PKCS#11 identities.");
... ...
@@ -1098,8 +1096,6 @@ man_http_proxy_fallback (struct management *man, const char *server, const char
1098 1098
 
1099 1099
 #endif
1100 1100
 
1101
-#if MANAGEMENT_QUERY_REMOTE
1102
-
1103 1101
 static void
1104 1102
 man_remote (struct management *man, const char **p)
1105 1103
 {
... ...
@@ -1121,8 +1117,6 @@ man_remote (struct management *man, const char **p)
1121 1121
     }
1122 1122
 }
1123 1123
 
1124
-#endif
1125
-
1126 1124
 static void
1127 1125
 man_dispatch_command (struct management *man, struct status_output *so, const char **p, const int nparms)
1128 1126
 {
... ...
@@ -1352,13 +1346,11 @@ man_dispatch_command (struct management *man, struct status_output *so, const ch
1352 1352
       man_http_proxy_fallback (man, NULL, NULL, NULL);
1353 1353
     }
1354 1354
 #endif
1355
-#if MANAGEMENT_QUERY_REMOTE
1356 1355
   else if (streq (p[0], "remote"))
1357 1356
     {
1358 1357
       if (man_need (man, p, 1, MN_AT_LEAST))
1359 1358
 	man_remote (man, p);
1360 1359
     }
1361
-#endif
1362 1360
 #if 1
1363 1361
   else if (streq (p[0], "test"))
1364 1362
     {
... ...
@@ -174,9 +174,7 @@ struct management_callback
174 174
 #if HTTP_PROXY_FALLBACK
175 175
   bool (*http_proxy_fallback_cmd) (void *arg, const char *server, const char *port, const char *flags);
176 176
 #endif
177
-#if MANAGEMENT_QUERY_REMOTE
178 177
   bool (*remote_cmd) (void *arg, const char **p);
179
-#endif
180 178
 };
181 179
 
182 180
 /*
... ...
@@ -336,9 +334,7 @@ struct management *management_init (void);
336 336
 # define MF_EXTERNAL_KEY    (1<<9)
337 337
 #endif
338 338
 #define MF_UP_DOWN          (1<<10)
339
-#if MANAGEMENT_QUERY_REMOTE
340 339
 #define MF_QUERY_REMOTE     (1<<11)
341
-#endif
342 340
 
343 341
 bool management_open (struct management *man,
344 342
 		      const char *addr,
... ...
@@ -427,13 +423,11 @@ management_query_user_pass_enabled (const struct management *man)
427 427
   return BOOL_CAST(man->settings.flags & MF_QUERY_PASSWORDS);
428 428
 }
429 429
 
430
-#if MANAGEMENT_QUERY_REMOTE
431 430
 static inline bool
432 431
 management_query_remote_enabled (const struct management *man)
433 432
 {
434 433
   return BOOL_CAST(man->settings.flags & MF_QUERY_REMOTE);
435 434
 }
436
-#endif
437 435
 
438 436
 #ifdef MANAGEMENT_PF
439 437
 static inline bool
... ...
@@ -381,9 +381,7 @@ static const char usage_message[] =
381 381
   "                      ip/port rather than listen as a TCP server.\n"
382 382
   "--management-query-passwords : Query management channel for private key\n"
383 383
   "                  and auth-user-pass passwords.\n"
384
-#if MANAGEMENT_QUERY_REMOTE
385 384
   "--management-query-remote : Query management channel for --remote directive.\n"
386
-#endif
387 385
   "--management-hold : Start " PACKAGE_NAME " in a hibernating state, until a client\n"
388 386
   "                    of the management interface explicitly starts it.\n"
389 387
   "--management-signal : Issue SIGUSR1 when management disconnect event occurs.\n"
... ...
@@ -931,7 +929,6 @@ setenv_settings (struct env_set *es, const struct options *o)
931 931
   setenv_unsigned (es, "daemon_start_time", time(NULL));
932 932
   setenv_int (es, "daemon_pid", platform_getpid());
933 933
 
934
-#ifdef ENABLE_CONNECTION
935 934
   if (o->connection_list)
936 935
     {
937 936
       int i;
... ...
@@ -939,7 +936,6 @@ setenv_settings (struct env_set *es, const struct options *o)
939 939
 	setenv_connection_entry (es, o->connection_list->array[i], i+1);
940 940
     }
941 941
   else
942
-#endif
943 942
     setenv_connection_entry (es, &o->ce, 1);
944 943
 }
945 944
 
... ...
@@ -1386,7 +1382,6 @@ show_connection_entries (const struct options *o)
1386 1386
 {
1387 1387
   msg (D_SHOW_PARMS, "Connection profiles [default]:");
1388 1388
   show_connection_entry (&o->ce);
1389
-#ifdef ENABLE_CONNECTION
1390 1389
  if (o->connection_list)
1391 1390
    {
1392 1391
      const struct connection_list *l = o->connection_list;
... ...
@@ -1397,7 +1392,6 @@ show_connection_entries (const struct options *o)
1397 1397
 	 show_connection_entry (l->array[i]);
1398 1398
        }
1399 1399
    }
1400
-#endif
1401 1400
   msg (D_SHOW_PARMS, "Connection profiles END");
1402 1401
 }
1403 1402
 
... ...
@@ -1822,8 +1816,6 @@ options_postprocess_http_proxy_override (struct options *o)
1822 1822
 
1823 1823
 #endif
1824 1824
 
1825
-#if ENABLE_CONNECTION
1826
-
1827 1825
 static struct connection_list *
1828 1826
 alloc_connection_list_if_undef (struct options *options)
1829 1827
 {
... ...
@@ -1872,8 +1864,6 @@ alloc_remote_entry (struct options *options, const int msglevel)
1872 1872
   return e;
1873 1873
 }
1874 1874
 
1875
-#endif
1876
-
1877 1875
 void
1878 1876
 connection_entry_load_re (struct connection_entry *ce, const struct remote_entry *re)
1879 1877
 {
... ...
@@ -2112,10 +2102,8 @@ options_postprocess_verify_ce (const struct options *options, const struct conne
2112 2112
       if (ce->socks_proxy_server)
2113 2113
 	msg (M_USAGE, "--socks-proxy cannot be used with --mode server");
2114 2114
 #endif
2115
-#ifdef ENABLE_CONNECTION
2116 2115
       if (options->connection_list)
2117 2116
 	msg (M_USAGE, "<connection> cannot be used with --mode server");
2118
-#endif
2119 2117
 #if 0
2120 2118
       if (options->tun_ipv6)
2121 2119
 	msg (M_USAGE, "--tun-ipv6 cannot be used with --mode server");
... ...
@@ -2516,7 +2504,6 @@ options_postprocess_mutate_invariant (struct options *options)
2516 2516
 static void
2517 2517
 options_postprocess_verify (const struct options *o)
2518 2518
 {
2519
-#ifdef ENABLE_CONNECTION
2520 2519
   if (o->connection_list)
2521 2520
     {
2522 2521
       int i;
... ...
@@ -2524,7 +2511,6 @@ options_postprocess_verify (const struct options *o)
2524 2524
 	options_postprocess_verify_ce (o, o->connection_list->array[i]);
2525 2525
     }
2526 2526
   else
2527
-#endif
2528 2527
     options_postprocess_verify_ce (o, &o->ce);
2529 2528
 }
2530 2529
 
... ...
@@ -2541,7 +2527,6 @@ options_postprocess_mutate (struct options *o)
2541 2541
 
2542 2542
   options_postprocess_mutate_invariant (o);
2543 2543
 
2544
-#ifdef ENABLE_CONNECTION
2545 2544
   if (o->remote_list && !o->connection_list)
2546 2545
     {
2547 2546
       /*
... ...
@@ -2588,7 +2573,6 @@ options_postprocess_mutate (struct options *o)
2588 2588
 #endif
2589 2589
     }
2590 2590
   else
2591
-#endif
2592 2591
     options_postprocess_mutate_ce (o, &o->ce);  
2593 2592
 
2594 2593
 #if P2MP
... ...
@@ -4224,13 +4208,11 @@ add_option (struct options *options,
4224 4224
       VERIFY_PERMISSION (OPT_P_GENERAL);
4225 4225
       options->management_flags |= MF_QUERY_PASSWORDS;
4226 4226
     }
4227
-#if MANAGEMENT_QUERY_REMOTE
4228 4227
   else if (streq (p[0], "management-query-remote"))
4229 4228
     {
4230 4229
       VERIFY_PERMISSION (OPT_P_GENERAL);
4231 4230
       options->management_flags |= MF_QUERY_REMOTE;
4232 4231
     }
4233
-#endif
4234 4232
   else if (streq (p[0], "management-hold"))
4235 4233
     {
4236 4234
       VERIFY_PERMISSION (OPT_P_GENERAL);
... ...
@@ -4434,7 +4416,6 @@ add_option (struct options *options,
4434 4434
       VERIFY_PERMISSION (OPT_P_GENERAL);
4435 4435
       options->remote_random = true;
4436 4436
     }
4437
-#if ENABLE_CONNECTION
4438 4437
   else if (streq (p[0], "connection") && p[1])
4439 4438
     {
4440 4439
       VERIFY_PERMISSION (OPT_P_GENERAL);
... ...
@@ -4460,14 +4441,11 @@ add_option (struct options *options,
4460 4460
 	  uninit_options (&sub);
4461 4461
 	}
4462 4462
     }
4463
-#endif
4464
-#ifdef ENABLE_CONNECTION
4465 4463
   else if (streq (p[0], "remote-ip-hint") && p[1])
4466 4464
     {
4467 4465
       VERIFY_PERMISSION (OPT_P_GENERAL);
4468 4466
       options->remote_ip_hint = p[1];
4469 4467
     }
4470
-#endif
4471 4468
 #if HTTP_PROXY_FALLBACK
4472 4469
   else if (streq (p[0], "http-proxy-fallback"))
4473 4470
     {
... ...
@@ -4512,7 +4490,6 @@ add_option (struct options *options,
4512 4512
 	      re.proto = proto;
4513 4513
 	    }
4514 4514
 	}
4515
-#ifdef ENABLE_CONNECTION
4516 4515
       if (permission_mask & OPT_P_GENERAL)
4517 4516
 	{
4518 4517
 	  struct remote_entry *e = alloc_remote_entry (options, msglevel);
... ...
@@ -4521,7 +4498,6 @@ add_option (struct options *options,
4521 4521
 	  *e = re;
4522 4522
 	}
4523 4523
       else if (permission_mask & OPT_P_CONNECTION)
4524
-#endif
4525 4524
 	{
4526 4525
 	  connection_entry_load_re (&options->ce, &re);
4527 4526
 	}
... ...
@@ -133,7 +133,6 @@ struct connection_entry
133 133
 # define CE_HTTP_PROXY_FALLBACK (1<<1)
134 134
   time_t ce_http_proxy_fallback_timestamp; /* time when fallback http_proxy_options was last updated */
135 135
 #endif
136
-#if MANAGEMENT_QUERY_REMOTE
137 136
 # define CE_MAN_QUERY_REMOTE_UNDEF  0
138 137
 # define CE_MAN_QUERY_REMOTE_QUERY  1
139 138
 # define CE_MAN_QUERY_REMOTE_ACCEPT 2
... ...
@@ -141,7 +140,6 @@ struct connection_entry
141 141
 # define CE_MAN_QUERY_REMOTE_SKIP   4
142 142
 # define CE_MAN_QUERY_REMOTE_MASK   (0x07)
143 143
 # define CE_MAN_QUERY_REMOTE_SHIFT  (2)
144
-#endif
145 144
   unsigned int flags;
146 145
 };
147 146
 
... ...
@@ -152,8 +150,6 @@ struct remote_entry
152 152
   int proto;
153 153
 };
154 154
 
155
-#ifdef ENABLE_CONNECTION
156
-
157 155
 #define CONNECTION_LIST_SIZE 64
158 156
 
159 157
 struct connection_list
... ...
@@ -171,8 +167,6 @@ struct remote_list
171 171
   struct remote_entry *array[CONNECTION_LIST_SIZE];
172 172
 };
173 173
 
174
-#endif
175
-
176 174
 #if HTTP_PROXY_FALLBACK
177 175
 struct hpo_store
178 176
 {
... ...
@@ -181,13 +175,11 @@ struct hpo_store
181 181
 };
182 182
 #endif
183 183
 
184
-#if MANAGEMENT_QUERY_REMOTE
185 184
 struct remote_host_store
186 185
 {
187 186
 # define RH_HOST_LEN 80
188 187
   char host[RH_HOST_LEN];
189 188
 };
190
-#endif
191 189
 
192 190
 /* Command line options */
193 191
 struct options
... ...
@@ -223,13 +215,10 @@ struct options
223 223
 
224 224
   /* Networking parms */
225 225
   struct connection_entry ce;
226
-
227
-#ifdef ENABLE_CONNECTION
228 226
   char *remote_ip_hint;
229 227
   struct connection_list *connection_list;
230 228
   struct remote_list *remote_list;
231 229
   bool force_connection_list;
232
-#endif
233 230
 
234 231
 #if HTTP_PROXY_FALLBACK
235 232
   bool http_proxy_fallback;
... ...
@@ -237,9 +226,7 @@ struct options
237 237
   struct hpo_store *hpo_store; /* used to store dynamic proxy info given by management interface */
238 238
 #endif
239 239
 
240
-#if MANAGEMENT_QUERY_REMOTE
241 240
   struct remote_host_store *rh_store;
242
-#endif
243 241
 
244 242
   bool remote_random;
245 243
   const char *ipchange;
... ...
@@ -801,20 +788,14 @@ bool get_ipv6_addr( const char * prefix_str, struct in6_addr *network,
801 801
 static inline bool
802 802
 connection_list_defined (const struct options *o)
803 803
 {
804
-#ifdef ENABLE_CONNECTION
805 804
   return o->connection_list != NULL;
806
-#else
807
-  return false;
808
-#endif
809 805
 }
810 806
 
811 807
 static inline void
812 808
 connection_list_set_no_advance (struct options *o)
813 809
 {
814
-#ifdef ENABLE_CONNECTION
815 810
   if (o->connection_list)
816 811
     o->connection_list->no_advance = true;
817
-#endif
818 812
 }
819 813
 
820 814
 #if HTTP_PROXY_FALLBACK
... ...
@@ -650,29 +650,15 @@ socket_defined (const socket_descriptor_t sd)
650 650
 #endif
651 651
 
652 652
 /*
653
- * Support "connection" directive
654
- */
655
-#define ENABLE_CONNECTION 1
656
-
657
-/*
658 653
  * Should we include http proxy fallback functionality
659 654
  */
660
-#if defined(ENABLE_CONNECTION) && defined(ENABLE_MANAGEMENT) && defined(ENABLE_HTTP_PROXY)
655
+#if defined(ENABLE_MANAGEMENT) && defined(ENABLE_HTTP_PROXY)
661 656
 #define HTTP_PROXY_FALLBACK 1
662 657
 #else
663 658
 #define HTTP_PROXY_FALLBACK 0
664 659
 #endif
665 660
 
666 661
 /*
667
- * Should we include --management-query-remote functionality
668
- */
669
-#if defined(ENABLE_CONNECTION) && defined(ENABLE_MANAGEMENT)
670
-#define MANAGEMENT_QUERY_REMOTE 1
671
-#else
672
-#define MANAGEMENT_QUERY_REMOTE 0
673
-#endif
674
-
675
-/*
676 662
  * Reduce sensitivity to system clock instability
677 663
  * and backtracks.
678 664
  */