]> git.ipfire.org Git - thirdparty/systemd.git/commit
resolve: cleanup dns_packet_ede_rcode()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 6 Jan 2024 18:28:19 +0000 (03:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 10 Jan 2024 04:06:02 +0000 (13:06 +0900)
commit71682ac6bb6579376ad4be55c93bbab4e5ad7714
tree348059441833b4c6bd34b8b5fd8b6639f3e450ee
parenta92ea352a51059aee8ada3670ec23b9bfd848978
resolve: cleanup dns_packet_ede_rcode()

This makes the following:
- make dns_packet_ede_rcode() return -EINVAL when EDE code not found.
  Otherwise, the caller may be confused that the packet has an unknown
  error code.
- make the function escape EDE message only when non-utf8 message is received.
- the message handling logic is applied even if the error code is unknown, as
  there is no reason that we escape EDE message only when an known error code
  is received.
- reduce scope of variables,
- drop redundant 'else',
- append full stop to the log messages,
- drop redundant log message in the caller,
- split out error in the function and returned EDE error code.

Follow-up for ac6844460ca1c01eaf2cb209ffa21c200d21a8f8.
src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-packet.h
src/resolve/resolved-dns-transaction.c