]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
proxyv2: slight code reorganization
authorDaniel Salzman <daniel.salzman@nic.cz>
Tue, 4 Oct 2022 09:20:21 +0000 (11:20 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Tue, 4 Oct 2022 09:21:42 +0000 (11:21 +0200)
src/knot/server/proxyv2.c

index a5212fa4b40ce37c8f11ed161e2e06231ba4586c..ff922636317c6197bb0bd7cdfc92d8ff4d7603db 100644 (file)
@@ -55,13 +55,15 @@ int proxyv2_header_strip(knot_pkt_t **query,
 
        /*
         * Re-parse the query message using the data in the
-        * packet following the PROXY v2 payload.
+        * packet following the PROXY v2 payload. And replace the original
+        * query with the decapsulated one.
         */
        knot_pkt_t *q = knot_pkt_new(pkt + offset, pkt_len - offset, &(*query)->mm);
-       ret = knot_pkt_parse(q, 0);
-
+       if (q == NULL) {
+               return KNOT_ENOMEM;
+       }
        knot_pkt_free(*query);
        *query = q;
 
-       return ret;
+       return knot_pkt_parse(q, 0);
 }