summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-lease.c
AgeCommit message (Collapse)Author
2015-09-01tree-wide: do not shadow the global var timezoneThomas Hindoe Paaboel Andersen
2015-08-27dhcp: say domain name, when we mean domain nameLennart Poettering
2015-08-27dhcp: clean up dhcp4 lease objectLennart Poettering
a) drop handling of obsolete or unused DHCP options time_offset, mtu_aging_timeout, policy filter, mdr, ttl, ip forwarding settings. Should this become useful one day we can readd support for this. b) For subnet mask and broadcast it is not always clear whether 0 or 255.255.255.255 might be valid, hence maintain a boolean indicating validity next to it. c) serialize/deserialize broadcast address, lifetime, T1 and T2 together with the rest of the fields in dhcp_lease_save() and dhcp_lease_load(). d) consistently return ENODATA from getter functions for data that is missing in the lease. e) add missing getter calls for broadcast, lifetime, T1, T2. f) when decoding DHCP options, generate debug messages on parse failures, but try to proceed if possible. g) Similar, when deserializing a lease in dhcp_lease_load(), make sure we deal nicely with unparsable fields, to provide upgrade compat. h) fix some memory allocations
2015-08-26dhcp: generic data should be void*, not uint8_t*Lennart Poettering
If we handly arbitrary data we should use "void*" pointers, not "uint8_t*", how go intended C to be used.
2015-08-26dhcp: stop using refcnt.hLennart Poettering
No need to invole atomic ops in single-threaded APIs, let's simplify this.
2015-08-26dhcp: keep lease save/load functions privateLennart Poettering
When we make sd-dhcp public one day we really should not make sd_dhcp_lease_save() and sd_dhcp_lease_load() public, since it's pretty much only useful as internal utility for networkd itself.
2015-08-26dhcp: normalize DHCP host and domain names from leasesLennart Poettering
Previoulsy, we just checked whether the domain names specified in incoming DHCP leases are valid. Given that validation code actually internally normalizes anyway, it's a good idea to simply do the full normalization and store that in the lease structure. This allows us to remove the manual removal of a trailing dot, if there is one.
2015-08-26dhcp: various simplificationsLennart Poettering
2015-08-26dhcp,network: implement RFC 4833 (DHCP Timezone option)Lennart Poettering
This one is simply to add: encode the tzdata timezone in the DHCP options and optionally make use of it.
2015-08-26dhcp: be more careful when parsing strings from DHCP packetsLennart Poettering
Let's make sure there's no embedded 0 byte. Also, let's reset the string if the length is zero.
2015-08-08libsystemd-network: fix memory leakreverendhomer
2015-08-06libsystemd-network: plug memory leakDaniel Mack
Coverity #1315324
2015-08-05Merge branch 'hostnamectl-dot-v2'Zbigniew Jędrzejewski-Szmek
Manual merge of https://github.com/systemd/systemd/pull/751.
2015-08-05hostname-util: add relax parameter to hostname_is_validZbigniew Jędrzejewski-Szmek
Tests are modified to check behaviour with relax and without relax. New tests are added for hostname_cleanup(). Tests are moved a new file (test-hostname-util) because there's now a bunch of them. New parameter is not used anywhere, except in tests, so there should be no observable change.
2015-08-05network: make enough space for stringLennart Poettering
Follow-up for PR #877.
2015-08-05networkd: clean up duplicate codeAlex Crawford
2015-08-05networkd: serialize the private optionsAlex Crawford
Save the private options along side the rest of the options in the lease files.
2015-08-05networkd: add private options to lease structAlex Crawford
This stores private-zone DHCP options inside of their respective DHCP lease. These options aren't used by networkd (what would it do with them?), but saving them will allow other programs to query the values. To improve performance, the options are stored in ascending order by tag.
2015-07-29tree-wide: port everything over to fflush_and_check()Lennart Poettering
Some places invoked fflush() directly with their own manual error checking, let's unify all that by using fflush_and_check(). This also unifies the general error paths of fflush()+rename() file writers.
2015-07-14Merge pull request #538 from mischief/multiple-routersTom Gundersen
sd-dhcp-lease: fix handling of multiple routers We only support one router, but in case more than one is given, we now ignore subsequent ones, rather than fall over.
2015-07-12dhcp: add support for vendor specific DHCP optionBeniamino Galvani
This adds support for option 43 (Vendor Specific Information) to libsystemd-network DHCP code. The option carries an opaque object of n octets, interpreted by vendor-specific code on the clients and servers. [@zonque: adopted to new unhexmem() API]
2015-07-12basic: util - fix errorhandling in unhexmem()Tom Gundersen
We were ignoring failures from unhexchar, which meant that invalid hex characters were being turned into garbage rather than the string rejected. Fix this by making unhexmem return an error code, also change the API slightly, to return the size of the returned memory, reflecting the fact that the memory is a binary blob,and not a string. For convenience, still append a trailing NULL byte to the returned memory (not included in the returned size), allowing callers to treat it as a string without doing a second copy.
2015-07-11sd-dhcp-lease: fix handling of multiple routersNick Owens
currently if a dhcp server sends more than one router, sd-dhcp-lease does not copy the ip because it assumes it will only ever be 4 bytes. a dhcp server could send more than one ip in the router list, so we should copy the first one and ignore the rest of the bytes.
2015-06-10libsystemd-network: use domain validation instead of hostname validation for ↵Nick Owens
dhcp domain option previously hostname_is_valid was used to validate domain names, which would silently drop perfectly valid dns names that were longer than a single dns label.
2015-05-21json: minor style fixessystemd/v220Lennart Poettering
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-01-28sd-dhcp: chop of trailing dot of DHCP supplied host and domain namsLennart Poettering
2015-01-13refcnt: refcnt is unsigned, fix comparisonsTom Gundersen
This does not make a difference, but the code was confusing.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-20sd-dhcp-lease: fix copy-paste error asserting wrong function argumentThomas Haller
2014-11-19sd-dhcp-lease: load/save client IDDan Williams
The lease is usually tied to the client ID, so users of the lease may want to know what client ID it was acquired with.
2014-11-18sd-dhcp-lease: expose load/save functionsTom Gundersen
Based on patch by Dan Williams.
2014-11-01sd-dhcp-lease: use shared default prefixlen functionTom Gundersen
Also change the default prefixlen function to only access the first octet of the in_addr.
2014-11-01sd-dhcp-lease: use unaligned read helpersTom Gundersen
2014-10-27shared: in-addr-utils - add default_subnet_mask and default_prefixlen methodsTom Gundersen
These use the (deprecated) IPv4 address classes to deduce the corresponding subnet masks. This is useful when addresses without subnet masks and prefix lengths are given. Make use of these new functions from sd-dhcp-lease.
2014-08-15dhcp: the localhost isn't valid as hostname eitherLennart Poettering
2014-08-15sd-dhcp-lease: verify hostname and domainnames we receiveTom Gundersen
2014-07-23networkd: merge DNS and NTP entries when exportingTom Gundersen
In the state files, do not distinguish where the various entries came from (static or DHCP), but include them all in the same list.
2014-07-17sd-network: remove redundant array size parameter from functions that return ↵Lennart Poettering
arrays As long as the number of array entries is relatively small it's nicer to simply return the number of entries directly, instead of using a size_t* return parameter for it.
2014-06-29Add support for DHCP static route optionsEugene Yakubovich
This adds support for DHCP options 33 and 121: Static Route and Classless Static Route. To enable this feature, set UseRoutes=true in .network file. Returned routes are added to the routing table.
2014-06-29sd-dhcp-client/networkd: set lifetimes for IPv4 addressesPatrik Flykt
Note that /proc/sys/net/ipv4/ip_dynaddr needs to be non-zero. [tomegun: hook up DHCP renew events to increase the lifetime when necessary]
2014-05-20dhcp-lease: add support for parsing a few more dhcp optionsTom Gundersen
2014-05-20dhcp-lease: refactor lease parsingTom Gundersen
Use helper functions, and add some more sanity checking/asserts.
2014-05-19sd-dhcp-lease/sd-network: modernization and fix leakTom Gundersen
2014-05-19sd-dhcp-lease: move in_addr (de)serialization to shared network codeTom Gundersen
2014-04-30networkd: dont configure route if lease doesn't have oneUmut Tezduyar Lindskog
2014-04-29sd-dhcp-lease: fix double reallocTom Gundersen