]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: add support for linked packets
authorDaniel Mack <daniel@zonque.org>
Wed, 9 Dec 2015 11:01:08 +0000 (12:01 +0100)
committerDaniel Mack <daniel@zonque.org>
Thu, 10 Dec 2015 09:20:54 +0000 (10:20 +0100)
For mDNS, we need to support the TC bit in case the list of known answers
exceed the maximum packet size.

For this, add a 'more' pointer to DnsPacket for an additional packet.

When a packet is unref'ed, the ->more packet is also unrefed, so it
sufficient to only keep track of the 1st packet in a chain.

src/resolve/resolved-dns-packet.c
src/resolve/resolved-dns-packet.h

index e5de5a1cd6a7f2c86df39ede7e54c3b546c56a90..f753b3522f0bf167342e775d975ef5296d6289e4 100644 (file)
@@ -170,6 +170,9 @@ DnsPacket *dns_packet_unref(DnsPacket *p) {
 
         assert(p->n_ref > 0);
 
+        if (p->more)
+                dns_packet_unref(p->more);
+
         if (p->n_ref == 1)
                 dns_packet_free(p);
         else
index 405838e60d57fdcba76af14eca73edd4dafccc62..3d84cb622ba9c967d2e1f05da88ac7a44b223f0d 100644 (file)
@@ -88,6 +88,9 @@ struct DnsPacket {
         uint16_t sender_port, destination_port;
         uint32_t ttl;
 
+        /* For support of truncated packets */
+        DnsPacket *more;
+
         bool on_stack:1;
         bool extracted:1;
         bool refuse_compression:1;