Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • knot/knot-resolver
  • dkg/resolver
  • sbalazik/resolver
  • anb/knot-resolver
  • tkrizek/knot-resolver
  • jono/knot-resolver
  • analogic/knot-resolver
  • flokli/knot-resolver
  • hectorm/knot-resolver
  • aisha/knot-resolver
10 results
Show changes
Commits on Source (5)
Knot Resolver 4.x.y (2019-0m-dd)
================================
Bugfixes
--------
- TCP to upstream: don't send wrong message length (unlikely, !816)
Knot Resolver 4.0.0 (2019-04-18)
================================
......
......@@ -283,14 +283,16 @@ Following commands are useful in special situations and can be usef with and wit
.. function:: net.bufsize([udp_bufsize])
Get/set maximum EDNS payload available. Default is 4096.
You cannot set less than 512 (512 is DNS packet size without EDNS, 1220 is minimum size for DNSSEC) or more than 65535 octets.
Get/set maximum EDNS payload size advertised in DNS packets. Default is 4096 bytes and the default will be lowered to value around 1220 bytes in future, once `DNS Flag Day 2020 <https://dnsflagday.net/>`_ becomes effective.
Minimal value allowed by standard :rfc:`6891` is 512 bytes, which is equal to DNS packet size without Extension Mechanisms for DNS. Value 1220 bytes is minimum size required in DNSSEC standard :rfc:`4035`.
Example output:
.. code-block:: lua
> net.bufsize 4096
> net.bufsize(4096)
nil
> net.bufsize()
4096
......
......@@ -626,13 +626,28 @@ static int qr_task_send(struct qr_task *task, struct session *session,
ret = uv_udp_send(send_req, (uv_udp_t *)handle, &buf, 1, addr, &on_send);
} else if (handle->type == UV_TCP) {
uv_write_t *write_req = (uv_write_t *)ioreq;
uint16_t pkt_size = htons(pkt->size);
uv_buf_t buf[2] = {
{ (char *)&pkt_size, sizeof(pkt_size) },
{ (char *)pkt->wire, pkt->size }
/* We need to write message length in native byte order,
* but we don't have a convenient place to store those bytes.
* The problem is that all memory referenced from buf[] MUST retain
* its contents at least until on_write() is called, and I currently
* can't see any convenient place outside the `pkt` structure.
* So we use directly the *individual* bytes in pkt->size.
* The call to htonl() and the condition will probably be inlinable. */
int lsbi, slsbi; /* (second) least significant byte index */
if (htonl(1) == 1) { /* big endian */
lsbi = sizeof(pkt->size) - 1;
slsbi = sizeof(pkt->size) - 2;
} else {
lsbi = 0;
slsbi = 1;
}
uv_buf_t buf[3] = {
{ (char *)&pkt->size + slsbi, 1 },
{ (char *)&pkt->size + lsbi, 1 },
{ (char *)pkt->wire, pkt->size },
};
write_req->data = task;
ret = uv_write(write_req, (uv_stream_t *)handle, buf, 2, &on_write);
ret = uv_write(write_req, (uv_stream_t *)handle, buf, 3, &on_write);
} else {
assert(false);
}
......