Projet

Général

Profil

« Précédent | Suivant » 

Révision 572f6ccc

Ajouté par jim-p il y a plus de 9 ans

Fix guess_interface_from_ip() to account for differences in netstat output. Fixes #3853

Voir les différences:

etc/inc/interfaces.inc
4372 4372
	}
4373 4373
	if(is_ipaddrv4($ipaddress)) {
4374 4374
		/* create a route table we can search */
4375
		exec("netstat -rnWf inet", $output, $ret);
4375
		exec("/usr/bin/netstat -rnWf inet", $output, $ret);
4376 4376
		foreach($output as $line) {
4377 4377
			if(preg_match("/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\/[0-9]+[ ]+link[#]/", $line)) {
4378 4378
				$fields = preg_split("/[ ]+/", $line);
4379 4379
				if(ip_in_subnet($ipaddress, $fields[0])) {
4380
					return $fields[6];
4380
					return $fields[5];
4381 4381
				}
4382 4382
			}
4383 4383
		}
......
4385 4385
	/* FIXME: This works from cursory testing, regexp might need fine tuning */
4386 4386
	if(is_ipaddrv6($ipaddress)) {
4387 4387
		/* create a route table we can search */
4388
		exec("netstat -rnWf inet6", $output, $ret);
4388
		exec("/usr/bin/netstat -rnWf inet6", $output, $ret);
4389 4389
		foreach($output as $line) {
4390 4390
			if(preg_match("/[0-9a-f]+[:]+[0-9a-f]+[:]+[\/][0-9]+/", $line)) {
4391 4391
				$fields = preg_split("/[ ]+/", $line);
4392 4392
				if(ip_in_subnet($ipaddress, $fields[0])) {
4393
					return $fields[6];
4393
					return $fields[5];
4394 4394
				}
4395 4395
			}
4396 4396
		}

Formats disponibles : Unified diff