Revision f427d68d
Added by Jim Pingle about 6 years ago
src/etc/inc/services.inc | ||
---|---|---|
1747 | 1747 |
|
1748 | 1748 |
$iflist = get_configured_interface_list(); |
1749 | 1749 |
|
1750 |
$dhcrelayifs = array(); |
|
1750 | 1751 |
$dhcifaces = explode(",", $dhcrelaycfg['interface']); |
1751 | 1752 |
foreach ($dhcifaces as $dhcrelayif) { |
1752 | 1753 |
if (!isset($iflist[$dhcrelayif]) || |
... | ... | |
1758 | 1759 |
$dhcrelayifs[] = get_real_interface($dhcrelayif); |
1759 | 1760 |
} |
1760 | 1761 |
} |
1762 |
$dhcrelayifs = array_unique($dhcrelayifs); |
|
1761 | 1763 |
|
1762 | 1764 |
/* |
1763 | 1765 |
* In order for the relay to work, it needs to be active |
... | ... | |
1768 | 1770 |
log_error(gettext("No destination IP has been configured!")); |
1769 | 1771 |
return; |
1770 | 1772 |
} |
1771 |
|
|
1773 |
$srvifaces = array(); |
|
1772 | 1774 |
foreach ($srvips as $srcidx => $srvip) { |
1773 | 1775 |
$destif = guess_interface_from_ip($srvip); |
1774 | 1776 |
if (!empty($destif)) { |
1775 |
$dhcrelayifs[] = $destif;
|
|
1777 |
$srvifaces[] = $destif;
|
|
1776 | 1778 |
} |
1777 | 1779 |
} |
1778 |
$dhcrelayifs = array_unique($dhcrelayifs); |
|
1780 |
$srvifaces = array_unique($srvifaces); |
|
1781 |
|
|
1782 |
/* The server interface(s) should not be in this list */ |
|
1783 |
$dhcrelayifs = array_diff($dhcrelayifs, $srvifaces); |
|
1779 | 1784 |
|
1780 | 1785 |
/* fire up dhcrelay */ |
1781 | 1786 |
if (empty($dhcrelayifs)) { |
1782 |
log_error(gettext("No suitable interface found for running dhcrelay!")); |
|
1787 |
log_error(gettext("No suitable downstream interfaces found for running dhcrelay!")); |
|
1788 |
return; /* XXX */ |
|
1789 |
} |
|
1790 |
if (empty($srvifaces)) { |
|
1791 |
log_error(gettext("No suitable upstream interfaces found for running dhcrelay!")); |
|
1783 | 1792 |
return; /* XXX */ |
1784 | 1793 |
} |
1785 | 1794 |
|
1786 |
$cmd = "/usr/local/sbin/dhcrelay -i " . implode(" -i ", $dhcrelayifs); |
|
1795 |
$cmd = "/usr/local/sbin/dhcrelay"; |
|
1796 |
$cmd .= " -id " . implode(" -id ", $dhcrelayifs); |
|
1797 |
$cmd .= " -iu " . implode(" -iu ", $srvifaces); |
|
1787 | 1798 |
|
1788 | 1799 |
if (isset($dhcrelaycfg['agentoption'])) { |
1789 | 1800 |
$cmd .= " -a -m replace"; |
Also available in: Unified diff
Teach dhcrelay about upstream and downstream interfaces. Fixes #9466
No config changes or UI changes, it is handled automatically.