]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon: lower minimum allowed edns bufsize to 512
authorMarek Vavrusa <marek@vavrusa.com>
Wed, 20 Jul 2016 04:36:20 +0000 (21:36 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Wed, 20 Jul 2016 05:02:28 +0000 (22:02 -0700)
there are cases where switches or middle-boxes
block DNS/UDP answers >512 octets completely,
this gives user an option to mitigate that.
however, there are authoritatives serving
large answers that don't support TCP, so it's
a compromise as always

daemon/README.rst
daemon/bindings.c
lib/defines.h

index 8f9c8af93908d82a76bd3a597c41b9f1df8b091f..7a892cc0423de08ae48c976e235f0535940589db 100644 (file)
@@ -542,14 +542,14 @@ For when listening on ``localhost`` just doesn't cut it.
 
 .. function:: net.bufsize([udp_bufsize])
 
-   Get/set maximum EDNS payload available. Default is 1452 (the maximum unfragmented datagram size).
-   You cannot set less than 1220 (minimum size for DNSSEC) or more than 65535 octets.
+   Get/set maximum EDNS payload available. Default is 1452, increase it in cases when authoritatives send large payloads over UDP and don't support TCP.
+   You cannot set less than 512 (512 is DNS packet size without EDNS, 1220 is minimum size for DNSSEC) or more than 65535 octets.
 
    Example output:
 
    .. code-block:: lua
 
-       > net.bufsize(4096)
+       > net.bufsize 4096
        > net.bufsize()
        4096
 
index 761cc6589af7a4a14ca9515bd8eba18e3a34dd37..3653f5d39d45bd878a8036c52d88e99899a14141 100644 (file)
@@ -301,8 +301,8 @@ static int net_bufsize(lua_State *L)
                return 1;
        }
        int bufsize = lua_tointeger(L, 1);
-       if (bufsize < KNOT_EDNS_MIN_DNSSEC_PAYLOAD || bufsize > UINT16_MAX) {
-               format_error(L, "bufsize must be within <1220, 65535>");
+       if (bufsize < 512 || bufsize > UINT16_MAX) {
+               format_error(L, "bufsize must be within <512, 65535>");
                lua_error(L);
        }
        knot_edns_set_payload(opt_rr, (uint16_t) bufsize);
index 0acc273a139ca0436fd4eb08618eb43e08d3f523..eed0e416c05c8197a591ec33c4bab4b3ab96f9c0 100644 (file)
@@ -62,7 +62,7 @@ static inline int __attribute__((__cold__)) kr_error(int x) {
  */
 #define KR_DNS_PORT   53
 #define KR_EDNS_VERSION 0
-#define KR_EDNS_PAYLOAD 4096 /* Default UDP payload (max unfragmented UDP is 1452B) */
+#define KR_EDNS_PAYLOAD 1452 /* Default UDP payload (max unfragmented UDP is 1452B) */
 
 /*
  * Address sanitizer hints.