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
18 changes: 9 additions & 9 deletions tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def _validate_complete_response(query, out):
# With QU should respond to only unicast when the answer has been recently multicast
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)

Expand All @@ -429,7 +429,7 @@ def _validate_complete_response(query, out):
# With QU should respond to only multicast since the response hasn't been seen since 75% of the ttl
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)
unicast_out, multicast_out = zc.query_handler.response(
Expand All @@ -441,7 +441,7 @@ def _validate_complete_response(query, out):
# With QU set and an authorative answer (probe) should respond to both unitcast and multicast since the response hasn't been seen since 75% of the ttl
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)
query.add_authorative_answer(info2.dns_pointer())
Expand All @@ -455,7 +455,7 @@ def _validate_complete_response(query, out):
# With the cache repopulated; should respond to only unicast when the answer has been recently multicast
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)
unicast_out, multicast_out = zc.query_handler.response(
Expand Down Expand Up @@ -743,7 +743,7 @@ def test_qu_response_only_sends_additionals_if_sends_answer():
# even if the additional has not been recently multicast
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)

Expand All @@ -763,7 +763,7 @@ def test_qu_response_only_sends_additionals_if_sends_answer():
# even if the additional has not been recently multicast
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)

Expand All @@ -783,7 +783,7 @@ def test_qu_response_only_sends_additionals_if_sends_answer():
# than 75% of its ttl remaining
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)

Expand All @@ -803,12 +803,12 @@ def test_qu_response_only_sends_additionals_if_sends_answer():
# than 75% of its ttl remaining
query = r.DNSOutgoing(const._FLAGS_QR_QUERY)
question = r.DNSQuestion(info.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)

question = r.DNSQuestion(info2.type, const._TYPE_PTR, const._CLASS_IN)
question.unique = True # Set the QU bit
question.unicast = True # Set the QU bit
assert question.unicast is True
query.add_question(question)
zc.cache.add(info2.dns_pointer()) # Add 100% TTL for info2 to the cache
Expand Down
5 changes: 5 additions & 0 deletions zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def unicast(self) -> bool:
"""
return self.unique

@unicast.setter
def unicast(self, value: bool) -> None:
"""Sets the QU bit (not QM)."""
self.unique = value

def __repr__(self) -> str:
"""String representation"""
return "%s[question,%s,%s,%s]" % (
Expand Down