summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.c
AgeCommit message (Collapse)Author
2015-08-25resolved: make packet flags logic more expressive againLennart Poettering
This partially reverts 106784ebb7b303ae471851100a773ad2aebf5b80, ad readds separate DNS_PACKET_MAKE_FLAGS() invocations for the LLMNR and DNS case. This is important since SOme flags have different names and meanings on LLMNR and on DNS and we should clarify that via the comments and how we put things together.
2015-08-25resolved: use switch-case statements for protocol detailsDaniel Mack
With more protocols to come, switch repetitive if-else blocks with a switch-case statements.
2015-08-21resolved: when passing RRs across the bus, make sure not to use name compressionLennart Poettering
We explicitly need to turn off name compression when marshalling or demarshalling RRs for bus transfer, since they otherwise refer to packet offsets that reference packets that are not transmitted themselves.
2015-08-21resolved: rework synthesizing logicLennart Poettering
With this change we'll now also generate synthesized RRs for the local LLMNR hostname (first label of system hostname), the local mDNS hostname (first label of system hostname suffixed with .local), the "gateway" hostname and all the reverse PTRs. This hence takes over part of what nss-myhostname already implemented. Local hostnames resolve to the set of local IP addresses. Since the addresses are possibly on different interfaces it is necessary to change the internal DnsAnswer object to track per-RR interface indexes, and to change the bus API to always return the interface per-address rather than per-reply. This change also patches the existing clients for resolved accordingly (nss-resolve + systemd-resolve-host). This also changes the routing logic for queries slightly: we now ensure that the local hostname is never resolved via LLMNR, thus making it trustable on the local system.
2015-08-16resolved: packet - fix typo in read_rr()Tom Gundersen
2015-07-28resolved: packet - refuse empty type bitmapsTom Gundersen
The NSEC type itself must at least be in the bitmap, so NSEC records with empty bitmaps must be bogus.
2015-07-28resolved: packet - fix read_type_window()Tom Gundersen
We were tracking the bit offset inside each byte, rather than inside the whole bitmap.
2015-07-28resolve: packet - fix append_types()Tom Gundersen
We were counting the number of bits set rather than the number of bytes they occupied.
2015-07-23resolved: packet - fix segfault in truncate()Tom Gundersen
A size_t was being accessed as a char* due to the order of arguments being inverted.
2015-07-23resolved: rr - ignore pseudo types in NSEC(3) bitmapsTom Gundersen
2015-07-23resolved: rr - fix parsing of NSEC3Tom Gundersen
We were appending rather than reading the bitmap.
2015-07-23resolved: rr - don't read past end of RR when parsing NSEC(3)Tom Gundersen
We can never read past the end of the packet, so this seems impossible to exploit, but let's error out early as reading past the end of the current RR is clearly an error. Found by Lennart, based on patch by Daniel.
2015-07-23resolved: rr - SSHFP contains the fingerprint, not the keyTom Gundersen
Rename the field to make this clearer.
2015-07-23resolved: packet - fail on invalid zero-length dataTom Gundersen
Most blobs (keys, signatures, ...) should have a specific size given by the relevant algorithm. However, as we don't use/verify the algorithms yet, let's just ensure that we don't read out zero-length data in cases where this does not make sense. The only exceptions, where zero-length data is allowed are in the NSEC3 salt field, and the generic data (which we don't know anything about, so better not make any assumptions).
2015-07-23Merge pull request #669 from poettering/dns-rr-memdupTom Gundersen
resolve: unify memdup() code when parsing RRs
2015-07-23resolved: make sure we alway initialize *start in ↵Lennart Poettering
dns_packet_append_type_window()
2015-07-23resolve: unify memdup() code when parsing RRsLennart Poettering
Let's make dns_packet_read_public_key() more generic by renaming it to dns_packet_read_memdup() (which more accurately describes what it does...). Then, patch all cases where we memdup() RR data to use this new call. This specifically checks for zero-length objects, and handles them gracefully. It will set zero length payload fields as a result. Special care should be taken to ensure that any code using this call can handle the returned allocated field to be NULL if the size is specified as 0!
2015-07-16bitmap: use external iteratorTom Gundersen
Reuse the Iterator object from hashmap.h and expose a similar API. This allows us to do { Iterator i; unsigned n; BITMAP_FOREACH(n, b, i) { Iterator j; unsigned m; BITMAP_FOREACH(m, b, j) { ... } } } without getting confused. Requested by David.
2015-07-14resolved: rr - add NSEC3 supportTom Gundersen
Needed for DNSSEC.
2015-07-14resolved: rr - add NSEC supportTom Gundersen
Needed for DNSSEC.
2015-07-14Merge pull request #586 from teg/resolved-rrs-3Daniel Mack
resolved: minor improvements to RR handling
2015-07-14resolved: rr - add DS supportTom Gundersen
Needed for DNSSEC.
2015-07-14resolved: packet - ensure there is space for IP+UDP headersTom Gundersen
Currently we only make sure our links can handle the size of the payload witohut taking the headers into account.
2015-07-13resolved: make LLMNR checks conditionalDaniel Mack
Make all LLMNR related packet inspections conditional to p->protocol. Use switch-case statements while at it, which will make future additions more readable.
2015-07-08resolved: fix marshalling of RRSIG recordsTom Gundersen
The key tag is 16, not 8 bits.
2015-06-10resolve: move dns routines into sharedNick Owens
2014-12-30tree-wide: spelling fixesVeres Lajos
https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
2014-12-01resolved: make TXT RR generation and parsing more in-line with RFC 6763, ↵Lennart Poettering
section 6.1 The RFC says to encode an single empty TXT string instead of an empty TXT array. It also says to treat a zero-length TXT RR as a TXT array with a single zero-length string.
2014-11-27resolve: reject empty TXT recordsStanisław Pitucha
TXT records should have at least one character, so enforce this. Before 0f84a72 parser SIGSEGV'd on ->txt.strings being NULL, but even if this is fixed we should reject invalid TXT records.
2014-11-27resolve: set error code on failureStanisław Pitucha
Set the error code in case of incorrect name. This prevents continuing and failing an assert(name) later on.
2014-11-27resolve: fix redirection loops in compressed RRStanisław Pitucha
Loops in RR compression were only detected for the first entry. Multiple redirections should be allowed, each one checking for an infinite loop on its own starting point. Also update the pointer on each redirection to avoid longer loops of labels and redirections, in names like: (start) [len=1] "A", [ptr to start] (David: rename variable to "jump_barrier" and add reference to RFC)
2014-11-01resolved: dns-packet - use unaligned read/write helpersTom Gundersen
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-11resolved: implement full LLMNR conflict detection logicLennart Poettering
2014-08-11resolved: properly check return value of dns_resource_record_equal()Lennart Poettering
2014-08-03resolved: RRSIG recordsZbigniew Jędrzejewski-Szmek
2014-08-03resolved: add identifiers for dnssec algorithmsZbigniew Jędrzejewski-Szmek
2014-08-03resolved: DNSKEY recordsZbigniew Jędrzejewski-Szmek
2014-08-01resolved: handle IDNA domainsLennart Poettering
Make sure we format UTF-8 labels as IDNA when writing them to DNS packets, and as native UTF-8 when writing them to mDNS or LLMNR packets. When comparing or processing labels always consider native UTF-8 and IDNA formats equivalent.
2014-07-31resolved: fix serialization of LOC records, check correctnessZbigniew Jędrzejewski-Szmek
2014-07-31resolved: fix deserialization of UTF8 host namesLennart Poettering
2014-07-31resolved: properly process SSHFP RRsLennart Poettering
2014-07-31resolved: properly process SRV recordsLennart Poettering
2014-07-31resolved: make sure we always initialize r when parsing TXT recordsLennart Poettering
2014-07-31resolved: properly process DNAME RRsLennart Poettering
2014-07-31resolved: fix multi-record packets with TXTsZbigniew Jędrzejewski-Szmek
2014-07-31resolved: LOC recordsZbigniew Jędrzejewski-Szmek
LOC records have a version field. So far only version 0 has been published, but if a record with a different version was encountered, our only recourse is to treat it as an unknown type. This is implemented with the 'unparseable' flag, which causes the serialization/deserialization and printing function to cause the record as a blob. The flag can be used if other packet types cannot be parsed for whatever reason.
2014-07-31resolved: SPF recordsZbigniew Jędrzejewski-Szmek
2014-07-31resolved: TXT recordsZbigniew Jędrzejewski-Szmek
2014-07-31resolved: MX recordsZbigniew Jędrzejewski-Szmek