Skip to content

Conversation

@mozzieongit
Copy link
Member

As mentioned in #256 and nsd#444, the AMTRELAY RFC requires the relay to be . in the presentation format:

If the relay type field is 0, the relay field MUST be ".".

Fixes: #256

I noticed that dig also omits the . when printing the AMTRELAY RR with gateway type 0.

@mozzieongit mozzieongit self-assigned this Nov 13, 2025
@mozzieongit mozzieongit changed the title Amtrelay nogateway Fix parsing AMTRELAY no gateway relay Nov 13, 2025
Copy link
Member

@wcawijngaards wcawijngaards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From reading RFC 8777, it looks like it certainly says that the relay field has to be '.' when the type is 0 no gateway. The fix looks fine for code, I wanted to improve the error printout to explain what is causing error if the field is wrong or omitted from input.

@mozzieongit mozzieongit merged commit ed6f3b2 into main Nov 13, 2025
11 checks passed
@mozzieongit mozzieongit deleted the amtrelay-nogateway branch November 13, 2025 14:43
@mozzieongit
Copy link
Member Author

I ended up forgetting to check, but did it now:
When omitting the field, it only prints Missing relay in AMTRELAY. Only when adding a bogus relay, it prints the nice message explaining the requirement of ..

Unfortunately, adding the nice description to the missing relay error would require extending the take_contiguous and maybe_take_contiguous functions to take an optional string to concatenate to the existing error log (as they call the SYNTAX_ERROR macro stating the missing field, and not the parsing function, see types.h parser.h parser.h)

@wcawijngaards
Copy link
Member

Okay that is maybe not really worth it. The extra printout in the error case where it is now is nice, but extending the functions may not be best for parse performance by complicating them. So I guess we keep it as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AMTRELAY with NOGATEWAY type does not parse the required . for the relay field

2 participants