|
Zbigniew Jędrzejewski-Szmek |
611201 |
From d0553ece1ec2b4c586ac033ae2cb9baf22d0af33 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
Date: Tue, 27 Jun 2017 16:59:06 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
Subject: [PATCH] resolved: define various packet sizes as unsigned
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
This seems like the right thing to do, and apparently at least some compilers
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
warn about signed/unsigned comparisons with DNS_PACKET_SIZE_MAX.
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
(cherry picked from commit 64a21fdaca7c93f1c30b21f6fdbd2261798b161a)
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
src/resolve/resolved-dns-packet.c | 2 +-
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
src/resolve/resolved-dns-packet.h | 6 +++---
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
index d1f0f760a4..a486216d68 100644
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
--- a/src/resolve/resolved-dns-packet.c
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+++ b/src/resolve/resolved-dns-packet.c
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
@@ -28,7 +28,7 @@
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
#define EDNS0_OPT_DO (1<<15)
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
-#define DNS_PACKET_SIZE_START 512
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+#define DNS_PACKET_SIZE_START 512u
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
assert_cc(DNS_PACKET_SIZE_START > UDP_PACKET_HEADER_SIZE)
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
typedef struct DnsPacketRewinder {
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
index 3abcaf8cf3..5dff272fd9 100644
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
--- a/src/resolve/resolved-dns-packet.h
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+++ b/src/resolve/resolved-dns-packet.h
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
@@ -58,13 +58,13 @@ struct DnsPacketHeader {
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
/* The various DNS protocols deviate in how large a packet can grow,
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
but the TCP transport has a 16bit size field, hence that appears to
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
be the absolute maximum. */
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
-#define DNS_PACKET_SIZE_MAX 0xFFFF
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+#define DNS_PACKET_SIZE_MAX 0xFFFFu
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
/* RFC 1035 say 512 is the maximum, for classic unicast DNS */
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
-#define DNS_PACKET_UNICAST_SIZE_MAX 512
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+#define DNS_PACKET_UNICAST_SIZE_MAX 512u
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
/* With EDNS0 we can use larger packets, default to 4096, which is what is commonly used */
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
-#define DNS_PACKET_UNICAST_SIZE_LARGE_MAX 4096
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
+#define DNS_PACKET_UNICAST_SIZE_LARGE_MAX 4096u
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
struct DnsPacket {
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
int n_ref;
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
--
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
2.13.0
|
|
Zbigniew Jędrzejewski-Szmek |
611201 |
|