summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
AgeCommit message (Collapse)Author
2014-08-11networkd: monopolize in_addr utility functions in shared/in-addr-util.hLennart Poettering
Primarily, this means we get rid of net_parse_inaddr(), and replace it everywhere with in_addr_from_string() and in_addr_from_string_auto(). These functions do not clobber the callers arguments on failure, which is more close to our usual coding style.
2014-08-04sd-dhcp-server: always send out ROUTER and SUBNET_MASKTom Gundersen
For now we simply take these values from the server's address.
2014-08-03sd-dhcp-server: avoid returning garbage valueThomas Hindoe Paaboel Andersen
Force renewing with a pool size of 0 would return the uninitialized r.
2014-08-03sd-dhcp-server: check if r < 0Thomas Hindoe Paaboel Andersen
2014-08-01sd-dhcp-client: allow the max dhcp message size to be set to the MTU of the linkTom Gundersen
2014-07-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
2014-07-29sd-network: make socket filter programs static const where possibleLennart Poettering
(also, fix some whitespace/indentation issues, and avoid "index" as identifier in order to not clash against libc's "index()" call)
2014-07-28sd-dhcp-server: add forcerenew supportTom Gundersen
2014-07-28sd-dhcp-client: add support for FORCERENEWTom Gundersen
This partially implements RFC3203. Note that we are not fully compliant as we do not support authentication.
2014-07-28sd-dhcp-client: listen on UDP socket as soon as a lease is acquiredTom Gundersen
This is necessary in order to listen for FORCERENEW events.
2014-07-28dhcp-network: enable IP_FREEBIND for UDP socketsTom Gundersen
This allows the sockets to be bound to a specific address before it is configured, also enable SO_REUSEADDR to allow multiple DHCP clients to run at the same time.
2014-07-28sd-dhcp-client: drop event DHCP_EVENT_NO_LEASETom Gundersen
Keep this internal to the client and simply restart it when NAK is receieved, as per the RFC.
2014-07-28sd-dhcp-client: only verify UDP messagesTom Gundersen
RAW messages are verified by the BPF in the kernel.
2014-07-24libsystemd-network: use CLOCK_BOOTTIME instead of CLOCK_MONOTONIC where possibleTom Gundersen
The timeouts in the networking library (DHCP lease timeouts and similar) should not be affected by suspend. In the cases where CLOCK_BOOTTIME is not implemented, it is still safe to fallback to CLOCK_MONOTONIC, as the consumers of the library (i.e., networkd) _should_ renew the leases when coming out of suspend.
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-23dhcp-network: remove unused DHCP6_STATE_RSDan Williams
Probably a left-over from when router solicitations were requested in the DHCP6 code. But since they are now separate, this state is no longer needed.
2014-07-18change type for address family to "int"Lennart Poettering
Let's settle on a single type for all address family values, even if UNIX is very inconsitent on the precise type otherwise. Given that socket() is the primary entrypoint for the sockets API, and that uses "int", and "int" is relatively simple and generic, we settle on "int" for this.
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-07-15sd-dhcp-client: make request broadcasts opt-inTom Gundersen
It appears there is no good way to decide whether or not broadcasts should be enabled, there is hardware that must have broadcast, and there are networks that only allow unicast. So we give up and make this configurable. By default, unicast is used, but if the kernel were to inform us abotu certain interfaces requiring broadcast, we could change this to opt-in by default in those cases.
2014-07-14sd-dhcp-server: make gcc happyTom Gundersen
It complains about optoffset possibly being uninitialized. It is wrong, but let's just initialize it.
2014-07-14sd-dhcp6-client: make gcc happyTom Gundersen
It complains about {max,init}_retransmit_time possibly being uninitialized. It is wrong, but let's just initialize it.
2014-07-14networkd: dhcp add vendor class indentifier option 60Susant Sahani
Vendor Class Identifier be used by DHCP clients to identify their vendor type and configuration. When using this option, vendors can define their own specific identifier values, such as to convey a particular hardware or operating system configuration or other identifying information. Vendor-specified DHCP options—features that let administrators assign separate options to clients with similar configuration requirements. For example, if DHCP-aware clients for example we want to separate different gateway and option for different set of people (dev/test/hr/finance) in a org or devices for example web/database servers or let's say in a embedded device etc and require a different default gateway or DNS server than the rest of clients.
2014-07-07dhcp-network: make clear that we are ANDing Fragment offset field with maskMichal Sekletar
Reading BPF assembly written as C macros is inherently difficult. Don't make it harder than necessary and provide clearer explanation in the comment.
2014-07-07dhcp-network: ignore IP packets with More Fragments (MF) flag setMichal Sekletar
We already ignore IP fragments, because we expect that Fragment offset (FO) field is not set. However first fragment in a fragmented IP flow will have all zeroes in FO field. We should ignore such packet as well, thus we need to look at MF flag in the IP header. Checking MF flag will filter out all except last packet in fragmented flows. Last one will be ruled out by next check for value of FO.
2014-07-07dhcp-network: add check for DHCP.chaddrMichal Sekletar
Check that received DHCP packets actually include our MAC address in chaddr field. BPF interpreter has 32 bit wide registers but MAC address is 48 bits long so we have to do check in two steps.
2014-07-04networkd: don't clear dhcpv6 lease timers if there's no previous leaseSteven Noonan
If client->lease is NULL, dhcp6_lease_clear_timers will cause a segmentation fault.
2014-07-02sd-dhcp6-client: initialize variableTom Gundersen
2014-07-01sd-dhcp6-client: check return valueThomas Hindoe Paaboel Andersen
Checking the return values seems to have been forgotten in ed6ee21953dac9c78383da00bc4514ece6b75ab5
2014-07-01networkd: send hostname to dhcp serverEugene Yakubovich
Send hostname (option 12) in DISCOVER and REQUEST messages so the DHCP server could use it to register with dynamic DNS and such. To opt-out of this behaviour set SendHostname to false in [DHCP] section of .network file [tomegun: rebased, made sure a failing set_hostname is a noop and moved config from DHCPv4 to DHCP]
2014-07-01sd-dhcp6-client: fix free before useTom Gundersen
2014-06-29network-internal: initialize _cleanup_ variableTom Gundersen
2014-06-29netowrkd:deserialize_dhcp_routes verify strndup retSusant Sahani
strndup need to be chcked
2014-06-29sd-dhcp-client: don't fail hard if UDP socket can not be boundTom Gundersen
Even if we cannot renew the lease at T1, we will likely succeed at T2, so warn and ignore the failure. This could happen if for whatever reason the received address is not yet configured, or it has been lost.
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-06-29networkd/sd-dhcp-server: only start dhcp server when necessaryTom Gundersen
2014-06-26sd-dhcp6-client: Implement Rapid CommitPatrik Flykt
Add a Rapid Commit option to Solicit messages and expect a Reply to be received instead of an Advertise. When receiving a DHCPv6 message from the server in state Solicit, continue testing whether the message is a Reply. Ease up the message type checking, it's not fatal if the message is of a wrong type. Add helper functions to set/get the rapid commit of a lease. See RFC 3315, sections 17., 17.1.2., 17.1.4. and 18.1.8.
2014-06-26sd-dhcp6-client: Implement Renew and RebindPatrik Flykt
Start sending Renew and Rebind DHCPv6 messages when respective timers T1 and T2 expire. Rebind messages do not include a Server ID option and the Rebind procedure ends when the last IPv6 address valid lifetime expires, whereafter the client restarts the address acquisition procedure by Soliciting for available servers. See RFC 3315, sections 18.1.3. and 18.1.4. for details.
2014-06-26sd-dhcp6-lease: Add helper function to compute remaining expiry timePatrik Flykt
Create a helper function to compute the remaining time in seconds from time T2 to the IPv6 address with the longest lifetime. The computed time is used as the Maximum Retransmission Duration in Rebinding state. See RFC 3315, section 18.1.4. for details.
2014-06-26sd-dhcp6-client: Add Option Request Option supportPatrik Flykt
Provide a function to request more options from the DHCPv6 server. Provide a sensible default set at startup and add test basic test cases for the intended usage. Define DNS and NTP related option codes and add comments for the unassigned codes.
2014-06-26sd-icmp6-nd: Add function to stop ongoing ICMPv6 discoveryPatrik Flykt
In some use cases stopping an ongoing ICMPv6 discovery is more useful than always unreferencing the whole structure.
2014-06-26sd-dhcp6-client: return NULL from _unref() like the other sd-* librariesPatrik Flykt
In order to keep the refcounting working, a DONT_DESTROY macro similar to the one in sd-bus has been added also to DHCPv6.
2014-06-24sd-dhcp6-client: use %m instead of strerror(errno)Ronny Chevalier
2014-06-24sd-dhcp-client: return NULL from _unref() like the other sd-* librariesTom Gundersen
Let's keep this behavior consistent across our libraries. In order to keep the refcounting working, a DONT_DESTROY macro similar to the one in sd-bus was introduced.
2014-06-22dhcp-network: don't bother with IP fragmentsMichal Sekletar
2014-06-21sd-dhcp-server: change default lease time form 1m to 1hTom Gundersen
The short lease was useful for testing, but in real-world usage it is pointless to keep leases this short. That said, the cost of lease renewal is really low, so we keep the lease still relatively short at one hour to not get into hard-to-hit problems with lease exhaustion etc.
2014-06-21sd-dhcp-server: fix broadcast of DHCP packetsTom Gundersen
The destination IP address should be INADDR_BROADCAST, but was accidentally left as INADDR_ANY.
2014-06-20sd-dhcp-server: remove unused cleanup functionThomas Hindoe Paaboel Andersen
Removes _cleanup_dhcp_lease_free_. While the automatic cleanup functions are great to have this one is never used and causes a warning in clang.
2014-06-20tests: fix test-icmp6-rsRonny Chevalier
Don't close the fd given to sd-icmp6-nd, since it will be aynschonously closed by sd_icmp6_nd_unref
2014-06-20sd-icmp6-nd: fix uninitialized fdRonny Chevalier