Project

General

Profile

« Previous | Next » 

Revision 323f3f9c

Added by Seth Mos over 14 years ago

Keep a table of gateways we added for static routes to prevent us from making multiple entries to the same IP address

View differences:

etc/inc/upgrade_config.inc
790 790
	$gateways = return_gateways_array(true);
791 791
	$i = 0;
792 792
	if (is_array($config['staticroutes']['route'])) {
793
		$gwmap = array();
793 794
		foreach ($config['staticroutes']['route'] as $idx => $sroute) {
794 795
			$found = false;
795 796
			foreach ($gateways as $gwname => $gw) {
......
799 800
					break;
800 801
				}
801 802
			}
803
			if($gwmap[$sroute['gateway']]) {
804
				/* We already added a gateway name for this IP */
805
				$config['staticroutes']['route'][$idx]['gateway'] = "{$gwmap[$sroute['gateway']]}";
806
				$found = true;
807
			}			
802 808
			if ($found == false) {
803 809
				$gateway = array();
804
				$gateway['name'] = "SROUTE{$i}";	
810
				$gateway['name'] = "SROUTE{$i}";
811
				$gwmap[$sroute['gateway']] = $gateway['name'];
805 812
				$gateway['gateway'] = $sroute['gateway'];
806 813
				$gateway['interface'] = $sroute['interface'];
807 814
				$gateway['descr'] = "Upgraded static route for {$sroute['network']}";

Also available in: Unified diff