int handlenetworking(void)
{
	int done;
	int choice;
	char errormessage[STRING_SIZE];
	
	netaddresschange = 0;

	done = 0;
	while (!done)
	{
		choice = firstmenu();
			
		switch (choice)
		{
			case 1:
				configtypemenu();
				break;

			case 2:
				drivermenu();
				break;
							
			case 3:
				addressesmenu();
				break;
			
			case 4:
				dnsgatewaymenu();
				break;
				
			case 0:
				if (oktoleave(errormessage))
					done = 1;
				else
					errorbox(errormessage);
				break;
				
			default:
				break;
		}				
	}

	if (automode == 0)
	{
		/* Restart netowrking!  Reboot?  BAH! */	
		if (netaddresschange)
		{
			runcommandwithstatus("/etc/rc.d/rc.netaddress.down",
				ctr[TR_PUSHING_NETWORK_DOWN]);
			runcommandwithstatus("/etc/rc.d/rc.netaddress.up",
				ctr[TR_PULLING_NETWORK_UP]);
		}
	}
	
	return 1;
}
Exemplo n.º 2
0
int handlenetworking(void)
{
	int done;
	int choice;
	int found;
	
	netaddresschange = 0;

	found =	scan_network_cards();
	found = init_knics();

	done = 0;
	while (!done)
	{
		choice = firstmenu();
			
		switch (choice)
		{
			case 1:
				configtypemenu();
				break;

			case 2:
				drivermenu();
				break;
							
			case 3:
				addressesmenu();
				break;
			
			case 4:
				dnsgatewaymenu();
				break;
				
			case 0:
				if (oktoleave()) done = 1;
				break;
				
			default:
				break;
		}				
	}

	if (automode == 0)
	{
		/* Restart networking! */	
		if (netaddresschange)
		{
			runcommandwithstatus("/etc/rc.d/init.d/network stop",
				_("Networking"), _("Stopping network..."), NULL);

			rename_nics();

			runcommandwithstatus("/etc/rc.d/init.d/network start",
				_("Networking"), _("Restarting network..."), NULL);
			runcommandwithstatus("/etc/rc.d/init.d/unbound restart",
				_("Networking"), _("Restarting unbound..."), NULL);
		}
	} else {
		rename_nics();
	}
	return 1;
}