Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def test_parse_packet_with_nsec_record():
nsec_record = parsed.answers[3]
assert "nsec," in str(nsec_record)
assert nsec_record.rdtypes == [16, 33]
assert nsec_record.next_name == "MyHome54 (2)._meshcop._udp.local."


def test_records_same_packet_share_fate():
Expand Down
14 changes: 8 additions & 6 deletions zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,38 +446,40 @@ class DNSNsec(DNSRecord):

"""A DNS NSEC record"""

__slots__ = ('next', 'rdtypes')
__slots__ = ('next_name', 'rdtypes')

def __init__(
self,
name: str,
type_: int,
class_: int,
ttl: int,
next: str,
next_name: str,
rdtypes: List[int],
created: Optional[float] = None,
) -> None:
super().__init__(name, type_, class_, ttl, created)
self.next = next
self.next_name = next_name
self.rdtypes = rdtypes

def __eq__(self, other: Any) -> bool:
"""Tests equality on cpu and os"""
return (
isinstance(other, DNSNsec)
and self.next == other.next
and self.next_name == other.next_name
and self.rdtypes == other.rdtypes
and DNSEntry.__eq__(self, other)
)

def __hash__(self) -> int:
"""Hash to compare like DNSNSec."""
return hash((*self._entry_tuple(), self.next, *self.rdtypes))
return hash((*self._entry_tuple(), self.next_name, *self.rdtypes))

def __repr__(self) -> str:
"""String representation"""
return self.to_string(self.next + "," + "|".join([self.get_type(type_) for type_ in self.rdtypes]))
return self.to_string(
self.next_name + "," + "|".join([self.get_type(type_) for type_ in self.rdtypes])
)


class DNSRRSet:
Expand Down