1779 |
1779 |
}
|
1780 |
1780 |
$srvifaces = array_unique($srvifaces);
|
1781 |
1781 |
|
|
1782 |
/* If relays are on subnets that also serves clients, we need to move them to their own array */
|
|
1783 |
$srvrelayifs = array();
|
|
1784 |
$srvrelayifs = array_intersect($dhcrelayifs, $srvifaces);
|
|
1785 |
$srvifaces = array_diff($srvifaces, $srvrelayifs);
|
|
1786 |
$dhcrelayifs = array_diff($dhcrelayifs, $srvrelayifs);
|
|
1787 |
|
1782 |
1788 |
/* The server interface(s) should not be in this list */
|
1783 |
1789 |
$dhcrelayifs = array_diff($dhcrelayifs, $srvifaces);
|
1784 |
1790 |
|
1785 |
1791 |
/* fire up dhcrelay */
|
1786 |
|
if (empty($dhcrelayifs)) {
|
|
1792 |
if (empty($dhcrelayifs) && empty($srvrelayifs)) {
|
1787 |
1793 |
log_error(gettext("No suitable downstream interfaces found for running dhcrelay!"));
|
1788 |
1794 |
return; /* XXX */
|
1789 |
1795 |
}
|
1790 |
|
if (empty($srvifaces)) {
|
|
1796 |
if (empty($srvifaces) && empty($srvrelayifs)) {
|
1791 |
1797 |
log_error(gettext("No suitable upstream interfaces found for running dhcrelay!"));
|
1792 |
1798 |
return; /* XXX */
|
1793 |
1799 |
}
|
1794 |
1800 |
|
1795 |
1801 |
$cmd = "/usr/local/sbin/dhcrelay";
|
1796 |
|
$cmd .= " -id " . implode(" -id ", $dhcrelayifs);
|
1797 |
|
$cmd .= " -iu " . implode(" -iu ", $srvifaces);
|
|
1802 |
|
|
1803 |
if (!empty($dhcrelayifs)) {
|
|
1804 |
$cmd .= " -id " . implode(" -id ", $dhcrelayifs);
|
|
1805 |
}
|
|
1806 |
if (!empty($srvifaces)) {
|
|
1807 |
$cmd .= " -iu " . implode(" -iu ", $srvifaces);
|
|
1808 |
}
|
|
1809 |
if (!empty($srvrelayifs)) {
|
|
1810 |
$cmd .= " -i " . implode(" -i ", $srvrelayifs);
|
|
1811 |
}
|
1798 |
1812 |
|
1799 |
1813 |
if (isset($dhcrelaycfg['agentoption'])) {
|
1800 |
1814 |
$cmd .= " -a -m replace";
|