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.23 by pcg, Thu Jan 29 18:55:10 2004 UTC vs.
Revision 1.24 by pcg, Fri Apr 2 14:42:45 2004 UTC

223 223
224 tcpv4_ev_watcher.start (tcpv4_fd, EVENT_READ); 224 tcpv4_ev_watcher.start (tcpv4_fd, EVENT_READ);
225 } 225 }
226#endif 226#endif
227 227
228#if ENABLE_DNS
229 if (THISNODE->protocols & PROT_DNSv4)
230 {
231 dnsv4_fd = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP);
232
233 if (dnsv4_fd < 0)
234 return -1;
235
236 // standard daemon practise...
237 {
238 int oval = 1;
239 setsockopt (tcpv4_fd, SOL_SOCKET, SO_REUSEADDR, &oval, sizeof oval);
240 }
241
242 sockinfo si (THISNODE, PROT_DNSv4);
243
244 if (bind (dnsv4_fd, si.sav4 (), si.salenv4 ()))
245 {
246 slog (L_ERR, _("can't bind dnsv4 on %s: %s"), (const char *)si, strerror (errno));
247 exit (EXIT_FAILURE);
248 }
249
250 dnsv4_ev_watcher.start (dnsv4_fd, EVENT_READ);
251 }
252#endif
253
228 tap = new tap_device (); 254 tap = new tap_device ();
229 if (!tap) //D this, of course, never catches 255 if (!tap) //D this, of course, never catches
230 { 256 {
231 slog (L_ERR, _("cannot create network interface '%s'"), conf.ifname); 257 slog (L_ERR, _("cannot create network interface '%s'"), conf.ifname);
232 exit (EXIT_FAILURE); 258 exit (EXIT_FAILURE);
259#endif 285#endif
260 286
261#if ENABLE_ICMP 287#if ENABLE_ICMP
262 case PROT_ICMPv4: 288 case PROT_ICMPv4:
263 return send_icmpv4_packet (pkt, si, tos); 289 return send_icmpv4_packet (pkt, si, tos);
290#endif
291
292#if ENABLE_DNS
293 case PROT_DNSv4:
294 return send_dnsv4_packet (pkt, si, tos);
264#endif 295#endif
265 296
266 default: 297 default:
267 slog (L_CRIT, _("%s: FATAL: trying to send packet with unsupported protocol"), (const char *)si); 298 slog (L_CRIT, _("%s: FATAL: trying to send packet with unsupported protocol"), (const char *)si);
268 return false; 299 return false;
572 if (events & EVENT_SHUTDOWN) 603 if (events & EVENT_SHUTDOWN)
573 { 604 {
574 slog (L_INFO, _("preparing shutdown...")); 605 slog (L_INFO, _("preparing shutdown..."));
575 606
576 shutdown_all (); 607 shutdown_all ();
577 remove_pid (pidfilename); 608 remove_pid (conf.pidfilename);
578 slog (L_INFO, _("terminating")); 609 slog (L_INFO, _("terminating"));
579 exit (EXIT_SUCCESS); 610 exit (EXIT_SUCCESS);
580 } 611 }
581 612
582 if (events & EVENT_RECONNECT) 613 if (events & EVENT_RECONNECT)
685, tcpv4_ev_watcher (this, &vpn::tcpv4_ev) 716, tcpv4_ev_watcher (this, &vpn::tcpv4_ev)
686#endif 717#endif
687#if ENABLE_ICMP 718#if ENABLE_ICMP
688, icmpv4_ev_watcher(this, &vpn::icmpv4_ev) 719, icmpv4_ev_watcher(this, &vpn::icmpv4_ev)
689#endif 720#endif
721#if ENABLE_DNS
722, dnsv4_ev_watcher (this, &vpn::dnsv4_ev)
723#endif
690, tap_ev_watcher (this, &vpn::tap_ev) 724, tap_ev_watcher (this, &vpn::tap_ev)
691{ 725{
692} 726}
693 727
694vpn::~vpn () 728vpn::~vpn ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines