… | |
… | |
330 | } |
330 | } |
331 | |
331 | |
332 | fcntl (tap->fd, F_SETFD, FD_CLOEXEC); |
332 | fcntl (tap->fd, F_SETFD, FD_CLOEXEC); |
333 | |
333 | |
334 | run_script_cb cb; |
334 | run_script_cb cb; |
|
|
335 | cb.set<vpn, &vpn::script_if_init> (this); |
335 | |
336 | |
336 | callback_set (cb, this, vpn, script_if_init); |
|
|
337 | if (tap->if_up () && |
337 | if (tap->if_up () && |
338 | !run_script (cb, true)) |
338 | !run_script (cb, true)) |
339 | { |
339 | { |
340 | slog (L_ERR, _("interface initialization command '%s' failed, exiting."), |
340 | slog (L_ERR, _("interface initialization command '%s' failed, exiting."), |
341 | tap->if_up ()); |
341 | tap->if_up ()); |
342 | exit (EXIT_FAILURE); |
342 | exit (EXIT_FAILURE); |
343 | } |
343 | } |
344 | |
344 | |
345 | callback_set (cb, this, vpn, script_if_up); |
345 | cb.set<vpn, &vpn::script_if_up> (this); |
346 | if (!run_script (cb, true)) |
346 | if (!run_script (cb, true)) |
347 | { |
347 | { |
348 | slog (L_ERR, _("if-up command execution failed, exiting.")); |
348 | slog (L_ERR, _("if-up command execution failed, exiting.")); |
349 | exit (EXIT_FAILURE); |
349 | exit (EXIT_FAILURE); |
350 | } |
350 | } |
… | |
… | |
780 | |
780 | |
781 | slog (L_NOTICE, _("END status dump")); |
781 | slog (L_NOTICE, _("END status dump")); |
782 | } |
782 | } |
783 | |
783 | |
784 | vpn::vpn (void) |
784 | vpn::vpn (void) |
|
|
785 | { |
785 | : event (this, &vpn::event_cb) |
786 | event .set<vpn, &vpn::event_cb > (this); |
786 | , udpv4_ev_watcher (this, &vpn::udpv4_ev) |
787 | udpv4_ev_watcher .set<vpn, &vpn::udpv4_ev > (this); |
787 | , ipv4_ev_watcher (this, &vpn::ipv4_ev) |
788 | ipv4_ev_watcher .set<vpn, &vpn::ipv4_ev > (this); |
788 | #if ENABLE_TCP |
789 | #if ENABLE_TCP |
789 | , tcpv4_ev_watcher (this, &vpn::tcpv4_ev) |
790 | tcpv4_ev_watcher .set<vpn, &vpn::tcpv4_ev > (this); |
790 | #endif |
791 | #endif |
791 | #if ENABLE_ICMP |
792 | #if ENABLE_ICMP |
792 | , icmpv4_ev_watcher(this, &vpn::icmpv4_ev) |
793 | icmpv4_ev_watcher.set<vpn, &vpn::icmpv4_ev> (this); |
793 | #endif |
794 | #endif |
794 | #if ENABLE_DNS |
795 | #if ENABLE_DNS |
795 | , dnsv4_ev_watcher (this, &vpn::dnsv4_ev) |
796 | dnsv4_ev_watcher .set<vpn, &vpn::dnsv4_ev > (this); |
796 | #endif |
797 | #endif |
797 | , tap_ev_watcher (this, &vpn::tap_ev) |
798 | tap_ev_watcher .set<vpn, &vpn::tap_ev > (this); |
798 | { |
|
|
799 | } |
799 | } |
800 | |
800 | |
801 | vpn::~vpn () |
801 | vpn::~vpn () |
802 | { |
802 | { |
803 | } |
803 | } |