Fixed wrong FD_COPY usage.

Actual macro has dest and src switched.

Change-Id: I4a8e0f32fb85f4efece0b325c8ceea22cf1b42aa
Fixed remote socket fallback if can't bind.

Change-Id: I0f9c1bf7eee52c22550dcb5d9946fba4ecf91ad5
Ignore responses in UDP handler.

Change-Id: I8d128c3408a794f0ad183e15e20a3afa31989e88
Disabled SO_REUSEADDR as it may lead to wierd errors when misconfigured.

Change-Id: Ica5b201351cf9c0d9bb69c052796c2ed38873e6a
utils: add support for quering all resolved addresses and improve kdig processing

Getaddrinfo result for remote server is stored in net_t structure. This allows
to query each resolved address via net_t.srv. It is important for example if
the server has associated AAAA and A records, but listens on IPv4 address only.

refs #2137

Change-Id: Iadd2b011a25a8d9e13f05b239a78f42f8d69b5de
errcode: add white-space characters

Change-Id: If0df4f7947110b84b7c45dc909b3fbd5c5f048a6
kdig: set closed descriptor variable to -1

Coverity scan #1019149

Change-Id: I3beb8efced13d2bf5a5316ae02835739ffa54263
knsupdate: set freed pointer variable to NULL

Coverity scan #1019150

Change-Id: I09e97249299856612bec953eb79f33b978d23580
utils: replace 2 sends with 1 writev to gather TCP data

refs #2137

Change-Id: I42c905d94858e90d87136117e7aaaaaf415854b1
utils: remove useless NULL assignment

refs #2137

Change-Id: I83a723cb07f482b886c588e6ec0f8910c2f97964
doc: update, fix line overflows and add info about fast zone parsing

Change-Id: Ie3e7fab14198c6add9055c9f24eece9c7c123bd1
debug: fix debug compile warning (bad type)

Change-Id: I436236bc78c45f576dfee3ff251ba7ca9c95d1b0
zscanner: fix snprintf return check

Change-Id: Ia8388c541fec44a17f284fc0e4c2aa83afa9b74f
doxygen: fix some warnings

Change-Id: I39d236a0d6594692597f2e66624f0b0d56928c34
Generic memory allocation context.

Default is libc malloc/free.
This will be used to supply to functions where a memory is allocated
in some context (f.e. when building packet) so the API stays the same
and we could switch the allocator as we see fit.

Change-Id: Ia5956b6da38d9feb01c5bfb0a4cd4e9393db0589
Imported mempool from libucw.

Mempool is a type of memory allocator that allows to
free all allocated elements at once.
Removed unnecessary string and state operations.
Licensed under LGPL, same as lists and heap.

Change-Id: I8b8f84f41dcc321f37e51894b5c121f463c4f111
Variable HAT-trie bucket size (0 = pure trie).

Change-Id: I0f1db7e5acd90fa123639a4d8c66765be5882b1d
HAT trie converted to generic mm context.

Change-Id: I2a5ed6c68aeee99f13c7e023e148e92e4965b838
UDP answering converted to mempool memory allocator.

This allows us to reuse the memory without worry about freeing.
Flush (sort of free) is done after packet processing is finished.
Uses generic mm context and mempool from libucw.

Change-Id: Ifcc74e745797eb7f6833c74dc9ebd89743ba4358
Simplified and cleaned up label compression.

The idea was to use simplified tries, but it didn't work so well.

Simplified and cleaned up label compression.

The idea was to use simplified tries, but it didn't work so well.
New approach is based on the fact, that only a small part of unique
suffixes is reused in the packet (mostly qname and few related names),
whilst rest of the names are mentioned scarcely.
As a tradeoff, we will compres those most common names.

Table is scanned in a linear fashion.
Name suffix is aligned (end-to-end) to a current table pointer.
Aligned labels are then compared and best coverage is reported.
Matches that can't exceed current best coverage are ignored.
Not/partially covered names are inserted (only index to wire).
Covering matches are promoted to a lower index, this is because:
- frequent matches are inspected earlier, performance increase
- last 1/4 of the least-used names may be replaced randomly with new names

Didn't change the currently used API to keep the patch nice
and sweet, but there's a lot of legacy code to be removed.

Change-Id: Id86bc7e3e56012182eebf148aad3ddc3b2649879