summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
AgeCommit message (Collapse)Author
2015-09-24Merge pull request #1332 from thom311/masterTom Gundersen
sd-dhcp6: ensure canceling lease timers and refactor setting lease
2015-09-23test-dhcp6-client: Update test case due to changed semanticsPatrik Flykt
Update the test case to stop the ongoing Information Request exchange before unsetting its state. To keep the test case callback verification simpler, temporarily unset the callback function before stopping.
2015-09-23sd-dhcp6-client: Prevent setting and restarting of DHCPv6 clientPatrik Flykt
Prevent modifications to index, MAC address, DUID and Information Request while the DHCPv6 client is running. Require the DHCPv6 client to be stopped first instead of always unconditionally restarting it if the caller calls sd_dhcp6_client_start() more than once. With this change, handling of for example incoming Router Advertisments becomes much easier.
2015-09-22sd-lldp: hide internal detailsDavid Herrmann
Currently, sd-lldp.h exports "UPDATE_INFO".. and defines it to a magic constant '10'. This is completely bogus, so fix it to follow our coding standards: - Prefix exported symbols by SD_LLDP_* - Define a separate event-enum for event types - Translate internal state to external event-types
2015-09-22sd-lldp: hide internal informationDavid Herrmann
Don't export constant that are only used internally.
2015-09-22sd-pppoe: fix namespacingDavid Herrmann
Prefix all exported constants by SD_PPPOE_* to avoid namespacing conflicts.
2015-09-22sd-ipv4ll: fix namespacingDavid Herrmann
Prefix all exported constants with SD_IPV4LL_* to avoid namespacing conflicts.
2015-09-22sd-ipv4acd: fix namespacingDavid Herrmann
Prefix all exported constants with SD_IPV4ACD to prevent namespacing conflicts.
2015-09-22sd-icmp6-nd: fix namespacingDavid Herrmann
Prefix all exported constants by SD_ICMP6_ND_* to avoid any namespacing conflicts.
2015-09-22sd-dhcp6: fix namespacingDavid Herrmann
Prefix all exported constants with SD_DHCP6_CLIENT_* to avoid any namespacing conflicts.
2015-09-22sd-dhcp: fix namespacingDavid Herrmann
Prefix all constants with SD_DHCP_CLIENT_* to avoid namespacing conflicts.
2015-09-22sd-dhcp6: ensure canceling lease timers and refactor setting leaseThomas Haller
Factor our common code to set/clear the client lease. Resetting the lease involves canceling old timers. Also, most importantly, when resetting the lease in client_receive_advertise(), ensure to cancel the timers too. It is not immediately clear, why at that point no timers would be pending. The lease-unref from sd_dhcp6_client_unref() can be omited, because of the preceeding client_reset() call.
2015-09-21test-ipv4ll: use unsigned instead of an array for a seedRonny Chevalier
ipv4ll use an unsigned instead of an uint8_t array. Hence, use an unsigned seed instead of declaring an array and then dereferencing it later.
2015-09-21sd-ipv4ll: do not assert_return when seed == 0Ronny Chevalier
Now that seed is an unsigned and not an array, we do not need to assert on it.
2015-09-18sd-ipv4{acd,ll}: add simple test programsTom Gundersen
These programs should be run manually, typically two instances on a veth pair to check conflict detection. Both test programs take the ifname as input, the ACD also takes the IP address to check, whereas LL (optionally) takes the seed, which determines the sequence of IP addresses to try.
2015-09-18sd-ipv4acd: introduce new library split out from sd-ipv4llTom Gundersen
This splits the Address Conflict Detection out of the Link Local library so that we can reuse it for DHCP and static addresses in the future. Implements RFC5227.
2015-09-18sd-ipv4ll: simplify conflict handlingTom Gundersen
Use stop() and start() to drop some pulicate code.
2015-09-18sd-ipv4ll: rework callbacksTom Gundersen
Firstly, no longer distinguish between STOP and INIT states. Secondly, do not trigger STOP events when calls to sd_ipv4ll_*() fail. The caller is the one who would receive the event and will already know that the call to sd_ipv4ll_*() has failed, so it is redundant. STOP events will now only be triggered by calling sd_ipv4ll_stop() explicitly or by some internal error in the library triggered by receiving a packet or an expiring timeout (i.e., any error that would otherwise not be reported back to the consumer of the library). Lastly, follow CODING_STYLE and always return NULL on unref. Protect from objects being destroyed in callbacks accordingly.
2015-09-18sd-ipv4ll: don't allow changing MAC address whilst runningTom Gundersen
This requires the caller to stop and restart the statemachine if they want to change the MAC address.
2015-09-18sd-ipv4ll: code cleanupsTom Gundersen
Simplify timeout handling.
2015-09-18sd-ipv4ll: remove duplicate packet verificationTom Gundersen
Most packets are filtered out by the BPF, so only check for the parts that may actually differ.
2015-09-18sd-ipv4ll: minor cleanupsTom Gundersen
2015-09-18sd-ipv4ll: split out on_conflict() from on_packet()Tom Gundersen
2015-09-18sd-ipv4ll: split run_state_machine() into on_packet() and on_timeout()Tom Gundersen
Simplify the code a bit, no functional change.
2015-09-18sd-ipv4ll: filter out unwanted ARP packets in the kernelTom Gundersen
We currently process every ARP packet, but we should only care about the ones relating to our IP address. Also rename ipv4ll helpers to apr-utils.[ch], and rework the helpers a bit.
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering
Patch via coccinelle.
2015-09-07basic: rework virtualization detection APILennart Poettering
Introduce a proper enum, and don't pass around string ids anymore. This simplifies things quite a bit, and makes virtualization detection more similar to architecture detection.
2015-09-01Merge pull request #1108 from phomes/dont-shadow-globalsDavid Herrmann
tree-wide: do not shadow the global var timezone
2015-09-01tree-wide: do not shadow the global var timezoneThomas Hindoe Paaboel Andersen
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