Project

General

Profile

« Previous | Next » 

Revision e68cb72f

Added by David Wood over 9 years ago

Set temporary bogon (RFC 5737) IPv4 addresses when initialising PPP interfaces during boot to work round mpd5 IPv6CP issue causing random IPv6 interface identifiers

Details at https://forum.pfsense.org/index.php?topic=101967.msg570519#msg570519 .

View differences:

etc/inc/interfaces.inc
1818 1818
			unlink("{$g['var_path']}/spool/lock/LCK..{$port}");
1819 1819
	}
1820 1820

  
1821
	/* Set temporary bogon (RFC 5737) IPv4 address to work round mpd5 IPv6CP issue causing */
1821
	/* Set temporary bogon (RFC 5737) IPv4 addresses to work round mpd5 IPv6CP issue causing */
1822 1822
	/* random IPv6 interface identifier during boot. More details at */
1823 1823
	/* https://forum.pfsense.org/index.php?topic=101967.msg570519#msg570519 */
1824
	/* N.B. The current work round only supports PPPoE */
1825
	$tempaddr = false;
1826
	if (platform_booting() && $type == "pppoe" && is_array($ports) && !empty($ports[0])) {
1827
		$tempaddr = true;
1828
		$tempaddr_iface = get_real_interface($ports[0]);
1829
		if (!empty($tempaddr_iface)) {
1830
			mwexec("/sbin/ifconfig " . escapeshellarg($tempaddr_iface) . " inet 192.0.2.248/31 alias", true);
1824
	if (platform_booting() && is_array($config['interfaces'])) {
1825
		$count = 0;
1826
		foreach ($config['interfaces'] as $tempifacename => $tempiface) {
1827
			if ((isset($tempiface['if'])) && (isset($tempiface['ipaddr']) || isset($tempiface['ipaddrv6'])) && !interface_isppp_type($tempifacename)) {
1828
				$tempaddr[$count]['if'] = $tempiface['if'];
1829
				$tempaddr[$count]['ipaddr'] = '192.0.2.' . strval (10 + ($count * 2)) . '/31';
1830
				mwexec('/sbin/ifconfig ' . escapeshellarg($tempaddr[$count]['if']) . ' inet ' . escapeshellarg($tempaddr[$count]['ipaddr']) . ' alias', true);
1831
				$count++;
1832
			}
1833
			// Maximum /31 is is x.y.z.254/31
1834
			if ($count > 122) {
1835
				break;
1836
			}
1831 1837
		}
1838
		unset($count);
1832 1839
	}
1833 1840

  
1834 1841
	/* fire up mpd */
......
1851 1858
		$i++;
1852 1859
	}
1853 1860

  
1854
	/* Remove work round temporary address */
1855
	if ($tempaddr && !empty($tempaddr_iface)) {
1856
		mwexec("/sbin/ifconfig " . escapeshellarg($tempaddr_iface) . " inet 192.0.2.248/31 -alias", true);
1857
		unset ($tempaddr_iface);
1861
	/* Remove all temporary bogon IPv4 addresses */
1862
	if (is_array($tempaddr)) {
1863
		foreach ($tempaddr as $tempiface) {
1864
			if (isset($tempiface['if']) && isset($tempiface['ipaddr'])) {
1865
				mwexec('/sbin/ifconfig ' . escapeshellarg($tempiface['if']) . ' inet ' . escapeshellarg($tempiface['ipaddr']) . ' -alias', true);
1866
			}
1867
		}
1868
		unset ($tempaddr);
1858 1869
	}
1859
	unset ($tempaddr);
1860 1870

  
1861 1871
	/* we only support the 3gstats.php for huawei modems for now. Will add more later. */
1862 1872
	/* We should be able to launch the right version for each modem */

Also available in: Unified diff