… | |
… | |
91 | rsachallenge chg; |
91 | rsachallenge chg; |
92 | }; |
92 | }; |
93 | |
93 | |
94 | struct rsa_cache : list<rsa_entry> |
94 | struct rsa_cache : list<rsa_entry> |
95 | { |
95 | { |
96 | void cleaner_cb (ev::timer &w, int revents); ev::timer cleaner; |
96 | inline void cleaner_cb (ev::timer &w, int revents); ev::timer cleaner; |
97 | |
97 | |
98 | bool find (const rsaid &id, rsachallenge &chg) |
98 | bool find (const rsaid &id, rsachallenge &chg) |
99 | { |
99 | { |
100 | for (iterator i = begin (); i != end (); ++i) |
100 | for (iterator i = begin (); i != end (); ++i) |
101 | { |
101 | { |
… | |
… | |
745 | send_vpn_packet (r, si); |
745 | send_vpn_packet (r, si); |
746 | |
746 | |
747 | delete r; |
747 | delete r; |
748 | } |
748 | } |
749 | |
749 | |
750 | void |
750 | inline void |
751 | connection::establish_connection_cb (ev::timer &w, int revents) |
751 | connection::establish_connection_cb (ev::timer &w, int revents) |
752 | { |
752 | { |
753 | if (!ictx |
753 | if (!ictx |
754 | && conf != THISNODE |
754 | && conf != THISNODE |
755 | && connectmode != conf_node::C_NEVER |
755 | && connectmode != conf_node::C_NEVER |
… | |
… | |
839 | send_reset (si); |
839 | send_reset (si); |
840 | |
840 | |
841 | reset_connection (); |
841 | reset_connection (); |
842 | } |
842 | } |
843 | |
843 | |
844 | void |
844 | inline void |
845 | connection::rekey_cb (ev::timer &w, int revents) |
845 | connection::rekey_cb (ev::timer &w, int revents) |
846 | { |
846 | { |
847 | reset_connection (); |
847 | reset_connection (); |
848 | establish_connection (); |
848 | establish_connection (); |
849 | } |
849 | } |
… | |
… | |
1176 | send_reset (rsi); |
1176 | send_reset (rsi); |
1177 | break; |
1177 | break; |
1178 | } |
1178 | } |
1179 | } |
1179 | } |
1180 | |
1180 | |
|
|
1181 | inline void |
1181 | void connection::keepalive_cb (ev::timer &w, int revents) |
1182 | connection::keepalive_cb (ev::timer &w, int revents) |
1182 | { |
1183 | { |
1183 | if (ev_now () >= last_activity + ::conf.keepalive + 30) |
1184 | if (ev_now () >= last_activity + ::conf.keepalive + 30) |
1184 | { |
1185 | { |
1185 | reset_connection (); |
1186 | reset_connection (); |
1186 | establish_connection (); |
1187 | establish_connection (); |
… | |
… | |
1231 | asprintf (&env, "DESTNODE=%s", conf->nodename); putenv (env); |
1232 | asprintf (&env, "DESTNODE=%s", conf->nodename); putenv (env); |
1232 | asprintf (&env, "DESTIP=%s", si.ntoa ()); putenv (env); |
1233 | asprintf (&env, "DESTIP=%s", si.ntoa ()); putenv (env); |
1233 | asprintf (&env, "DESTPORT=%d", ntohs (si.port)); putenv (env); |
1234 | asprintf (&env, "DESTPORT=%d", ntohs (si.port)); putenv (env); |
1234 | } |
1235 | } |
1235 | |
1236 | |
|
|
1237 | inline const char * |
1236 | const char *connection::script_node_up () |
1238 | connection::script_node_up () |
1237 | { |
1239 | { |
1238 | script_init_connect_env (); |
1240 | script_init_connect_env (); |
1239 | |
1241 | |
1240 | putenv ((char *)"STATE=up"); |
1242 | putenv ((char *)"STATE=up"); |
1241 | |
1243 | |
… | |
… | |
1246 | ::conf.script_node_up ? ::conf.script_node_up : "node-up"); |
1248 | ::conf.script_node_up ? ::conf.script_node_up : "node-up"); |
1247 | |
1249 | |
1248 | return filename; |
1250 | return filename; |
1249 | } |
1251 | } |
1250 | |
1252 | |
|
|
1253 | inline const char * |
1251 | const char *connection::script_node_down () |
1254 | connection::script_node_down () |
1252 | { |
1255 | { |
1253 | script_init_connect_env (); |
1256 | script_init_connect_env (); |
1254 | |
1257 | |
1255 | putenv ((char *)"STATE=down"); |
1258 | putenv ((char *)"STATE=down"); |
1256 | |
1259 | |