summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
AgeCommit message (Collapse)Author
2015-08-31sd-dhcp-server: simplify pool creationTom Gundersen
Merge sd_dhcp_server_set_address() and sd_dhcp_server_set_lease_pool() into sd_dhcp_server_configure_pool() as the behavior of the two former depends on the order they are called in. The flexibility is not needed, so let's just do this in one call.
2015-08-28sd-dhcp-server: improve predictability of leasesTom Gundersen
Rather than having all clients attempt to get the same leases (starting at the beginning of the pool), make each client star at a random offset into the pool determined by their client id. This greatly increases the chances of a given client receiving the same IP address even though both the client and server have lost any lease information (and distinct server instances handing out the same leases).
2015-08-27dhcp: say domain name, when we mean domain nameLennart Poettering
2015-08-27network: get rid of more RefCnt usageLennart Poettering
A follow-up to 3733eec3e292e4ddb4cba5eb8d3bd8cbee7102d8
2015-08-27dhcp: fix n_ref typeLennart Poettering
Fixes fallout from 3733eec3e292e4ddb4cba5eb8d3bd8cbee7102d8.
2015-08-27tree-wide: we place the opening bracket on the same line as the function nameLennart Poettering
Let's do this everywhere the same way.
2015-08-27dhcp,network: support emitting DNS/NTP server information from DHCP serverLennart Poettering
For now, this is very simple and IP addresses have to be configured manually.
2015-08-27dhcp: don't underflow in lease time calculationsLennart Poettering
Don't underflow when calculating lease time.
2015-08-27networkd: make DHCP lease timeouts configurableLennart Poettering
2015-08-27dhcp: NTP servers should be requested by networkd but not implicitly by sd-dhcpLennart Poettering
The library so far always requested the NTP servers. This might be unnecessary in some uses, hence let's move the request into networkd instead.
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: rename index to ifindexLennart Poettering
This avoids confusion what this is, in particular as libc knows an index() function.
2015-08-26dhcp: store client id as void*, since we dont know what it isLennart Poettering
2015-08-26dhcp: properly handle error from ioctl()Lennart Poettering
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-26network: s/user_data/userdata/Lennart Poettering
Everywhere else we call the generic user data pointer just "userdata", rather than "user_data". Let's do this here, too.
2015-08-26dhcp: coding style fixesLennart Poettering
We place the opening bracket of a function on the same line as the function name. Let's do so in the DHCP sources too.
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-26sd-dhcp6: fix domainname memleakDavid Herrmann
strv_extend() does not consume the passed entry, hence, we must properly free it. Furthermore, we should *not* use strv_consume() as we do greedy allocations on 'ret'; and greedy-allocations should only be used for short lived objects or caches. Fix the domainname parser to properly free temporary storage when done.
2015-08-26sd-dhcp: don't randomly ref objectsDavid Herrmann
In our API design, getter-functions don't ref objects. Calls like foo_get_bar() will not ref 'bar'. We never do that and there is no real reason to do it in single threaded APIs. If you need a ref-count, you better take it yourself *BEFORE* doing anything else on the parent object (as this might invalidate your pointer). Right now, sd_dhcp?_get_lease() refs the lease it returns. A lot of code-paths in systemd do not expect this and thus leak the lease reference. Fix this by changing the API to not ref returned objects.
2015-08-21network: Add function to serialize an IPv6 addressPatrik Flykt
2015-08-21test-dhcp6-client: Add tests for DNS and NTP optionsPatrik Flykt
Test option setting and getting in test_advertise_option(). Verify that the information provided in DHCPv6 Reply messages is also available in the Information and Solicit callbacks.
2015-08-21sd-dhcp6: Support deprecated SNTP Configuration OptionPatrik Flykt
Although the SNTP option specified in RFC 4075 has been deprecated, some servers are still sending NTP information with this option. Use the SNTP information provided only if the NTP option is not present. Update the test case as SNTP information is also requested.
2015-08-21sd-dhcp6: Add support for DHCPv6 NTP Server OptionPatrik Flykt
Support NTP server and multicast addresses and NTP server domain names as specified in RFC 5908.
2015-08-21sd-dhcp6: Add support for DHCPv6 DNS Domain Search List optionPatrik Flykt
Support DHCPv6 DNS search list option as specified in RFC 3646. This option contains a list of DNS search domains encoded without compression as specified in Section 8. of RFC 3315.
2015-08-21sd-dhcp6: Add support for DHCPv6 DNS Recursive Name Server optionPatrik Flykt
Support DHCPv6 DNS server option as specified in RFC 3646. This option contains a list of IPv6 DNS server addresses.
2015-08-21dhcp6-option: Add helper function for uncompressed domain namesPatrik Flykt
Add a helper function containing a modified version of dns_packet_read_name() that does not use DnsPacket to extract a string array of domain names from the provided option data. The domain names are stored uncompressed as defined in Section 8. of RFC 3315.
2015-08-21dhcp6-option: Add helper function for fetching IPv6 addressesPatrik Flykt
Add a helper function that extracts a block of IPv6 addresses from the provided option data.
2015-08-21sd-dhcp6-client: Save a DHCPv6 lease also with Information ReplyPatrik Flykt
As the lease structure contains interesting information, save it also for the Information Reply.
2015-08-21sd-dhcp6-client: Fix unreferencing DHCPv6 lease on client resetPatrik Flykt
When the DHCPv6 client is started by the library user or stopped for any reason, unref the DHCPv6 lease when resetting the DHCPv6 client data structure. This makes the DHCPv6 client always start from a clean state and not keep unnecessary an lease structure around when stopped. If this is not done, a previously existing lease information can be interpreted to be from another server when restarting DHCPv6.
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-06tree-wide: do not return error codes as boolThomas Hindoe Paaboel Andersen
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-08-04networkd: add DHCP options for private zoneAlex Crawford
2015-08-04networkd: DHCP fix CID 1315105Susant Sahani
CID 1315105: Resource leaks (RESOURCE_LEAK) /src/libsystemd-network/sd-dhcp-server.c: 800 in dhcp_server_handle_message() *** CID 1315105: Resource leaks (RESOURCE_LEAK) /src/libsystemd-network/sd-dhcp-server.c: 800 in
2015-08-03Merge pull request #844 from poettering/clock-boottime2Tom Gundersen
tree-wide: convert bootchart and lldp code to use clock_boottime_or_m…
2015-08-03tree-wide: convert bootchart and lldp code to use clock_boottime_or_monotonic()Lennart Poettering
We should avoid using CLOCK_BOOTTIME directly unless we actually can sensible distuingish it from CLOCK_MONOTONIC. CLOCK_BOOTTIME is only fully feature on very recent Linux kernels, hence we should stick to a fallback logic, which is already available in the clock_boottime_or_monotonic() call.
2015-08-03sd-event: make sure sd_event_now() cannot failLennart Poettering
Previously, if the event loop never ran before sd_event_now() would fail. With this change it will instead fall back to invoking now(). This way, the function cannot fail anymore, except for programming error when invoking it with wrong parameters. This takes into account the fact that many callers did not handle the error condition correctly, and if the callers did, then they kept simply invoking now() as fall back on their own. Hence let's shorten the code using this call, and make things more robust, and let's just fall back to now() internally. Whether now() is used or the cache timestamp may still be detected via the return value of sd_event_now(). If > 0 is returned, then the fall back to now() was used, if == 0 is returned, then the cached value was returned. This patch also simplifies many of the invocations of sd_event_now(): the manual fall back to now() can be removed. Also, in cases where the call is invoked withing void functions we can now protect the invocation via assert_se(), acknowledging the fact that the call cannot fail anymore except for programming errors with the parameters. This change is inspired by #841.
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.