Project

General

Profile

« Previous | Next » 

Revision 8c7e38ff

Added by Gilles Compienne about 11 years ago

[pfSense - Bug #3607] Ensure gateway detection can cope with the gateway being a dynamically assigned PPoE interface.

View differences:

etc/inc/gwlb.inc
161 161
		if(in_array($gateway['monitor'], $monitor_ips))
162 162
			continue;
163 163

  
164
		/* Interface ip is needed since apinger will bind a socket to it. */
165
		if (is_ipaddrv4($gateway['gateway'])) {
164
		/* Interface ip is needed since apinger will bind a socket to it. 
165
		 * However the config GUI should already have checked this and when 
166
		 * PPoE is used the IP address is set to "dynamic". So using is_ipaddrv4
167
		 * or is_ipaddrv6 to identify packet type would be wrong, especially as
168
		 * further checks (that can cope with the "dynamic" case) are present inside
169
		 * the if block. So using $gateway['ipprotocol'] is the better option.
170
		 */
171
		if ($gateway['ipprotocol'] == "inet") { // This is an IPv4 gateway...
166 172
			$gwifip = find_interface_ip($gateway['interface'], true);
167 173
			if (!is_ipaddrv4($gwifip))
168 174
				continue; //Skip this target
......
178 184
				mwexec("/sbin/route change -host " . escapeshellarg($gateway['monitor']) .
179 185
					" " . escapeshellarg($gateway['gateway']), true);
180 186
			}
181
		} else if (is_ipaddrv6($gateway['gateway'])) {
187
		} else if ($gateway['ipprotocol'] == "inet6") { // This is an IPv6 gateway...
182 188
			/* link locals really need a different src ip */
183 189
			if(is_linklocal($gateway['gateway'])) {
184 190
				$gwifip = find_interface_ipv6_ll($gateway['interface'], true);

Also available in: Unified diff