pmcf 2.51.2 → 2.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/services/dhcp.mjs +70 -72
package/package.json
CHANGED
package/src/services/dhcp.mjs
CHANGED
|
@@ -126,56 +126,24 @@ export class DHCPService extends Service {
|
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
const peers = (
|
|
129
|
-
await Array.fromAsync(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
)
|
|
129
|
+
await Array.fromAsync(
|
|
130
|
+
network.findServices({ type: "dhcp", priority: ">10" })
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
.sort((a, b) => (a.host === host ? -1 : 1))
|
|
134
|
+
.map((dhcp, i) => {
|
|
135
|
+
const ctrlAgentEndpoint = dhcp.endpoint(
|
|
136
|
+
e => e.type === "kea-control-agent"
|
|
137
|
+
);
|
|
134
138
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
return {
|
|
140
|
+
name: dhcp.host.name,
|
|
141
|
+
role: i === 0 ? "primary" : "standby",
|
|
142
|
+
url: ctrlAgentEndpoint?.url
|
|
143
|
+
};
|
|
144
|
+
});
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
"lease-database": {
|
|
144
|
-
type: "memfile",
|
|
145
|
-
"lfc-interval": 3600
|
|
146
|
-
},
|
|
147
|
-
"multi-threading": {
|
|
148
|
-
"enable-multi-threading": false
|
|
149
|
-
},
|
|
150
|
-
"expired-leases-processing": {
|
|
151
|
-
"reclaim-timer-wait-time": 10,
|
|
152
|
-
"flush-reclaimed-timer-wait-time": 25,
|
|
153
|
-
"hold-reclaimed-time": 3600,
|
|
154
|
-
"max-reclaim-leases": 100,
|
|
155
|
-
"max-reclaim-time": 250,
|
|
156
|
-
"unwarned-reclaim-cycles": 5
|
|
157
|
-
},
|
|
158
|
-
"renew-timer": 900,
|
|
159
|
-
"rebind-timer": 1800,
|
|
160
|
-
"valid-lifetime": 3600,
|
|
161
|
-
"hooks-libraries": [
|
|
162
|
-
{
|
|
163
|
-
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
library: "/usr/lib/kea/hooks/libdhcp_ha.so",
|
|
167
|
-
parameters: {
|
|
168
|
-
"high-availability": [
|
|
169
|
-
{
|
|
170
|
-
"this-server-name": name,
|
|
171
|
-
mode: "hot-standby",
|
|
172
|
-
peers
|
|
173
|
-
}
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
};
|
|
146
|
+
peers.length = 2;
|
|
179
147
|
|
|
180
148
|
const loggers = [
|
|
181
149
|
{
|
|
@@ -189,6 +157,54 @@ export class DHCPService extends Service {
|
|
|
189
157
|
}
|
|
190
158
|
];
|
|
191
159
|
|
|
160
|
+
const commonConfig = family => {
|
|
161
|
+
return {
|
|
162
|
+
"interfaces-config": {
|
|
163
|
+
interfaces: listenInterfaces(`IPv${family}`)
|
|
164
|
+
},
|
|
165
|
+
"control-socket": toUnix(
|
|
166
|
+
this.endpoint(e => e.type === `kea-control-dhcp${family}`)
|
|
167
|
+
),
|
|
168
|
+
"lease-database": {
|
|
169
|
+
type: "memfile",
|
|
170
|
+
"lfc-interval": 3600
|
|
171
|
+
},
|
|
172
|
+
"multi-threading": {
|
|
173
|
+
"enable-multi-threading": false
|
|
174
|
+
},
|
|
175
|
+
"expired-leases-processing": {
|
|
176
|
+
"reclaim-timer-wait-time": 10,
|
|
177
|
+
"flush-reclaimed-timer-wait-time": 25,
|
|
178
|
+
"hold-reclaimed-time": 3600,
|
|
179
|
+
"max-reclaim-leases": 100,
|
|
180
|
+
"max-reclaim-time": 250,
|
|
181
|
+
"unwarned-reclaim-cycles": 5
|
|
182
|
+
},
|
|
183
|
+
"renew-timer": 900,
|
|
184
|
+
"rebind-timer": 1800,
|
|
185
|
+
"valid-lifetime": 3600,
|
|
186
|
+
"hooks-libraries": [
|
|
187
|
+
{
|
|
188
|
+
library: "/usr/lib/kea/hooks/libdhcp_lease_cmds.so"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
library: "/usr/lib/kea/hooks/libdhcp_ha.so",
|
|
192
|
+
parameters: {
|
|
193
|
+
"high-availability": [
|
|
194
|
+
{
|
|
195
|
+
"this-server-name": name,
|
|
196
|
+
mode: "hot-standby",
|
|
197
|
+
peers
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"dhcp-ddns": dhcpServerDdns,
|
|
204
|
+
loggers
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
192
208
|
const toUnix = endpoint => {
|
|
193
209
|
return {
|
|
194
210
|
"socket-type": "unix",
|
|
@@ -245,8 +261,8 @@ export class DHCPService extends Service {
|
|
|
245
261
|
|
|
246
262
|
const dhcpServerDdns = {
|
|
247
263
|
"enable-updates": true,
|
|
248
|
-
"ip
|
|
249
|
-
port: ddnsEndpoint.port,
|
|
264
|
+
"server-ip": ddnsEndpoint.address,
|
|
265
|
+
"server-port": ddnsEndpoint.port,
|
|
250
266
|
"max-queue-size": 64,
|
|
251
267
|
"ncr-protocol": "UDP",
|
|
252
268
|
"ncr-format": "JSON"
|
|
@@ -291,14 +307,7 @@ export class DHCPService extends Service {
|
|
|
291
307
|
);
|
|
292
308
|
const dhcp4 = {
|
|
293
309
|
Dhcp4: {
|
|
294
|
-
...commonConfig,
|
|
295
|
-
"interfaces-config": {
|
|
296
|
-
interfaces: listenInterfaces("IPv4")
|
|
297
|
-
},
|
|
298
|
-
"control-socket": {
|
|
299
|
-
"socket-type": "unix",
|
|
300
|
-
"socket-name": "/run/kea/4-ctrl-socket"
|
|
301
|
-
},
|
|
310
|
+
...commonConfig("4"),
|
|
302
311
|
"option-data": [
|
|
303
312
|
{
|
|
304
313
|
name: "domain-name-servers",
|
|
@@ -327,21 +336,12 @@ export class DHCPService extends Service {
|
|
|
327
336
|
],
|
|
328
337
|
reservations
|
|
329
338
|
};
|
|
330
|
-
})
|
|
331
|
-
"dhcp-ddns": dhcpServerDdns,
|
|
332
|
-
loggers
|
|
339
|
+
})
|
|
333
340
|
}
|
|
334
341
|
};
|
|
335
342
|
const dhcp6 = {
|
|
336
343
|
Dhcp6: {
|
|
337
|
-
...commonConfig,
|
|
338
|
-
"interfaces-config": {
|
|
339
|
-
interfaces: listenInterfaces("IPv6")
|
|
340
|
-
},
|
|
341
|
-
"control-socket": {
|
|
342
|
-
"socket-type": "unix",
|
|
343
|
-
"socket-name": "/run/kea/6-ctrl-socket"
|
|
344
|
-
},
|
|
344
|
+
...commonConfig("6"),
|
|
345
345
|
"preferred-lifetime": 3000,
|
|
346
346
|
"option-data": [
|
|
347
347
|
{
|
|
@@ -374,9 +374,7 @@ export class DHCPService extends Service {
|
|
|
374
374
|
}*/
|
|
375
375
|
]
|
|
376
376
|
};
|
|
377
|
-
})
|
|
378
|
-
"dhcp-ddns": dhcpServerDdns,
|
|
379
|
-
loggers
|
|
377
|
+
})
|
|
380
378
|
}
|
|
381
379
|
};
|
|
382
380
|
|