]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/resolve/resolved-dns-packet.c
resolve: Try to remove the ambiguity about the mtu parameter of dns_packet_new (...
authorBenjamin Robin <benjarobin@users.noreply.github.com>
Thu, 6 Jul 2017 02:56:17 +0000 (04:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 6 Jul 2017 02:56:17 +0000 (22:56 -0400)
commit46a58596731684ba511b04ee9e8f7a9af490fbc2
treebb220174a97739c702ab9b1627df87b2a435fc3e
parent86086fce66f7c12168c7dfb699fb6dcc5b54a5f2
resolve: Try to remove the ambiguity about the mtu parameter of dns_packet_new (#6285)

Actually the caller of dns_packet_new() pass 0 or the data size of the UDP message.
So try to reflect that, so rename the `mtu` parameter to `min_alloc_dsize`.

In fact `mtu` is the size of the whole UDP message, including the UDP header,
and here we just need to pass the size of data (without header). This was confusing.

Also add a check on the requested allocated size, since some caller do not check what is really allocated.
Indeed the function do not allocate more than DNS_PACKET_SIZE_MAX whatever the value of the `mtu` parameter.
src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-packet.h
src/resolve/test-resolved-packet.c