[Twisted-Python] twisted names - how to add answers to a message and send replies

Jean-Paul Calderone exarkun at divmod.com
Wed Mar 12 09:30:00 EDT 2008

On Wed, 12 Mar 2008 08:04:21 +0000, Chris Dew <chris at sidwells.com> wrote:
>I have a small script which answers dns queries by returning the original
>message.  I have spent a couple of hours RTFMing, but I still cannot find
>out how to correctly add answers to the message, before returning it.
>I want to add an answer, either a Record_CNAME or Record_A, so as to produce
>a trivial authoritative-only DNS server.
>Adding a Record_XXX object to message.answers using the Array's 'append'
>method produces a MalformedPacket (according to wireshark), though the
>server does not throw any exceptions.   (In this situation, the answer
>count, as shown by dig, does rise to 1, even though no answer is displayed
>[due to malformed packet?].)
>Perhaps there is a completely different way to do this?  Could I craft a
>message with answers from scratch?

Did you set `m.answer´ to 1?


More information about the Twisted-Python mailing list