summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-12-12dhcp: Compute expire, T1 and T2 timersPatrik Flykt
Compute the default T1 and T2 timer values if they were not set by the DHCP server. Verify that the values are reasonable.
2013-12-12dhcp: Process DHCP Ack/Nak messagePatrik Flykt
Process a DHCP Ack/Nak in much the same way as an DHCP Offer. Factor out header verification and process options sent. Add notification functionality with discrete values for the outcome of the DHCP Ack/ Nak processing.
2013-12-12dhcp: Add maximum message size optionPatrik Flykt
Add maximum message size option to keep some DHCP server implementations from sending too big messages. See ConnMan commit 0c5c862749c05193cf4c513628328c6db02b5222.
2013-12-12dhcp: Send DHCP Request to acquire an IP addressPatrik Flykt
Create and send a DHCP Request message reusing already existing parts of the code. This causes factoring out IP and UDP header creation and moving next timeout calculation to be done every time in the timer callback function independent of DHCP state. Also add an exponential part to the timer calculation, bail out if there are errors while resending the DHCP message for the sixth or more times.
2013-12-12dhcp: Handle received DHCP Offer messagePatrik Flykt
Create a function for handling the full IP, UDP and DHCP packet and tie it to the main loop. Verify IP and UDP headers and checksum. Creat a new lease structure with using the values supplied in the DHCP message. Free the lease structure when client is stopped. Split out socket handling into a creation and a sending part. As a result modify the test code.
2013-12-12dhcp: Add timeout and main loop supportPatrik Flykt
Require a main loop to be set when creating a DHCP client. Set up a timer to resend DHCP Discover messages and add a 0-2 second delay to the timeout value. Move to state Selecting after successful sending of a Discover message.
2013-12-12dhcp: Add function to stop the DHCP clientPatrik Flykt
The client is stopped and brought back to its initial state.
2013-12-12dhcp: Support seconds elapsed since start of DHCP negotiationPatrik Flykt
It was noticed by Grant Erickson in ConnMan commit 95e15c09350acf58d4707056ae2614570883ef66 that: "Certain DHCP servers, such as that implemented in Mac OS X (< 10.7) for its "Internet Sharing" feature, refuse to issue a DHCP lease to clients that have not set a non-zero value in their DISCOVER or REQUEST packets."
2013-12-12dhcp: Add test for discover DHCP packet creationPatrik Flykt
Set a fake MAC address and emulate raw packet sending. When the buffer containing the Discover message is received, check selected IP and UDP headers and compute IP header and UDP message checksums. Also send the DHCP message for option parsing and expect a successful outcome.
2013-12-12dhcp: Add DHCP discover sendingPatrik Flykt
On starting the client, use the supplied interface mac address and create a transaction id. Puzzle together an IP/UDP/DHCP Discover message, compute checksums and send it out as a raw packet. Create an additional function that constructs default options common to all DHCP messages. Set the DHCP Client ID option as noticed by Grant Erickson in ConnMan commit b18d9798b3a0ae46ed87d6d2be8d5a474bf3ab1e: "Some Internet gateways and Wi-Fi access points are unhappy when the DHCPv4 client-id option (61) is missing and will refuse to issue a DHCP lease."
2013-12-12dhcp: Add function for sending a raw packetPatrik Flykt
Open a packet socket, create a link level header, send packet and close socket. Adding it to a separate file makes testing of the DHCP sending much easier, as the test program can supply any socket to the DHCP client code.
2013-12-12shared: Add struct sockaddr_ll to sockaddr_unionPatrik Flykt
2013-12-12dhcp: Add test function for computing checksumPatrik Flykt
2013-12-12dhcp: Add option append testsPatrik Flykt
Add checks for invalid lengths and parameters when using the option appending function. Add also checks for adding options, see to it that the resulting array is identical to the array of options added.
2013-12-12dhcp: Add tests for DHCP options, file and sname fieldsPatrik Flykt
Add a structure describing the DHCP file, sname and trailing options fields. Create a messge holding these fields and call the internal option parsing function. In the test callback function verify that only regular options are passed and figure out which part of the DHCP message is the one that is being processed. As the test program knows the full contents of the test options in the test structure, skip all non-regular fields and verify that the option provided to the callback indeed is the one expected. Check also if non-regular option fields are to be ignored in the end of the option field as the callback is not called again and the final check when the whole message has been processed needs to be successful. Add a boolean flag for pretty-printing, anticipate there will be a nice option to toggle it in the future.
2013-12-12dhcp: Add buffer length and invalid cookie tests for DHCP optionsPatrik Flykt
Create an initial simple test program for these two cases.
2013-12-12dhcp: Add option appending and parsingPatrik Flykt
Add functions to append and parse DHCP options. Not all options are passed to the callback function, the ones not exposed are pad, end, message type and overload. If indicated by the overload option, file and sname fields will be examined for more options. The option functions are internal to DHCP, add a new header files for interal function prototypes.
2013-12-12build: Add initial build supportPatrik Flykt
The client test program is the only one to be built so far.
2013-12-12dhcp: Add test for DHCP client initialization and parameter settingPatrik Flykt
2013-12-12dhcp: Add DHCP client initializationPatrik Flykt
Provide functionality for initializing a DHCP client struct, setting interface index, last used address and additional options to request. On initialization the most useful options are added by default.
2013-12-12dhcp: Add DHCP protocol structures and initial definesPatrik Flykt
Create a new directory to host DHCP components.
2013-12-12log: protect errno when we use assert_return()Lennart Poettering
2013-12-12core: suppress gcc warnings on selinux-less systemsLennart Poettering
2013-12-12shared: add missing includeMarc-Antoine Perennou
Needed for socketpair, recv
2013-12-12bus: add SD_BUS_NAME_REPLACE_EXISTING to all activatable services, fix one ↵Kay Sievers
flags conversion
2013-12-12bus: instead of exposing the dbus1 flags when acquiring a name use our own ↵Lennart Poettering
that are closer to kdbus This turns around DO_NOT_QUEUE into QUEUE which implies a more useful default. (And negative options are awful anyway.)
2013-12-12bus: properly return an error when we detect a method call timeoutLennart Poettering
2013-12-12core: fix bus registration on daemon reexecLennart Poettering
2013-12-11nspawn: complain and continue if machine has same idZbigniew Jędrzejewski-Szmek
If --link-journal=host or --link-journal=guest is used, this totally cannot work and we exit with an error. If however --link-journal=auto or --link-journal=no is used, just display a warning. Having the same machine id can happen if booting from the same filesystem as the host. Since other things mostly function correctly, let's allow that. https://bugs.freedesktop.org/show_bug.cgi?id=68369
2013-12-11Do not log all assert_return failuresZbigniew Jędrzejewski-Szmek
% build/journalctl help Assertion 'match_is_valid(data, size)' failed at ../src/journal/sd-journal.c:227, function sd_journal_add_match(). Ignoring. Callers cannot be expect to check all arguments always.
2013-12-11journal: pipe journalctl help output into a pagerDjalal Harouni
journalctl help output might run off the screen, so be consistent as other systemd tools do and pipe it into a pager.
2013-12-12service: actually leave watchdog enabled in the states where it mattersLennart Poettering
2013-12-12timedated: make sure GetAll() succeeds in systems lacking /dev/rtc (such as ↵Lennart Poettering
containers)
2013-12-12test-fileio: replace mktemp with mkstemp to avoid warningsThomas Hindoe Paaboel Andersen
This is a fairly useless thing to do but it makes the compilers and analyzers shut up about the use of mktemp.
2013-12-12bus: properly generate NameOwnerChanged messages when we take from/give back ↵Lennart Poettering
to queue/starter
2013-12-12bus: fix order in which we check credsLennart Poettering
2013-12-12bus: update name listing logic to current kernel interfaceLennart Poettering
2013-12-12bus: when checking whether a creds object contains some field, don't use ↵Lennart Poettering
assert_return() These are not programming errors, so they shouldn't use assert_return()
2013-12-12bus: connect directly via kdbus in sd_bus_open_system_container()Lennart Poettering
kdbus fortunately exposes the container's busses in the host fs, hence we can access it directly instead of doing the namespacing dance.
2013-12-11sd-event: try to move each wakeup to the same spot within every 10sLennart Poettering
In addition to the same spot within every 1min, every 1s, every 250s
2013-12-11journald: make sure the stdout/stderr stream fd is removed from epoll before ↵Lennart Poettering
we close it
2013-12-11journald: cache cgroup root path, instead of querying it on every incoming ↵Lennart Poettering
log message
2013-12-11journal: when listing logs of a container make sure we don't accidentally ↵Lennart Poettering
show messages from host too
2013-12-11journald: cache hostname, boot_id and machine_id fields instead of ↵Lennart Poettering
generating them fresh for each log entry
2013-12-11journal: don't go belly up when an stdout/stderr client terminates the ↵Lennart Poettering
connection
2013-12-11journal: add ability to browse journals of running OS containersLennart Poettering
This adds the new library call sd_journal_open_container() and a new "-M" switch to journalctl. Particular care is taken that journalctl's "-b" switch resolves to the current boot ID of the container, not the host.
2013-12-11service: clean up watchdog logic a bitLennart Poettering
2013-12-11journald: port to sd-event and enable watchdog supportLennart Poettering
2013-12-11event: hook up sd-event with the service watchdog logicLennart Poettering
Adds a new call sd_event_set_watchdog() that can be used to hook up the event loop with the watchdog supervision logic of systemd. If enabled and $WATCHDOG_USEC is set the event loop will ping the invoking systemd daemon right after coming back from epoll_wait() but not more often than $WATCHDOG_USEC/4. The epoll_wait() will sleep no longer than $WATCHDOG_USEC/4*3, to make sure the service manager is called in time. This means that setting WatchdogSec= in a .service file and calling sd_event_set_watchdog() in your daemon is enough to hook it up with the watchdog logic.
2013-12-11event: when handling SIGCHLD of a child process only reap after dispatching ↵Lennart Poettering
event source That way the even source callback is run with the zombie process still around so that it can access /proc/$PID/ and similar, and so that it can be sure that the PID has not been reused yet.