BOOL create_subnets(void)
{
- int num_interfaces = iface_count();
+ int num_interfaces;
int i;
struct in_addr unicast_ip, ipzero;
- if(num_interfaces == 0) {
- void (*saved_handler)(int);
+ try_interfaces_again:
+ if (iface_count() == 0) {
DEBUG(0,("create_subnets: No local interfaces !\n"));
DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
+ }
+
+ while (iface_count() == 0) {
+ void (*saved_handler)(int);
/*
* Whilst we're waiting for an interface, allow SIGTERM to
saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
- while (iface_count() == 0) {
- sleep(5);
- load_interfaces();
- }
+ sleep(5);
+ load_interfaces();
/*
* We got an interface, restore our normal term handler.
/* We must have at least one subnet. */
if (subnetlist == NULL) {
- DEBUG(0,("create_subnets: unable to create any subnet from "
- "given interfaces. nmbd is terminating\n"));
- return False;
+ void (*saved_handler)(int);
+
+ DEBUG(0,("create_subnets: Unable to create any subnet from "
+ "given interfaces. Is your interface line in "
+ "smb.conf correct ?\n"));
+
+ saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
+
+ sleep(5);
+ load_interfaces();
+
+ CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
+ goto try_interfaces_again;
}
if (lp_we_are_a_wins_server()) {