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.50 by pcg, Sun Aug 10 02:49:21 2008 UTC vs.
Revision 1.51 by pcg, Sun Aug 10 14:48:57 2008 UTC

122} 122}
123 123
124int 124int
125vpn::setup () 125vpn::setup ()
126{ 126{
127 int success = 0;
128
127 ipv4_tos = -1; 129 ipv4_tos = -1;
128 ipv4_fd = -1; 130 ipv4_fd = -1;
129 131
130 if (THISNODE->protocols & PROT_IPv4 && ::conf.ip_proto) 132 if (THISNODE->protocols & PROT_IPv4 && ::conf.ip_proto)
131 { 133 {
154 slog (L_ERR, _("can't bind ipv4 socket on %s: %s, exiting."), (const char *)si, strerror (errno)); 156 slog (L_ERR, _("can't bind ipv4 socket on %s: %s, exiting."), (const char *)si, strerror (errno));
155 exit (EXIT_FAILURE); 157 exit (EXIT_FAILURE);
156 } 158 }
157 159
158 ipv4_ev_watcher.start (ipv4_fd, EV_READ); 160 ipv4_ev_watcher.start (ipv4_fd, EV_READ);
161 ++success;
159 } 162 }
163 else
164 THISNODE->protocols &= ~PROT_IPv4;
160 165
161 udpv4_tos = -1; 166 udpv4_tos = -1;
162 udpv4_fd = -1; 167 udpv4_fd = -1;
163 168
164 if (THISNODE->protocols & PROT_UDPv4 && THISNODE->udp_port) 169 if (THISNODE->protocols & PROT_UDPv4 && THISNODE->udp_port)
194 slog (L_ERR, _("can't bind udpv4 on %s: %s, exiting."), (const char *)si, strerror (errno)); 199 slog (L_ERR, _("can't bind udpv4 on %s: %s, exiting."), (const char *)si, strerror (errno));
195 exit (EXIT_FAILURE); 200 exit (EXIT_FAILURE);
196 } 201 }
197 202
198 udpv4_ev_watcher.start (udpv4_fd, EV_READ); 203 udpv4_ev_watcher.start (udpv4_fd, EV_READ);
204 ++success;
199 } 205 }
206 else
207 THISNODE->protocols &= ~PROT_UDPv4;
200 208
201 icmpv4_tos = -1; 209 icmpv4_tos = -1;
202 icmpv4_fd = -1; 210 icmpv4_fd = -1;
203 211
204#if ENABLE_ICMP 212#if ENABLE_ICMP
240 slog (L_ERR, _("can't bind icmpv4 on %s: %s, exiting."), (const char *)si, strerror (errno)); 248 slog (L_ERR, _("can't bind icmpv4 on %s: %s, exiting."), (const char *)si, strerror (errno));
241 exit (EXIT_FAILURE); 249 exit (EXIT_FAILURE);
242 } 250 }
243 251
244 icmpv4_ev_watcher.start (icmpv4_fd, EV_READ); 252 icmpv4_ev_watcher.start (icmpv4_fd, EV_READ);
253 ++success;
245 } 254 }
246#endif 255#endif
247 256
248 tcpv4_fd = -1; 257 tcpv4_fd = -1;
249 258
277 slog (L_ERR, _("can't listen tcpv4 on %s: %s, exiting."), (const char *)si, strerror (errno)); 286 slog (L_ERR, _("can't listen tcpv4 on %s: %s, exiting."), (const char *)si, strerror (errno));
278 exit (EXIT_FAILURE); 287 exit (EXIT_FAILURE);
279 } 288 }
280 289
281 tcpv4_ev_watcher.start (tcpv4_fd, EV_READ); 290 tcpv4_ev_watcher.start (tcpv4_fd, EV_READ);
291 ++success;
282 } 292 }
293 else
294 THISNODE->protocols &= ~PROT_TCPv4;
283#endif 295#endif
284 296
285 dnsv4_tos = -1; 297 dnsv4_tos = -1;
286 dnsv4_fd = -1; 298 dnsv4_fd = -1;
287 299
323 slog (L_ERR, _("can't bind dnsv4 on %s: %s, exiting."), (const char *)si, strerror (errno)); 335 slog (L_ERR, _("can't bind dnsv4 on %s: %s, exiting."), (const char *)si, strerror (errno));
324 exit (EXIT_FAILURE); 336 exit (EXIT_FAILURE);
325 } 337 }
326 338
327 dnsv4_ev_watcher.start (dnsv4_fd, EV_READ); 339 dnsv4_ev_watcher.start (dnsv4_fd, EV_READ);
340 ++success;
328 } 341 }
329#endif 342#endif
330 343
331 ///////////////////////////////////////////////////////////////////////////// 344 /////////////////////////////////////////////////////////////////////////////
345
346 if (!success)
347 {
348 slog (L_ERR, _("no protocols enabled, exiting."));
349 exit (EXIT_FAILURE);
350 }
332 351
333 reconnect_all (); 352 reconnect_all ();
334 353
335 ///////////////////////////////////////////////////////////////////////////// 354 /////////////////////////////////////////////////////////////////////////////
336 355

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines