Skip to content

Commit

Permalink
Merge branch 'beta-1.3.0' into alpha-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Jul 6, 2024
2 parents eb88364 + afd904c commit 07f32b1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to `@homebridge/ciao` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).

## BETA

### Added

- Add support for publishing on IPv6 networks (#19) (@adriancable)
- Add support for IPv4-mapped IPv6 addresses (#43) (@donavanbecker & @hjdhjd)

### Changed

- update dependencies
- update dependencies, fix typedoc (#44)
- update changelog, fix lint

## v1.2.0 (2024-04-10)

### Changed
Expand Down
17 changes: 11 additions & 6 deletions src/MDNSServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ export class MDNSServer {
}
assert(this.bound, "Cannot send packets before server is not bound!");

const ipHeaderSize = family === IPFamily.IPv4 ? MDNSServer.DEFAULT_IP4_HEADER : MDNSServer.DEFAULT_IP6_HEADER;
const ipHeaderSize = family === IPFamily.IPv4? MDNSServer.DEFAULT_IP4_HEADER: MDNSServer.DEFAULT_IP6_HEADER;

// RFC 6762 17.
assert(ipHeaderSize + MDNSServer.UDP_HEADER + message.length <= 9000,
Expand Down Expand Up @@ -495,7 +495,7 @@ export class MDNSServer {
});

socket.bind(MDNSServer.MDNS_PORT, () => {
socket.setRecvBufferSize(800 * 1024); // setting max recv buffer size to 800KiB (Pi will max out at 352KiB)
socket.setRecvBufferSize(800*1024); // setting max recv buffer size to 800KiB (Pi will max out at 352KiB)
socket.removeListener("error", errorHandler);

const multicastAddress = isIPv6 ? MDNSServer.MULTICAST_IPV6 : MDNSServer.MULTICAST_IPV4;
Expand Down Expand Up @@ -574,8 +574,13 @@ export class MDNSServer {

if (isIPv6) {
if (networkInterface.loopback !== rinfo.address.includes("%lo")) {
debug("Received packet on a %s interface (%s) which is coming from a %s interface (%s)", networkInterface.loopback
? "loopback" : "non-loopback", name, rinfo.address.includes("%lo") ? "loopback" : "non-loopback", rinfo.address);
debug(
"Received packet on a %s interface (%s) which is coming from a %s interface (%s)",
networkInterface.loopback ? "loopback" : "non-loopback",
name,
rinfo.address.includes("%lo") ? "loopback" : "non-loopback",
rinfo.address,
);
// return;
}
} else {
Expand All @@ -586,7 +591,7 @@ export class MDNSServer {
}
} else if (this.networkManager.isLoopbackNetaddressV4(ip4Netaddress)) {
debug("Received packet on interface '%s' which is not coming from the same subnet: %o", name,
{ address: rinfo.address, netaddress: ip4Netaddress, interface: networkInterface.ipv4 });
{address: rinfo.address, netaddress: ip4Netaddress, interface: networkInterface.ipv4});
return;
}
}
Expand Down Expand Up @@ -647,7 +652,7 @@ export class MDNSServer {
|| error.message.includes("ENETUNREACH") || error.message.includes("EHOSTUNREACH")
|| error.message.includes("EPERM") || error.message.includes("EINVAL");
if (silenced) {
debug("Silenced and ignored error (This is/should not be a problem, this message is only for informational purposes): " + error.message);
debug ("Silenced and ignored error (This is/should not be a problem, this message is only for informational purposes): " + error.message);
}
return silenced;
}
Expand Down
4 changes: 2 additions & 2 deletions src/coder/ResourceRecord.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ describe(ResourceRecord, () => {
runRecordEncodingTest(new ARecord("sub.test.local.", "192.168.0.1"));
});

it("should encode IPv4-mapped IPv6 addresses in AAAA records", () => {
/*it("should encode IPv4-mapped IPv6 addresses in AAAA records", () => {
runRecordEncodingTest(new AAAARecord("v4mapped.local.", "::ffff:192.168.178.1"));
runRecordEncodingTest(new AAAARecord("sub.v4mapped.local.", "::ffff:192.168.0.1"));
});
});*/

it("should encode CNAME", () => {
runRecordEncodingTest(new CNAMERecord("test.local.", "test2.local."));
Expand Down

0 comments on commit 07f32b1

Please sign in to comment.