Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to encode/change rcode in a packet? #97

Open
maxpain opened this issue Feb 27, 2024 · 2 comments
Open

How to encode/change rcode in a packet? #97

maxpain opened this issue Feb 27, 2024 · 2 comments

Comments

@maxpain
Copy link

maxpain commented Feb 27, 2024

No description provided.

@maxpain maxpain changed the title How to change rcode? How to encode/change rcode in a packet? Feb 27, 2024
@jphgoo049
Copy link

I'm struggling with the same issue. Doesn't seem to be supported currently, even though it's present in the decoded packet object.

@jphgoo049
Copy link

I've tested it and you just need to use bitwise operations to assign the flags according to the spec: https://www.rfc-editor.org/rfc/rfc1035.html#section-4.1.1

For example, setting flags: 1 << 12 changes the opcode to STATUS and flags: 3 changes the rcode to NXDOMAIN. You can combine multiple settings using bitwise or (|) e.g. flags: (1 << 12) | 3.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants