Projet

Général

Profil

« Précédent | Suivant » 

Révision 8d6c5f66

Ajouté par Renato Botelho il y a presque 10 ans

Delete all ip aliases when interface is disabled, it should fix #3650

Voir les différences:

etc/inc/interfaces.inc
1241 1241
		unlink_if_exists("{$g['varetc_path']}/dhclient_{$interface}.conf");
1242 1242
		if(does_interface_exist("$realif")) {
1243 1243
			mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " delete", true);
1244
			interface_ipalias_cleanup($interface);
1244 1245
			if ($destroy == true)
1245 1246
				pfSense_interface_flags($realif, -IFF_UP);
1246 1247
			mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a");
......
1249 1250
	default:
1250 1251
		if(does_interface_exist("$realif")) {
1251 1252
			mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " delete", true);
1253
			interface_ipalias_cleanup($interface);
1252 1254
			if ($destroy == true)
1253 1255
				pfSense_interface_flags($realif, -IFF_UP);
1254 1256
			mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a");
......
1269 1271
			$ip6 = find_interface_ipv6($realifv6);
1270 1272
			if (is_ipaddrv6($ip6) && $ip6 != "::")
1271 1273
				mwexec("/sbin/ifconfig " . escapeshellarg($realifv6) . " inet6 {$ip6} delete", true);
1274
			interface_ipalias_cleanup($interface, "inet6");
1272 1275
			if ($destroy == true)
1273 1276
				pfSense_interface_flags($realif, -IFF_UP);
1274 1277
			mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a");
......
1282 1285
			$ip6 = get_interface_ipv6($interface);
1283 1286
			if (is_ipaddrv6($ip6))
1284 1287
				mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true);
1288
			interface_ipalias_cleanup($interface, "inet6");
1285 1289
			if ($destroy == true)
1286 1290
				pfSense_interface_flags($realif, -IFF_UP);
1287 1291
		}
......
1294 1298
				mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ip6} delete", true);
1295 1299
			if (!empty($ifcfg['ipaddrv6']) && is_ipaddrv6($ifcfg['ipaddrv6']))
1296 1300
				mwexec("/sbin/ifconfig " . escapeshellarg($realif) . " inet6 {$ifcfg['ipaddrv6']} delete", true);
1301
			interface_ipalias_cleanup($interface, "inet6");
1297 1302
			if ($destroy == true)
1298 1303
				pfSense_interface_flags($realif, -IFF_UP);
1299 1304
			mwexec("/usr/sbin/arp -d -i " . escapeshellarg($realif) . " -a");
......
2093 2098
}
2094 2099

  
2095 2100
function interface_ipalias_configure(&$vip) {
2096
	if ($vip['mode'] == "ipalias") {
2097
		$if = get_real_interface($vip['interface']);
2098
		$af = "inet";
2099
		if(is_ipaddrv6($vip['subnet']))
2100
			$af = "inet6";
2101
		mwexec("/sbin/ifconfig " . escapeshellarg($if) ." {$af} ". escapeshellarg($vip['subnet']) ."/" . escapeshellarg($vip['subnet_bits']) . " alias");
2102
	}
2101
	global $config;
2102

  
2103
	if ($vip['mode'] != "ipalias")
2104
		return;
2105

  
2106
	if (!isset($config['interfaces'][$vip['interface']]))
2107
		return;
2108

  
2109
	if (!isset($config['interfaces'][$vip['interface']]['enable']))
2110
		return;
2111

  
2112
	$if = get_real_interface($vip['interface']);
2113
	$af = "inet";
2114
	if(is_ipaddrv6($vip['subnet']))
2115
		$af = "inet6";
2116
	mwexec("/sbin/ifconfig " . escapeshellarg($if) ." {$af} ". escapeshellarg($vip['subnet']) ."/" . escapeshellarg($vip['subnet_bits']) . " alias");
2103 2117
}
2104 2118

  
2105 2119
function interface_reload_carps($cif) {

Formats disponibles : Unified diff