Project

General

Profile

« Previous | Next » 

Revision 9f9a9100

Added by Marcos M 9 months ago

Handle empty variable

Callers of these functions may send null variabes; bail early if so.

View differences:

src/etc/inc/interfaces.inc
6549 6549
}
6550 6550

  
6551 6551
function get_interface_ip($interface = "wan") {
6552
	if (empty($interface)) {
6553
		return null;
6554
	}
6552 6555
	if (substr($interface, 0, 4) == '_vip') {
6553 6556
		return get_configured_vip_ipv4($interface);
6554 6557
	} elseif (substr($interface, 0, 5) == '_lloc') {
......
6587 6590
}
6588 6591

  
6589 6592
function get_interface_ipv6($interface = "wan", $flush = false, $linklocal_fallback = false) {
6593
	if (empty($interface)) {
6594
		return null;
6595
	}
6590 6596
	if (substr($interface, 0, 4) == '_vip') {
6591 6597
		return get_configured_vip_ipv6($interface);
6592 6598
	} elseif (substr($interface, 0, 5) == '_lloc') {

Also available in: Unified diff