Revision 8fa56d1f
Added by Scott Ullrich almost 20 years ago
etc/inc/services.inc | ||
---|---|---|
78 | 78 |
EOD; |
79 | 79 |
|
80 | 80 |
$dhcpdifs = array(); |
81 |
|
|
82 |
/* loop through and deterimine if we need to setup |
|
83 |
* failover peer "bleh" entries |
|
84 |
*/ |
|
85 |
$dhcpnum = 0; |
|
86 |
foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { |
|
87 |
if($dhcpifconf['failover_peerip'] <> "") { |
|
88 |
/* |
|
89 |
* yep, failover peer is defined. |
|
90 |
* does it match up to a defined vip? |
|
91 |
*/ |
|
92 |
$skew = 1; |
|
93 |
foreach ($a_vip as $vipent) { |
|
94 |
$int = guess_interface_from_ip($vipent['subnet']); |
|
95 |
$intip = find_interface_ip($int); |
|
96 |
if($int == $dhcpif) { |
|
97 |
/* this is the interface! */ |
|
98 |
if($vipent['advskew'] == "0") |
|
99 |
$skew = 0; |
|
100 |
} |
|
101 |
} |
|
102 |
if($skew == 1) { |
|
103 |
$type = "secondary"; |
|
104 |
} else { |
|
105 |
$type = "primary"; |
|
106 |
} |
|
107 |
$dhcpdconf .= <<<EOPP |
|
108 |
failover peer "dhcp{$dhcpnum}" { |
|
109 |
{$type}; |
|
110 |
address {$intip}; |
|
111 |
port 520; |
|
112 |
peer address {$dhcpifconf['failover_peerip']}; |
|
113 |
peer port 519; |
|
114 |
max-response-delay 60; |
|
115 |
max-unacked-updates 10; |
|
116 |
} |
|
117 |
EOPP; |
|
118 |
$dhcpnum++; |
|
119 |
|
|
120 |
|
|
121 |
} |
|
122 |
} |
|
123 |
|
|
124 |
$dhcpnum = 0; |
|
125 |
|
|
81 | 126 |
foreach ($dhcpdcfg as $dhcpif => $dhcpifconf) { |
82 | 127 |
|
83 | 128 |
$ifcfg = $config['interfaces'][$dhcpif]; |
... | ... | |
114 | 159 |
else |
115 | 160 |
$routers = $ifcfg['ipaddr']; |
116 | 161 |
|
162 |
if($dhcpifconf['failover_peerip'] <> "") { |
|
163 |
$dhcpdconf .= " failover peer \"dhcp{$dhcpnum}\";\n"; |
|
164 |
$dhcpnum++; |
|
165 |
} |
|
166 |
|
|
117 | 167 |
$dhcpdconf .= <<<EOD |
118 | 168 |
range {$dhcpifconf['range']['from']} {$dhcpifconf['range']['to']}; |
119 | 169 |
} |
Also available in: Unified diff
Add dhcp server failover support.
And the crowd better go nuts!