Browse code

Merge branch 'bugfix2.1' into beta2.2

David Sommerseth authored on 2010/08/06 04:28:21
Showing 5 changed files
... ...
@@ -1168,8 +1168,9 @@ process_outgoing_link (struct context *c)
1168 1168
 		 size);
1169 1169
 	}
1170 1170
 
1171
-      /* indicate activity regarding --inactive parameter */
1172
-      register_activity (c, size);
1171
+      /* if not a ping/control message, indicate activity regarding --inactive parameter */
1172
+      if (c->c2.buf.len > 0 )
1173
+        register_activity (c, size);
1173 1174
     }
1174 1175
   else
1175 1176
     {
... ...
@@ -41,6 +41,7 @@
41 41
  * New Client Connection:
42 42
  *
43 43
  * FUNC: openvpn_plugin_client_constructor_v1
44
+ * FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_ENABLE_PF
44 45
  * FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_TLS_VERIFY (called once for every cert
45 46
  *                                                     in the server chain)
46 47
  * FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_AUTH_USER_PASS_VERIFY
... ...
@@ -72,7 +73,7 @@
72 72
  * [Client session continues]
73 73
  *
74 74
  * FUNC: openvpn_plugin_func_v1 OPENVPN_PLUGIN_CLIENT_DISCONNECT
75
- * FUNC: openvpn_plugin_client_constructor_v1
75
+ * FUNC: openvpn_plugin_client_destructor_v1
76 76
  *
77 77
  * [ some time may pass ]
78 78
  *
... ...
@@ -1366,15 +1366,25 @@ to be between 100 bytes/sec and 100 Mbytes/sec.
1366 1366
 .B \-\-inactive n [bytes]
1367 1367
 Causes OpenVPN to exit after
1368 1368
 .B n
1369
-seconds of inactivity on the TUN/TAP device.  The time length
1370
-of inactivity is measured since the last incoming tunnel packet.
1369
+seconds of inactivity on the TUN/TAP device. The time length of
1370
+inactivity is measured since the last incoming or outgoing tunnel
1371
+packet.
1371 1372
 
1372 1373
 If the optional
1373 1374
 .B bytes
1374 1375
 parameter is included,
1375
-exit after n seconds of activity on tun/tap device
1376
-produces a combined in/out byte count that is less than
1377
-.B bytes.
1376
+exit if less than
1377
+.B bytes
1378
+of combined in/out traffic are produced on the tun/tap device
1379
+in
1380
+.B n
1381
+seconds.
1382
+
1383
+In any case, OpenVPN's internal ping packets (which are just
1384
+keepalives) and TLS control packets are not considered
1385
+"activity", nor are they counted as traffic, as they are used
1386
+internally by OpenVPN and are not an indication of actual user
1387
+activity.
1378 1388
 .\"*********************************************************
1379 1389
 .TP
1380 1390
 .B \-\-ping n
... ...
@@ -3507,6 +3507,15 @@ msglevel_forward_compatible (struct options *options, const int msglevel)
3507 3507
 }
3508 3508
 
3509 3509
 static void
3510
+warn_multiple_script (const char *script, const char *type) {
3511
+      if (script) {
3512
+	msg (M_WARN, "Multiple --%s scripts defined.  "
3513
+	     "The previously configured script is overridden.", type);
3514
+      }
3515
+}
3516
+
3517
+
3518
+static void
3510 3519
 add_option (struct options *options,
3511 3520
 	    char *p[],
3512 3521
 	    const char *file,
... ...
@@ -3906,6 +3915,7 @@ add_option (struct options *options,
3906 3906
       VERIFY_PERMISSION (OPT_P_SCRIPT);
3907 3907
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
3908 3908
 	goto err;
3909
+      warn_multiple_script (options->ipchange, "ipchange");
3909 3910
       options->ipchange = string_substitute (p[1], ',', ' ', &options->gc);
3910 3911
     }
3911 3912
   else if (streq (p[0], "float"))
... ...
@@ -3952,6 +3962,7 @@ add_option (struct options *options,
3952 3952
       VERIFY_PERMISSION (OPT_P_SCRIPT);
3953 3953
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
3954 3954
 	goto err;
3955
+      warn_multiple_script (options->up_script, "up");
3955 3956
       options->up_script = p[1];
3956 3957
     }
3957 3958
   else if (streq (p[0], "down") && p[1])
... ...
@@ -3959,6 +3970,7 @@ add_option (struct options *options,
3959 3959
       VERIFY_PERMISSION (OPT_P_SCRIPT);
3960 3960
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
3961 3961
 	goto err;
3962
+      warn_multiple_script (options->down_script, "down");
3962 3963
       options->down_script = p[1];
3963 3964
     }
3964 3965
   else if (streq (p[0], "down-pre"))
... ...
@@ -4627,6 +4639,7 @@ add_option (struct options *options,
4627 4627
       VERIFY_PERMISSION (OPT_P_SCRIPT);
4628 4628
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
4629 4629
 	goto err;
4630
+      warn_multiple_script (options->route_script, "route-up");
4630 4631
       options->route_script = p[1];
4631 4632
     }
4632 4633
   else if (streq (p[0], "route-noexec"))
... ...
@@ -4956,6 +4969,7 @@ add_option (struct options *options,
4956 4956
 	  msg (msglevel, "--auth-user-pass-verify requires a second parameter ('via-env' or 'via-file')");
4957 4957
 	  goto err;
4958 4958
 	}
4959
+      warn_multiple_script (options->auth_user_pass_verify_script, "auth-user-pass-verify");
4959 4960
       options->auth_user_pass_verify_script = p[1];
4960 4961
     }
4961 4962
   else if (streq (p[0], "client-connect") && p[1])
... ...
@@ -4963,6 +4977,7 @@ add_option (struct options *options,
4963 4963
       VERIFY_PERMISSION (OPT_P_SCRIPT);
4964 4964
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
4965 4965
 	goto err;
4966
+      warn_multiple_script (options->client_connect_script, "client-connect");
4966 4967
       options->client_connect_script = p[1];
4967 4968
     }
4968 4969
   else if (streq (p[0], "client-disconnect") && p[1])
... ...
@@ -4970,6 +4985,7 @@ add_option (struct options *options,
4970 4970
       VERIFY_PERMISSION (OPT_P_SCRIPT);
4971 4971
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
4972 4972
 	goto err;
4973
+      warn_multiple_script (options->client_disconnect_script, "client-disconnect");
4973 4974
       options->client_disconnect_script = p[1];
4974 4975
     }
4975 4976
   else if (streq (p[0], "learn-address") && p[1])
... ...
@@ -4977,6 +4993,7 @@ add_option (struct options *options,
4977 4977
       VERIFY_PERMISSION (OPT_P_SCRIPT);
4978 4978
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
4979 4979
 	goto err;
4980
+      warn_multiple_script (options->learn_address_script, "learn-address");
4980 4981
       options->learn_address_script = p[1];
4981 4982
     }
4982 4983
   else if (streq (p[0], "tmp-dir") && p[1])
... ...
@@ -5750,6 +5767,7 @@ add_option (struct options *options,
5750 5750
       VERIFY_PERMISSION (OPT_P_SCRIPT);
5751 5751
       if (!no_more_than_n_args (msglevel, p, 2, NM_QUOTE_HINT))
5752 5752
 	goto err;
5753
+      warn_multiple_script (options->tls_verify, "tls-verify");
5753 5754
       options->tls_verify = string_substitute (p[1], ',', ' ', &options->gc);
5754 5755
     }
5755 5756
   else if (streq (p[0], "tls-export-cert") && p[1])
... ...
@@ -86,5 +86,7 @@ check_ping_send_dowork (struct context *c)
86 86
    * encrypt, sign, etc.
87 87
    */
88 88
   encrypt_sign (c, true);
89
+  /* Set length to 0, so it won't be counted as activity */
90
+  c->c2.buf.len = 0;
89 91
   dmsg (D_PING, "SENT PING");
90 92
 }