summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
AgeCommit message (Collapse)Author
2014-11-03sd-pppoe: include ppp_defs.hLukas Nykryn
On older kernels before this patch: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=e8b671460410c8fd996c8a1c228b718c547cc236 ppp-ioctl.h did not pull in ppp_defs.h which results in build errors
2014-11-01sd-pppoe: fix some leaksTom Gundersen
2014-11-01libsystemd-networkd: introduce sd-pppoe libraryTom Gundersen
This library negotiates a PPPoE channel. It handles the discovery stage and leaves the session stage to the kernel. A further PPP library is needed to actually set up a PPP unit (negotatie LCP, IPCP and do authentication), so in isolation this is not yet very useful. The test program has two modes: # ./test-pppoe will create a veth tunnel in a new network namespace, start pppoe-server on one end and this client library on the other. The pppd server will time out as no LCP is performed, and the client will then shut down gracefully. # ./test-pppoe eth0 will run the client on eth0 (or any other netdev), and requires a PPPoE server to be reachable on the local link.
2014-11-01sd-dhcp6-client: fix off-by-two error in DUID lengthDan Williams
The duid data passed by the caller does not include the DUID type, but sd_dhcp6_client_set_duid() was treating it like it did.
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-11-01dhcp6: use unaligned read/write helpersTom Gundersen
2014-10-31sd-dhcp-client: clean up raw socket sd_event_source when creating new UDP socketDan Williams
The raw socket sd_event_source used for DHCP server solicitations was simply dropped on the floor when creating the new UDP socket after a lease has been acquired. Clean it up properly so we're not still listening and responding to events on it.
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-10-13test-dhcp-client: add more assertsTom Gundersen
2014-10-11sd-dhcp-client: support non-Ethernet hardware addressesDan Williams
Like Infiniband. See RFC 4390 section 2.1 for details on DHCP and Infiniband; chaddr is zeroed, hlen is set to 0, and htype is set to ARPHRD_INFINIBAND because IB hardware addresses are 20 bytes in length.
2014-10-09sd-dhcp6-lease: Name the structure containing IAADDR dataPatrik Flykt
With this change the DHCP6_OPTION_IAADDR_LEN define can be removed in favor of using sizeof(). Using the name of the struct and sizeof() makes it clearer how much and what data is being copied from the DHCPv6 message.
2014-10-02sd-dhcp6: do basic sanity-checking of supplied DUIDTom Gundersen
2014-10-02sd-dhcp6: specify the type explicitly when setting custom DUIDTom Gundersen
This would make it simple to verify that the data is on the right format when the type is known.
2014-10-02sd-dhcp6: support custom DUID's up to the size specified in the RFCTom Gundersen
2014-10-02sd-dhcp6-client: support custom DUIDsDan Williams
The caller may have an existing DUID that it wants to use, and may want to use some other DUID generation scheme than systemd's default DUID-EN. [tomegun: whitespace - we never use tabs]
2014-09-17libsystemd-network: dhcp-test - assert that malloc0 succeedsTom Gundersen
Otherwise we would get a nullptr dereference later on. Found by coverity. Fixes CID #1237655.
2014-09-16libsystemd-network: avoid double-free in error caseAndreas Henriksson
Don't manually free 'n' in error path as it's already tagged _cleanup_free_ and will be freed once it goes out of scope, leading to double-free in this case. Found with coverity. Fixes: CID#1237786
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-09-14sd-dhcp: fix test of magic cookieThomas Hindoe Paaboel Andersen
The magic cookie is set in dhcp_message_init. Test the magic cookie value intead of writing the last 3/4 of it directly. Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735
2014-09-10test-dhcp6-client: Add checks for Elapsed Time optionPatrik Flykt
Verify that the Elapsed Time option is present.
2014-09-10sd-dhcp6-client: Implement Elapsed Time optionPatrik Flykt
Implement Elapsed Time option as it is defined as MUST in RFC 3315, section 22.9. The elapsed time value is a 1/100th of a second with a max value of 0xffff, i.e. 655.35 seconds. As the main loop might not be running yet when sd_dhcp6_client_start() is called, fetch the monotonic time directly and not from the event loop while in state DHCP6_STATE_STOPPED.
2014-08-30sd-dhcp6-client: properly calculate buffer size when parsing optionsZbigniew Jędrzejewski-Szmek
Also make pointer calculations more explicit so they are easier to understand.
2014-08-30test-dhcp6-client: Fix option lengthPatrik Flykt
The whole DHCPv6 test message length was incorrectly used as the length of DHCPv6 options causing the following bad memory access: $ build/test-dhcp6-client Assertion 'interface_index >= -1' failed at ../src/libsystemd-network/sd-dhcp6-client.c:129, function sd_dhcp6_client_set_index(). Ignoring. ================================================================= ==29135==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fe204aa9148 at pc 0x7fe204a5958f bp 0x7fff3e47d470 sp 0x7fff3e47d460 READ of size 1 at 0x7fe204aa9148 thread T0 #0 0x7fe204a5958e in option_parse_hdr ../src/libsystemd-network/dhcp6-option.c:145 #1 0x7fe204a59884 in dhcp6_option_parse ../src/libsystemd-network/dhcp6-option.c:165 #2 0x7fe204a4eb9c in test_advertise_option ../src/libsystemd-network/test-dhcp6-client.c:227 #3 0x7fe204a51c58 in main ../src/libsystemd-network/test-dhcp6-client.c:584 #4 0x7fe2031590df in __libc_start_main (/lib64/libc.so.6+0x200df) #5 0x7fe204a4cc5b (/home/test/systemd/build/test-dhcp6-client+0x25c5b) 0x7fe204aa9148 is located 2 bytes to the right of global variable 'msg_advertise' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9080) of size 198 0x7fe204aa9148 is located 56 bytes to the left of global variable 'msg_reply' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9180) of size 173 SUMMARY: AddressSanitizer: global-buffer-overflow ../src/libsystemd-network/dhcp6-option.c:145 option_parse_hdr
2014-08-30sd-ipv4ll: name the correct sourceTom Gundersen
2014-08-30Fix a few more typosRuben Kerkhof
2014-08-29Fix a few typos in log messagesRuben Kerkhof
2014-08-28sd-event: name event sources used in librariesTom Gundersen
This should help in debugging failing event sources.
2014-08-20indentation/spurious whitespace fixesLennart Poettering
2014-08-15util: never use ether_ntoa(), since it formats with %x, not %02x, which ↵Lennart Poettering
makes ethernet addresses look funny
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-08-14test: dhcp-server - fix testTom Gundersen
Reported by Corey Hammerton on G+
2014-08-14sd-dhcp-server: linebreaksTom Gundersen
Don't overflow unnecessarily.
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.