From 054ce3eced746162d42c76520cc8d6b420e0f561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jun 2017 14:23:48 -0400 Subject: [PATCH] Fix build and backport one more patch which restores efficiency --- ...t-allocate-packets-with-minimum-size.patch | 44 +++++++++++++++++++ 0079-fix-includes.patch | 41 +++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 0078-resolved-do-not-allocate-packets-with-minimum-size.patch create mode 100644 0079-fix-includes.patch diff --git a/0078-resolved-do-not-allocate-packets-with-minimum-size.patch b/0078-resolved-do-not-allocate-packets-with-minimum-size.patch new file mode 100644 index 0000000..f25b516 --- /dev/null +++ b/0078-resolved-do-not-allocate-packets-with-minimum-size.patch @@ -0,0 +1,44 @@ +From 9d279d91c16b527fed9a09d96e5b984244222828 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 27 Jun 2017 14:20:00 -0400 +Subject: [PATCH] resolved: do not allocate packets with minimum size + +dns_packet_new() is sometimes called with mtu == 0, and in that case we should +allocate more than the absolute minimum (which is the dns packet header size), +otherwise we have to resize immediately again after appending the first data to +the packet. + +This partially reverts the previous commit. +--- + src/resolve/resolved-dns-packet.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c +index 821b66e266..08c48f0442 100644 +--- a/src/resolve/resolved-dns-packet.c ++++ b/src/resolve/resolved-dns-packet.c +@@ -28,6 +28,9 @@ + + #define EDNS0_OPT_DO (1<<15) + ++#define DNS_PACKET_SIZE_START 512 ++assert_cc(DNS_PACKET_SIZE_START > UDP_PACKET_HEADER_SIZE) ++ + typedef struct DnsPacketRewinder { + DnsPacket *packet; + size_t saved_rindex; +@@ -47,7 +50,10 @@ int dns_packet_new(DnsPacket **ret, DnsProtocol protocol, size_t mtu) { + + assert(ret); + +- a = MAX(mtu, DNS_PACKET_HEADER_SIZE); ++ if (mtu < UDP_PACKET_HEADER_SIZE) ++ a = DNS_PACKET_SIZE_START; ++ else ++ a = MAX(mtu, DNS_PACKET_HEADER_SIZE); + + /* round up to next page size */ + a = PAGE_ALIGN(ALIGN(sizeof(DnsPacket)) + a) - ALIGN(sizeof(DnsPacket)); +-- +2.13.0 + diff --git a/0079-fix-includes.patch b/0079-fix-includes.patch new file mode 100644 index 0000000..69b4091 --- /dev/null +++ b/0079-fix-includes.patch @@ -0,0 +1,41 @@ +From 284d1cd0a12cad96a5ea61d1afb0dd677dbd147e Mon Sep 17 00:00:00 2001 +From: Matija Skala +Date: Wed, 15 Mar 2017 13:21:10 +0100 +Subject: [PATCH] fix includes + +linux/sockios.h is needed for the SIOCGSTAMPNS macro + +xlocale.h is included indirectly in glibc and doesn't even exist in +other libcs +--- + src/basic/parse-util.c | 1 - + src/libsystemd-network/sd-lldp.c | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c +index 6e58ced6f5..d86700736d 100644 +--- a/src/basic/parse-util.c ++++ b/src/basic/parse-util.c +@@ -23,7 +23,6 @@ + #include + #include + #include +-#include + + #include "alloc-util.h" + #include "extract-word.h" +diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c +index 0702241506..39ddb2461a 100644 +--- a/src/libsystemd-network/sd-lldp.c ++++ b/src/libsystemd-network/sd-lldp.c +@@ -19,6 +19,7 @@ + ***/ + + #include ++#include + + #include "sd-lldp.h" + +-- +2.13.0 +