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

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

58 mtu -= mtu % EVP_CIPHER_block_size (CIPHER); // round 58 mtu -= mtu % EVP_CIPHER_block_size (CIPHER); // round
59 mtu -= ETH_OVERHEAD - 6 - 6; // and get interface mtu again 59 mtu -= ETH_OVERHEAD - 6 - 6; // and get interface mtu again
60 60
61 char *env; 61 char *env;
62 asprintf (&env, "CONFBASE=%s", confbase); putenv (env); 62 asprintf (&env, "CONFBASE=%s", confbase); putenv (env);
63 asprintf (&env, "NODENAME=%s", THISNODE->nodename); putenv (env);
64 asprintf (&env, "NODEID=%d", THISNODE->id); putenv (env);
65 asprintf (&env, "IFNAME=%s", tap->interface ()); putenv (env); 63 asprintf (&env, "IFNAME=%s", tap->interface ()); putenv (env);
66 asprintf (&env, "IFTYPE=%s", IFTYPE); putenv (env); 64 asprintf (&env, "IFTYPE=%s", IFTYPE); putenv (env);
67 asprintf (&env, "IFSUBTYPE=%s", IFSUBTYPE); putenv (env); 65 asprintf (&env, "IFSUBTYPE=%s", IFSUBTYPE); putenv (env);
68 asprintf (&env, "MTU=%d", mtu); putenv (env); 66 asprintf (&env, "MTU=%d", mtu); putenv (env);
69 asprintf (&env, "MAC=%02x:%02x:%02x:%02x:%02x:%02x", 67 asprintf (&env, "NODES=%d", conns.size ()); putenv (env);
70 0xfe, 0xfd, 0x80, 0x00, THISNODE->id >> 8, 68 asprintf (&env, "NODEID=%d", THISNODE->id); putenv (env);
71 THISNODE->id & 0xff); putenv (env);
72 69
73 // TODO: info for other nodes, maybe? 70 conns [THISNODE->id - 1]->script_init_env ("");
71
72 for (conns_vector::iterator c = conns.begin (); c != conns.end (); ++c)
73 {
74 char ext[16];
75 snprintf (ext, 16, "_%d", (*c)->conf->id);
76 (*c)->script_init_env (ext);
77 }
74} 78}
75 79
76const char *vpn::script_if_init () 80const char *vpn::script_if_init ()
77{ 81{
78 script_init_env (); 82 script_init_env ();
285 289
286 dnsv4_ev_watcher.start (dnsv4_fd, EVENT_READ); 290 dnsv4_ev_watcher.start (dnsv4_fd, EVENT_READ);
287 } 291 }
288#endif 292#endif
289 293
294 /////////////////////////////////////////////////////////////////////////////
295
296 reconnect_all ();
297
298 /////////////////////////////////////////////////////////////////////////////
299
290 tap = new tap_device (); 300 tap = new tap_device ();
291 if (!tap) //D this, of course, never catches 301 if (!tap) //D this, of course, never catches
292 { 302 {
293 slog (L_ERR, _("cannot create network interface '%s'"), conf.ifname); 303 slog (L_ERR, _("cannot create network interface '%s'"), conf.ifname);
294 exit (EXIT_FAILURE); 304 exit (EXIT_FAILURE);
307 slog (L_ERR, _("if-up command execution failed, exiting.")); 317 slog (L_ERR, _("if-up command execution failed, exiting."));
308 exit (EXIT_FAILURE); 318 exit (EXIT_FAILURE);
309 } 319 }
310 320
311 tap_ev_watcher.start (tap->fd, EVENT_READ); 321 tap_ev_watcher.start (tap->fd, EVENT_READ);
312
313 reconnect_all ();
314 322
315 return 0; 323 return 0;
316} 324}
317 325
318bool 326bool

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines