+2007-06-13 Bob Halley <halley@dnspython.org>
+
+ * dns/inet.py: Added is_multicast().
+
+ * dns/query.py (udp): If the queried address is a multicast address, then
+ don't check that the address of the response is the same as the address
+ queried.
+
2007-05-24 Bob Halley <halley@dnspython.org>
* dns/rdtypes/IN/NAPTR.py: NAPTR comparisons didn't compare the
return AF_INET6
except:
raise ValueError
+
+def is_multicast(text):
+ """Is the textual-form network address a multicast address?
+
+ @param text: the textual address
+ @raises ValueError: the address family cannot be determined from the input.
+ @rtype: bool
+ """
+ try:
+ first = ord(dns.ipv4.inet_aton(text)[0])
+ return (first >= 224 and first <= 239)
+ except:
+ try:
+ first = ord(dns.ipv6.inet_aton(text)[0])
+ return (first == 255)
+ except:
+ raise ValueError
+
while 1:
_wait_for_readable(s, expiration)
(wire, from_address) = s.recvfrom(65535)
- if from_address == destination:
+ if from_address == destination or \
+ (dns.inet.is_multicast(where) and \
+ from_address[1:] == destination[1:]):
break
if not ignore_unexpected:
raise UnexpectedSource, \