pmcf 2.17.1 → 2.18.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.17.1",
3
+ "version": "2.18.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/ip.mjs CHANGED
@@ -230,18 +230,9 @@ export function rangeIP(address, prefix, lowerAdd = 0, upperReduce = 0) {
230
230
  const definition = isIPv4(address) ? ipv4 : ipv6;
231
231
 
232
232
  const from = _prefix(definition, address, prefix);
233
- const to = _encode(definition, from); // /*from ||*/ definition.mask >> BigInt(prefix);
234
-
235
- for (
236
- let i = prefix / definition.segmentLength;
237
- i < definition.segments;
238
- i++
239
- ) {
240
- to[i] = 0xffff;
241
- }
233
+ const to = from | ((1n << BigInt(definition.bitLength - prefix)) - 1n);
242
234
 
243
- //console.log(from, to);
244
- return [_encode(definition, from + BigInt(lowerAdd)), to];
235
+ return [_encode(definition, from + BigInt(lowerAdd)), _encode(definition, to - BigInt(upperReduce))];
245
236
  }
246
237
 
247
238
  export function normalizeCIDR(address) {
@@ -272,12 +272,6 @@ async function generateZoneDefs(dns, location, packageData) {
272
272
  records: new Set([SOARecord, NSRecord])
273
273
  };
274
274
 
275
- addHook(
276
- packageData.properties.hooks,
277
- "post_upgrade",
278
- `rm -f /var/lib/named/${zone.file}.jnl`
279
- );
280
-
281
275
  const config = {
282
276
  name: `${domain}.zone.conf`,
283
277
  zones: [zone]
@@ -296,11 +290,17 @@ async function generateZoneDefs(dns, location, packageData) {
296
290
  }
297
291
  }
298
292
 
299
- if (configs.length > 0) {
293
+ const foreignZones = configs.map(c => c.zones).flat();
294
+
295
+ if (foreignZones.length) {
300
296
  addHook(
301
297
  packageData.properties.hooks,
302
298
  "post_upgrade",
303
- "systemctl try-reload-or-restart named"
299
+ `rm -f ${foreignZones.map(zone => `/var/lib/named/${zone.file}.jnl`)}\n` +
300
+ "systemctl try-reload-or-restart named\n" +
301
+ `/usr/bin/named-hostname-info ${foreignZones
302
+ .map(zone => zone.id)
303
+ .join(" ")}|/usr/bin/named-hostname-update`
304
304
  );
305
305
  }
306
306
 
package/src/subnet.mjs CHANGED
@@ -68,7 +68,7 @@ export class Subnet extends Base {
68
68
  }
69
69
 
70
70
  get addressRange() {
71
- return rangeIP(this.prefix, this.prefixLength, 0, 0).map(a => decodeIP(a));
71
+ return rangeIP(this.prefix, this.prefixLength, 1, 1).map(a => decodeIP(a));
72
72
  }
73
73
 
74
74
  get address() {