aboutsummaryrefslogtreecommitdiff
path: root/discovery/mdns
AgeCommit message (Collapse)Author
2021-07-21[Open Screen] Create a //discovery:public targetmark a. foltz
This creates a :public GN target for other Open Screen modules (or embedders) to depend on. It also: - Consolidates the DNS-SD public APIs. - Adds DEPS rules to enforce use of public headers. - Adds DEPS rules to enforce layering inside of //discovery (with some exceptions). - Adjusts deps for the //discovery targets. Bug: b/179705382 Change-Id: Ice48b8d8937d3c68351d693b348a2928f14dfb4b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/3032947 Commit-Queue: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2021-04-21Cleanup TODOs from @miuJordan Bayles
This patch removes all remaining TODOs from the now-departed @miu, either reassigning them to jophba, or for the majority, just implementing the fix directly. Change-Id: I73c21f577bf115cf37ec880fac54eef1555de7c5 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2831302 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2021-03-25[Discovery] Fix bug in PTR expiryJordan Bayles
This patch fixes a bug where PTR expire updates with a different TTL from the current record are not considered to be updates, leaving the now expired record in the graph and returning an error. A new equality operator, "IsUpdateOf", is added to MdnsRecord to allow for checking this specific case. Bug: b/168800070 Change-Id: I5c5d4372d3ded791d102cb95cc37fdf5e944d404 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2785583 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2021-02-23Disable abseil hash checking in Chromiumbtolsch
This change makes VerifyTypeImplementsAbslHashCorrectly a nop when compiling in Chromium, because we aren't allowed to use abseil's hash_testing.h due to component build + DEPS issues. The unittests will still work the same outside of Chromium, and in Chromium, everything other than the hash checking is the same. Bug: 1159046 Change-Id: I8997bbf2fb080a6ef1b5b475f239d229204b258c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2691326 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2021-02-10Remove static initializers from discovery/btolsch
This change removes IPAddress and std::vector static initializers from //discovery/mdns to comply with Chromium rules about no static initializers. IPAddress constructors were made constexpr and std::vector was changed to std::array. Bug: 1159043, 1159045, 1159046 Change-Id: I5935242da3b80836111bc43caa418c871ee95c0b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2685482 Commit-Queue: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2021-02-05Update mDNS service bindingJordan Bayles
This is a followup patch to: https://chromium-review.googlesource.com/c/openscreen/+/2643397 To make it RFC compliant, we now send to the multicast group address, not to ANY. We also bind to ANY address instead of the local address of the interface, since binding filters multicast traffic to only bound addresses. Joining the multicast group is what filters the traffic instead. Bug: b/178102949 Change-Id: I1d7e44b5e90d2f1f1d395cb9a8a689edf16bfafb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2665304 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2021-02-01Fix UDP bind timing issueJordan Bayles
This patch fixes a potential timing issue where we attempt to send an Answer message before the UDP socket is bound. The current behavior is that we construct an Answer with a UDP port value of 0, which results in the Answer failing validation and an error Answer message being sent back to the sender. The new behavior is that the Answer message is not sent until the environment is notified that the UDP socket has been bound. This is accomplished by an addition to the UDPSocket::Client abstract class, a new OnBound event. Bug: b/174501332 Change-Id: I4bcebe78d8d41c29bb4b4698c5565f0dd9ef2c17 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2645893 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2021-01-25[c++17] Make consistent use of noexceptJan Wilken Dörrie
This change makes openscreen ready to be compiled with -std=c++17. In particular, c++17 demands the consistent use of the noexcept keyword accross declaration and definition. Bug: chromium:752720 Change-Id: I4715cbc7ccc9576e33ad7dec0ce6c1f6ebd9935b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2643286 Commit-Queue: mark a. foltz <mfoltz@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2021-01-25Update mDNS service to use correct addressJordan Bayles
This patch fixes a bug in the mDNS service where the incorrect address is used for UDP socket binding. New behavior: 1. Bind the interface's local IPv4 and IPv6 addresses. 2. Join the multicast group with the default mDNS group address on the specific network interface. 3. Send to the any address on the default multicast mDNS port. Bug: b/178102949 Change-Id: I23235fce8d70e2b248ab42381167c2f01568f713 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2643397 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com>
2020-12-07Add presubmit check for unnecessary is_value checksJordan Bayles
This patch removes all unnecessary ErrorOr<>::is_value() checks and adds a presubmit handler for them. Change-Id: I2d1382113c00a5ba578dd23f5a15eae79d75c307 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2569369 Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-11-25Logging cleanupsJordan Bayles
This patch removes some test-specific logging code in favor of death tests, and makes the OSP_NOTREACHED macro actually be annotated as [[noreturn]], so you don't have to put a bogus return statement after it. Change-Id: I6a6a271182061cbd98593ac0ae79347e48da5bc7 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2555597 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-10-08[Discovery] Avoid both positive + negative response in a messageRyan Keane
In some versions of the MdnsResponder mDNS + DNS-SD Implementation, responses to an mDNS Query can include both a positive and a negative response for the same record. Based on experimentation, the intended behavior by MdnsResponder is just to send the positive response. To solve this issue, the Mdnsquerier has been updated to parse all incoming records and eliminate all such NSEC records. Example Query (From this code): Standard query 0x0000 ANY adb-9A171FFAZ00158-kJT7nl._adb-tls-connect._tcp.local, "QM" question SRV 0 0 41119 Android-2.local Example Response (From MdnsResponder): Answers: Android-2.local: type NSEC, class IN, cache flush, next domain name Android-2.local _services._dns-sd._udp.local: type PTR, class IN, _adb-tls-connect._tcp.local _adb-tls-connect._tcp.local: type PTR, class IN, adb-9A171FFAZ00158-kJT7nl._adb-tls-connect._tcp.local adb-9A171FFAZ00158-kJT7nl._adb-tls-connect._tcp.local: type SRV, class IN, cache flush, priority 0, weight 0, port 41119, target Android-2.local Additional Records: Android-2.local: type A, class IN, cache flush, addr 192.168.86.32 Android-2.local: type AAAA, class IN, cache flush, addr fe80::44ec:8eff:feba:4e6e Android-2.local: type NSEC, class IN, cache flush, next domain name Android-2.local (A and AAAA rrcodes set) adb-9A171FFAZ00158-kJT7nl._adb-tls-connect._tcp.local: type NSEC, class IN, cache flush, next domain name adb-9A171FFAZ00158-kJT7nl._adb-tls-connect._tcp.local (SRV, TXT rrcodes set) Bug: b/168034815 Change-Id: I97da52268b5a56fcefc5cfdc8a8457fa33d61347 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2422716 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2020-10-02[Discovery] Fix MdnsRecord Comparison BugsRyan Keane
This CL fixes bugs in the MdnsRecord operator> logic associated with both comparing records of different names and with serialization of records for comparison. Change-Id: I1941d405ae808f1e50c078fa8ec6890a34f91868 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2429069 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-10-02[Discovery] Add Flag to Disable NSEC Record ReceivingRyan Keane
This CL provides the embedder with a way to disable the NSEC negative response optimization of mDNS. The main use cases of this flag are: - A user (internal or external) finds a bug with NSEC records (either in our library OR in theirs), and it takes us some time to find/fix the bug, this will give a short-term workaround that can be used to unblock them until we (or they) can code up a fix and get it through code review. This MdnsResonder interop bug is a good example - the user has been able to continue testing while the suppression patch is still making its way through code review. - An external user wants to interop with a library we don't want to support for their specific use case (ie a personal implementation of mDNS that isn't widely used, a very old version of a library that has been deprecated and we don't want to support, etc) when they don't want to code up a libcast-library-wide fix (I know I'd fall into this bucket if I wanted to use it for a personal project). This will give that ability - NSEC handling is one of the sticky points for interoperability of our library with standard DNS as opposed to mDNS (NSEC has a different meaning in that case. It's possible to differentiate the two per RFC6762, but it also calls out that if you receive the "DNS" one as opposed to "mDNS", you should pretend it's actually just the "mDNS" one ¯\_(ツ)_/¯), which some users may eventually want to use it for. It's hard to say the direction an Open Source project will go once external contributors can get their hands on it Bug: b/168034815 Change-Id: Ib592eb869d1a8b91495120eaf7e7887ad6ba2cee Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2414788 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2020-09-26Fix useless move() in //discovery/Maksim Ivanov
Drop std::move() calls in places where there's no actual moving happing, and only the "bugprone-use-after-move" clang-tidy warning is triggered. Bug: chromium:1122844 Change-Id: I69abd6193670fe77dcc24d1b8510796756c7a575 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2431966 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-09-23Update MdnsReader::Read to return ErrorOrJordan Bayles
This patch fixes a TODO in MdnsReader::Read to check the opcode and rcode in the message, and return a more useful ErrorOr object. Bug: b/168240264 Change-Id: Id1d76cf54def9923acd8ce9d9ca6908e0f2b1f8f Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2425116 Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-09-10[Open Screen] Remove obsolete TODOs.mark a. foltz
- openscreen::Alarm is a cancelable Task. - None of the existing callers of UdpSocket::SendMessage would benefit by sending a UdpPacket instead. Bug: b/153658616 Change-Id: Ie7017d23d0195448295d16f660fd9b54abc6ae34 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2402238 Commit-Queue: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-07-10[Open Screen] Fix/remove some TODOs in util/mark a. foltz
- Replace OSP_LOG with OSP_LOG_INFO - Remove TODO in scoped_trace_operations_unittest.cc - Update TODO in yet_another_bit_vector.cc Bug: openscreen:52 Change-Id: I6584413aeb0d20dc09a91f7744092d3963d62224 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2063423 Reviewed-by: Ryan Keane <rwkeane@google.com> Reviewed-by: Yuri Wiitala <miu@chromium.org> Commit-Queue: mark a. foltz <mfoltz@chromium.org>
2020-06-25Code Coverage: Sync merge_steps.py up with ChromiumRyan Keane
merge_steps.py in Chromium has updated. We need to copy the file to our repo for code coverage to continue functioning. This CL performs that copy. See: https://source.chromium.org/chromium/chromium/src/+/master:testing/merge_scripts/code_coverage/merge_steps.py?q=merge_steps.py&ss=chromium&originalUrl=https:%2F%2Fcs.chromium.org%2F Change-Id: I0bbe8e10481ffc51af59f1240094f1c4ceae36c5 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2265095 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-24Force CodeCoverage Full BuildRyan Keane
Change-Id: Ic7dd0ca9f6f83b509c1425b926bcb48669d3c40c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2265094 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-24Code Coverage: Force Full Repo CoverageRyan Keane
Change-Id: I744fb0ef34dedd5d51025cd82fbed0ca4cc883be Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2265159 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-19mDNS: Add new OPT record typeRyan Keane
This CL adds support for the OPT record type, as defined in RFC 6891. Bug: b/157683753 Change-Id: I65b45c4e8c423174825522c83aa8f00b26d94c9c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2233144 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-06-10mDNS: Add more detailed loggingRyan Keane
This CL adds more detailed logging to help debug ongoing issues. bug: b/157683753 Change-Id: Ibee54a379c95773571cd3e7ec0095aa5f4ac9152 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2223828 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-06-10mDNS: Add Hashing TestsRyan Keane
Found while writing another patch that there were bugs in the existing hash functions. This CL should fix them and add UTs for validation Change-Id: Ifb0efd09a2bc3de7d206924e9755bafdfe887509 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2233371 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Jordan Bayles <jophba@chromium.org>
2020-06-09Discovery: Add support for non-cyclic SRV pointersRyan Keane
This CL adds support for receiving DNS-SD service instances where the address records have domain different from that of the SRV record. It is intended to function as a more general version of the dns_data class: https://source.chromium.org/chromium/chromium/src/+/master:third_party/openscreen/src/discovery/dnssd/impl/dns_data.h?q=dns_data.h For this reason, the public API has mostly been kept the same. The main difference here is that a single instance of dns_data_graph is replacing the multiple instances used in the previous approch. For further details about this change and how it will be applied, see the follow-up CL: https://chromium-review.googlesource.com/c/openscreen/+/2223685/4 To accomplish the goal described above, the class creates a graph over which these records can interact, rather than static mapping as was previously used in the DnsData class. For further details about this and how the graph is used, see dns_data_graph.h's file-level comment. bug: b/157683753 Change-Id: I47a4cf280df358b93343ea7f523a519cb33957aa Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2223690 Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-03Move std::chrono using statements to util/Jordan Bayles
This patch moves openscreen::<time type> using statements to be part of a new util/ header, chrono_helpers.h. Some helpful convenience functions are provided for doing conversions, and a new conversion method, to_duration, is added to the Clock implementation. Change-Id: I5a153c4da5266bceea97de0cad00a71a739f71ca Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2222684 Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
2020-06-02Force CI build for Code Coverage bot testRyan Keane
Change-Id: I30946ae7c69776dd726e640aa00b6dc5bdecf562 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2225614 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-06-01Force the CI Bots to runRyan Keane
Change-Id: I0b688ab891091dc61e6b20e9e088ca2aa39fa4d8 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2225605 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-05-28[Open Screen] Fix lint errors.mark a. foltz
This fixes a number of lint errors in the codebase flagged by cpplint.py. It also turns off a couple of checks: 1. The header check is too restrictive 2. The whitespace/braces check doesn't fully grok initializer list syntax. Bug: b/156101497 Change-Id: I11caefdc14fa1c5891022357bee35595673c4341 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2219135 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: mark a. foltz <mfoltz@chromium.org>
2020-05-15mDNS: Update MdnsService DocumentationRyan Keane
Change-Id: I54c45ebce6ae6a08c3c98d513e28e5646db6c4ee Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2202749 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-05-15mDNS: Reorder initialization of MdnServiceRyan Keane
Fixes a compatibility issue with Chromium where unbound sockets don't support method calls prior to binding. Change-Id: I7c0379addcae52aace9847d5ceeaec1438121ede Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2202781 Reviewed-by: Jordan Bayles <jophba@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-05-07Rename util/logging.h to avoid collisionsJordan Bayles
Currently, the util/logging.h file causes build issues because other external repos have the same file. This patch fixes this bug by renaming our copy of logging.h to osp_logging.h, the same way we renamed DCHECK to OSP_DCHECK. Bug: b/155927492 Change-Id: I75ff546775bed01daeda2a631c06b4776e3829f1 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2186351 Reviewed-by: mark a. foltz <mfoltz@chromium.org>
2020-04-22mDNS: Bound size of incoming record rdataRyan Keane
This CL adds size limits on incoming record rdata and plumbs the setting through to the config. This allows embedders to better control the maximum possible size that mDNS will use, as well as prevents against external attacks. Bug: openscreen:47 Change-Id: I1ea9109c66924e2e3f20786d4a2df4b33f45c719 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2149864 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-04-15Discovery: Update contract between discovery layersRyan Keane
This CL updates documentation and source code to fit the new method contract that callbacks from lower layers will not invoke calls back to that same layer It addresses comments in the following CL while providing an alternative solution to the bug: https://chromium-review.googlesource.com/c/openscreen/+/2080670 This fix was added due to the following edge case: The OnRecordChanged callback would fire kExpired for a PTR record. This would make dnssd/impl/querier_impl stop the mDNS kALL query associated with the pointed to domain. This would then call mDNS Querier and update |callbacks_| which would invalidate the iterator still being used by the original call, resulting in an infinite loop since the exit condition is never hit. Additionally, E2E tests have been updated to test for this edge case. Change-Id: Ie1a8301cfb5e8589a83b3015571fac79edca15af Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2148178 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-04-15mDNS: Multi-Packet Known Answer SuppressionRyan Keane
This CL adds multi-packet known answer suppression as detailed in RFC 6762 section 7.2. Bug: openscreen:101 Change-Id: Ia6397645976cd66c90da123d36592a80e87bf18c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2097179 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
2020-04-06Discovery: Multiple Network Interfaces Part 1Ryan Keane
This CL is the first part of supporting multiple network interfaces. It makes necessary change for duplicate instances of DNS-SD to exist, each responsible for a single Network Interface. Additionally, as the endpoint is no longer published as part of the DnsSdInstanceRecord, these parameters are removed and use of this class is split into 2 parts - one containing the endpoints and one not. Future CLs will be responsible for: - Updating E2E tests. - Adding support for initiating multiple instances of discovery/dnssd/impl/service_impl.h (and renaming it). For full context, see CL: https://chromium-review.googlesource.com/c/openscreen/+/2076164 Bug: openscreen:105 Change-Id: I52168f03513d1a605ae3feda50a221f9f505cd79 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2093012 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: mark a. foltz <mfoltz@chromium.org> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
2020-04-01Add Hashing functions to UtilRyan Keane
This CL moves hashing functionality from discovery/mdns/mdns_writer to util/hashing to avoid code duplication In the linked CL, these functions are needed elsewhere. Because they are publicly overridable, absl::hash cannot be used and this approach provides the best option Change-Id: I977e41cd8df511b8f160b05a65b40d8a951f4233 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2125091 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
2020-03-27mDNS: Add Service Type EnumerationRyan Keane
This CL adds service type enumeration as described in RFC 6763 section 9. Change-Id: I62a4e63b08415fd20662ec22c8f071ec7dfeb2cd Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2099312 Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-27mDNS: Cap Cache Size in MdnsQuerierRyan Keane
This CL adds functionality to the mDNS Querier to cap the size of the cache used. This prevents malicious or misbehaving hosts from causing the memory footprint of the discovery pipeline to grow in an unbounded fashion. Bug: openscreen:84 Change-Id: Ifd5f629c1207ebe0dd1720f8fb7f2fc5842e48c0 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2106653 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
2020-03-16mDNS: Improved Receiver-Side LoggingRyan Keane
Change-Id: Id318fd53dda291160baeb5a710e8aca0b5e12371 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2102903 Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-12Discovery: Add Flags to Enable/Disable Querying + PublishingRyan Keane
Change-Id: Iab2588b5799f77712b1f5f3bdb1c42dea310e99c Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2101376 Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-11Fix mDNS socket bindingbtolsch
mDNS UDP sockets can be bound to any address (e.g. all zeros) and only need to use the correct IP for joining a multicast group. Bug: openscreen:116 Change-Id: I93b30a28d748c9e73dc3963ae3c669d7b105deec Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2099448 Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Brandon Tolsch <btolsch@chromium.org>
2020-03-11Discovery: Fuzz TestsRyan Keane
This CL adds 4 fuzz tests for mDNS Reader (the class which does all deserialization from network bits into the MdnsMessage class instances): - A message with a lot of answers (one of each record type, including name compression) - A message with multiple questions - A message matching the mDNS Probe format (one question, multiple answers in the authority records field) - A message matching the expected response from a PTR query (one PTR record in answers, multiple known answers in additional records) Change-Id: Iacffce856fe824268f164c8fbf786e085da5c6a9 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2095689 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Yuri Wiitala <miu@chromium.org>
2020-03-11mDNS: Fix MdnsSender UTsRyan Keane
Stumbled upon this issue while working on something else. Thought it was good to fix - so here's a short CL fixing just the UTs. Change-Id: I36638c6cbf45c3c358ba47bb4f39edd24d0ade15 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2095364 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
2020-03-11mDNS: Fix bugs found by fuzz testsRyan Keane
This CL fixes crashes that were caught by the fuzzer :) Change-Id: Ie529a94993719c46acf33bae17f6d2a11af8f6e6 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2095767 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-11mDNS: Add TODO to MdnsServiceImplRyan Keane
Change-Id: I7bdbb8a3f192247e1eb73a75395ad663900821ef Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2095292 Reviewed-by: Brandon Tolsch <btolsch@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-05mDNS: Change MdnsService ctorRyan Keane
This CL changes the ctor and factory for mDNS Service, the top-level mDNS object, and changes how it handles networking configuration. The purpose for this change is to allow for future support for multiple network interfaces For full context, see CL: https://chromium-review.googlesource.com/c/openscreen/+/2076164 Change-Id: I1f1bf03c6a7d272126b4befb8b4b5cffd03e51ad Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2076166 Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Commit-Queue: Ryan Keane <rwkeane@google.com>
2020-03-04mDNS: MdnsQuierier RefactorRyan Keane
Completes requested refactor called out as follow-up item in CL: https://chromium-review.googlesource.com/c/openscreen/+/2066939/2/discovery/mdns/mdns_querier.cc#388 Change-Id: I2548973baa4f2a909592cab1803a77786e33e59a Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2079154 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org>
2020-03-04Discovery: E2E test #4Ryan Keane
This CL adds a new E2E test that performs the following: 1) Start up the Cast platform for a posix system. 2) Start service discovery and new queries. 3) Publish one service and ensure it is received. 4) Hard reset discovery 5) Ensure the same service is discovered 6) Soft reset the service, and ensure that a callback is received. Additionally, it: - Adds verbose logs throughout the discovery pipeline to help with debugging - Changes the return type of DnsSdPublisher::DeregisterAll() to allow returning of errors. One more fixes CL to follow, with a couple more lines of testing UPDATE: follow-up CL is up: https://chromium-review.googlesource.com/c/openscreen/+/2080670 Change-Id: I22c42e7c6760f2fb3bd3c564cacafa7a69edf5a7 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2078767 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>
2020-02-27Discovery: E2E Test #3Ryan Keane
This CL adds support for a 3rd Discovery E2E test with the following functionality: 1) Start up the Cast platform for a posix system. 2) Publish one service and ensure it is NOT received. 3) Start service discovery and new queries. 4) Ensure above published service IS received. 5) Stop the started query. 6) Update a service, and ensure that no callback is received. 7) Restart the query and ensure that only the expected callbacks are received. Change-Id: Ic25e8995b6f33664300feca992d23d4bb2bc4d48 Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2067416 Commit-Queue: Ryan Keane <rwkeane@google.com> Reviewed-by: Max Yakimakha <yakimakha@chromium.org> Reviewed-by: Brandon Tolsch <btolsch@chromium.org>