Ticket #284: openvpn-2.3.1-up-pre.patch
File openvpn-2.3.1-up-pre.patch, 4.7 KB (added by , 9 years ago) |
---|
-
openvpn-2.3.1
diff -Naur openvpn-2.3.1.orig/ChangeLog openvpn-2.3.1/ChangeLog
old new 1 1 OpenVPN Change Log 2 2 Copyright (C) 2002-2012 OpenVPN Technologies, Inc. <sales@openvpn.net> 3 3 4 Simon Matter (1): 5 Add --up-pre flag to cause --up script to be called before TUN/TAP open (rather than after). 6 4 7 2013.03.29 -- Version 2.3.1 5 8 Arne Schwabe (4): 6 9 Remove dead code path and putenv functionality -
doc/openvpn.8
diff -Naur openvpn-2.3.1.orig/doc/openvpn.8 openvpn-2.3.1/doc/openvpn.8
old new 1800 1800 .B route add -net 10.0.0.0 netmask 255.255.255.0 gw $5 1801 1801 .\"********************************************************* 1802 1802 .TP 1803 .B \-\-up-pre 1804 Call 1805 .B \-\-up 1806 cmd/script before, rather than after, TUN/TAP open. 1807 .\"********************************************************* 1808 .TP 1803 1809 .B \-\-up-delay 1804 1810 Delay TUN/TAP open and possible 1805 1811 .B \-\-up -
src/openvpn/init.c
diff -Naur openvpn-2.3.1.orig/src/openvpn/init.c openvpn-2.3.1/src/openvpn/init.c
old new 1404 1404 1405 1405 if (!c->c1.tuntap) 1406 1406 { 1407 /* actually run the up script based on --up-pre flag */ 1408 if (c->options.up_pre) 1409 run_up_down (c->options.up_script, 1410 c->plugins, 1411 OPENVPN_PLUGIN_UP, 1412 "[unknown-dev]", 1413 dev_type_string (c->options.dev, c->options.dev_type), 1414 TUN_MTU_SIZE (&c->c2.frame), 1415 EXPANDED_SIZE (&c->c2.frame), 1416 NULL, 1417 NULL, 1418 "init", 1419 NULL, 1420 "up", 1421 c->c2.es); 1422 1407 1423 /* initialize (but do not open) tun/tap object */ 1408 1424 do_init_tun (c); 1409 1425 … … 1444 1460 do_ifconfig (c->c1.tuntap, c->c1.tuntap->actual_name, TUN_MTU_SIZE (&c->c2.frame), c->c2.es); 1445 1461 } 1446 1462 1447 /* run the up script */ 1448 run_up_down (c->options.up_script, 1449 c->plugins, 1450 OPENVPN_PLUGIN_UP, 1451 c->c1.tuntap->actual_name, 1452 dev_type_string (c->options.dev, c->options.dev_type), 1453 TUN_MTU_SIZE (&c->c2.frame), 1454 EXPANDED_SIZE (&c->c2.frame), 1455 print_in_addr_t (c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc), 1456 print_in_addr_t (c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc), 1457 "init", 1458 NULL, 1459 "up", 1460 c->c2.es); 1463 /* actually run the up script based on --up-pre flag */ 1464 if (!c->options.up_pre) 1465 run_up_down (c->options.up_script, 1466 c->plugins, 1467 OPENVPN_PLUGIN_UP, 1468 c->c1.tuntap->actual_name, 1469 dev_type_string (c->options.dev, c->options.dev_type), 1470 TUN_MTU_SIZE (&c->c2.frame), 1471 EXPANDED_SIZE (&c->c2.frame), 1472 print_in_addr_t (c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc), 1473 print_in_addr_t (c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc), 1474 "init", 1475 NULL, 1476 "up", 1477 c->c2.es); 1461 1478 1462 1479 /* possibly add routes */ 1463 1480 if (!c->options.route_delay_defined) -
src/openvpn/options.c
diff -Naur openvpn-2.3.1.orig/src/openvpn/options.c openvpn-2.3.1/src/openvpn/options.c
old new 313 313 " Execute as: cmd tun/tap-dev tun-mtu link-mtu \\\n" 314 314 " ifconfig-local-ip ifconfig-remote-ip\n" 315 315 " (pre --user or --group UID/GID change)\n" 316 "--up-pre : Run --up command before TUN/TAP open.\n" 316 317 "--up-delay : Delay tun/tap open and possible --up script execution\n" 317 318 " until after TCP/UDP connection establishment with peer.\n" 318 319 "--down cmd : Run command cmd after tun device close.\n" … … 1481 1482 SHOW_STR (up_script); 1482 1483 SHOW_STR (down_script); 1483 1484 SHOW_BOOL (down_pre); 1485 SHOW_BOOL (up_pre); 1484 1486 SHOW_BOOL (up_restart); 1485 1487 SHOW_BOOL (up_delay); 1486 1488 SHOW_BOOL (daemon); … … 4543 4545 VERIFY_PERMISSION (OPT_P_GENERAL); 4544 4546 options->down_pre = true; 4545 4547 } 4548 else if (streq (p[0], "up-pre")) 4549 { 4550 VERIFY_PERMISSION (OPT_P_GENERAL); 4551 options->up_pre = true; 4552 } 4546 4553 else if (streq (p[0], "up-delay")) 4547 4554 { 4548 4555 VERIFY_PERMISSION (OPT_P_GENERAL); -
src/openvpn/options.h
diff -Naur openvpn-2.3.1.orig/src/openvpn/options.h openvpn-2.3.1/src/openvpn/options.h
old new 286 286 const char *up_script; 287 287 const char *down_script; 288 288 bool down_pre; 289 bool up_pre; 289 290 bool up_delay; 290 291 bool up_restart; 291 292 bool daemon;