ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/connection.C
(Generate patch)

Comparing gvpe/src/connection.C (file contents):
Revision 1.52 by pcg, Wed Mar 23 21:55:39 2005 UTC vs.
Revision 1.53 by pcg, Sat Mar 26 03:16:24 2005 UTC

1169 send_vpn_packet (p, si); 1169 send_vpn_packet (p, si);
1170 1170
1171 delete p; 1171 delete p;
1172} 1172}
1173 1173
1174void connection::script_init_env (const char *ext)
1175{
1176 char *env;
1177 asprintf (&env, "IFUPDATA%s=%s", ext, conf->if_up_data); putenv (env);
1178 asprintf (&env, "NODENAME%s=%s", ext, conf->nodename); putenv (env);
1179 asprintf (&env, "MAC%s=%02x:%02x:%02x:%02x:%02x:%02x", ext,
1180 0xfe, 0xfd, 0x80, 0x00, conf->id >> 8,
1181 conf->id & 0xff); putenv (env);
1182}
1183
1174void connection::script_init_env () 1184void connection::script_init_connect_env ()
1175{ 1185{
1176 vpn->script_init_env (); 1186 vpn->script_init_env ();
1177 1187
1178 char *env; 1188 char *env;
1179 asprintf (&env, "DESTID=%d", conf->id); putenv (env); 1189 asprintf (&env, "DESTID=%d", conf->id); putenv (env);
1182 asprintf (&env, "DESTPORT=%d", ntohs (si.port)); putenv (env); 1192 asprintf (&env, "DESTPORT=%d", ntohs (si.port)); putenv (env);
1183} 1193}
1184 1194
1185const char *connection::script_node_up () 1195const char *connection::script_node_up ()
1186{ 1196{
1187 script_init_env (); 1197 script_init_connect_env ();
1188 1198
1189 putenv ("STATE=up"); 1199 putenv ("STATE=up");
1190 1200
1191 char *filename; 1201 char *filename;
1192 asprintf (&filename, 1202 asprintf (&filename,
1195 ::conf.script_node_up ? ::conf.script_node_up : "node-up"); 1205 ::conf.script_node_up ? ::conf.script_node_up : "node-up");
1196} 1206}
1197 1207
1198const char *connection::script_node_down () 1208const char *connection::script_node_down ()
1199{ 1209{
1200 script_init_env (); 1210 script_init_connect_env ();
1201 1211
1202 putenv ("STATE=down"); 1212 putenv ("STATE=down");
1203 1213
1204 char *filename; 1214 char *filename;
1205 asprintf (&filename, 1215 asprintf (&filename,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines