1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00
Commit Graph

13321 Commits

Author SHA1 Message Date
Lennart Poettering
e04b0cdb90 util: port last code over to new namespace utility calls 2013-12-14 05:10:25 +01:00
Lennart Poettering
5e2b3214aa util: when joining a namespace make sure to reset all uids to 0 after
the transition
2013-12-14 05:10:25 +01:00
Lennart Poettering
bc9fd78c7b bus: when connecting to a container's kdbus instance, enter namespace first
Previously we'd open the connection in the originating namespace, which
meant most peers of the bus would not be able to make sense of the
PID/UID/... identity of us since we didn't exist in the namespace they
run in. However they require this identity for privilege decisions,
hence disallowing access to anything from the host.

Instead, when connecting to a container, create a temporary subprocess,
make it join the container's namespace and then connect from there to
the kdbus instance. This is similar to how we do it for socket
conections already.

THis also unifies the namespacing code used by machinectl and the bus
APIs.
2013-12-14 05:10:25 +01:00
Thomas Hindoe Paaboel Andersen
3fa5dd6de7 getty-generator: fix stripping /dev/ 2013-12-13 23:24:16 +01:00
Lennart Poettering
7c9a6f9063 bus: install systemd-bus-proxyd unit files for compatibility with dbus1 2013-12-13 20:49:57 +01:00
Lennart Poettering
207d1d0922 getty-generator: fix segfault when $container_ttys is not set 2013-12-13 20:40:31 +01:00
Lennart Poettering
9d3e3aa58d event: make gcc shut up 2013-12-13 17:39:52 +01:00
Lennart Poettering
49cf4ece20 journal: downgrade comments about sd_journal_print_with_location()
Effectviely these calls are ABI anyway, so downgrade the comments a bit,
since it might actually be useful for language bindings to make use of
them.
2013-12-13 17:33:20 +01:00
Lennart Poettering
58f299eef6 update TODO 2013-12-13 17:16:06 +01:00
Lennart Poettering
ffaf95cc18 man: document that systemd-getty-generator can start additional container gettys on ptys 2013-12-13 17:15:05 +01:00
Lennart Poettering
1d97ff7dd7 getty-generator: look add an environment variable $container_ttys set for PID 1 and start gettys on all ttys listed therein 2013-12-13 16:57:24 +01:00
Lennart Poettering
f4889f656b nspawn: add new --setenv= switch to set an environment variable for the container to spawn 2013-12-13 16:37:16 +01:00
Lennart Poettering
a56b63f41d man: document more error codes for sd_bus_request_name() 2013-12-13 16:01:54 +01:00
Lukasz Skalski
043ccd8383 libsystemd-bus: the same error codes for sd_bus_release_name() (for kdbus and dbus1)
Due to this patch, sd_bus_release_name() function
returns the same code errors for kdbus and dbus1
if we try release non-existing name or foreign
name.
2013-12-13 15:50:41 +01:00
Lukasz Skalski
c97a6dbcf1 build-sys: fix help text for --enable-kdbus 2013-12-13 15:50:38 +01:00
Lennart Poettering
9f97c93671 update TODO 2013-12-13 15:30:12 +01:00
Lennart Poettering
6d6f4904aa bus: when a connection terminated use ECONNRESET as error 2013-12-13 15:30:12 +01:00
Lennart Poettering
1e05d493b7 bus: rework how we attach fds to event loops
When trying a couple of addresses one after the other, make sure to
reattach the fds to the event loop.
2013-12-13 15:30:12 +01:00
Lennart Poettering
30caf8f3af event: add ability to change fd of an active event source 2013-12-13 15:30:12 +01:00
Lennart Poettering
8f726607ec event: allow to query userdata and watchdog state 2013-12-13 15:30:12 +01:00
Zbigniew Jędrzejewski-Szmek
f9f4dd51bd man: add another nspawn example
Taken from https://bugs.freedesktop.org/show_bug.cgi?id=68369.
2013-12-12 23:19:45 -05:00
Lennart Poettering
12179984a3 event: when unreffing an event source from its own handler, detach fd from epoll
The pattern of unreffing an IO event source and then closing its fd is
frequently seen in even source callbacks. Previously this likely
resultet in us removing the fd from the epoll after it was closed which
is problematic, since while we were dispatching we always kept an extra
reference to event source objects because we might still need it later.
2013-12-13 04:06:43 +01:00
Lennart Poettering
7b77ed8cf3 event: be more conservative when returning errors from event handler callbacks
We really should return errors from event handlers if we have a
continous problem and don't know any other solution.
2013-12-13 04:06:43 +01:00
Lennart Poettering
c5ef10429a git: update .gitignore 2013-12-13 04:06:43 +01:00
Lennart Poettering
6b46ea73e3 namespace: include boot id in private tmp directories
This way it is easy to only exclude directories from the current boot
from automatic clean up in /var/tmp.

Also, pick a longer name for the directories so that are globs in
tmp.conf can be simpler yet equally accurate.
2013-12-13 04:06:43 +01:00
Lennart Poettering
6203e07a83 event: rework sd-event exit logic
With this change a failing event source handler will not cause the
entire event loop to fail. Instead, we just disable the specific event
source, log a message at debug level and go on.

This also introduces a new concept of "exit code" which can be stored in
the event loop and is returned by sd_event_loop(). We also rename "quit"
to "exit" everywhere else.

Altogether this should make things more robus and keep errors local
while still providing a way to return event loop errors in a clear way.
2013-12-13 04:06:43 +01:00
Lennart Poettering
6e41a3e53d bus: fix make check 2013-12-13 04:06:43 +01:00
Lennart Poettering
33cb6e7934 bus: properly parse NameOwnerChanged messages when caller explicitly wants to match against names coming/going 2013-12-13 04:06:43 +01:00
Lennart Poettering
b408e2a8be man: update sd_bus_request_name() man page 2013-12-13 04:06:43 +01:00
Lennart Poettering
11846aa746 bus: make sure exit-on-idle logic works on kdbus systems that do not generate NameLost 2013-12-13 04:06:43 +01:00
Lennart Poettering
2c8d477a01 bus: fix parsing of matches against empty strings 2013-12-13 04:06:43 +01:00
Thomas Hindoe Paaboel Andersen
5fba7bbfa4 scan-build: silence some warnings
test-fileio/test-strv:
Use the streq_ptr to make build-scan not worry about passing in a null
to a nonnull function.

test-dhcp-option:
Prevent a theoretical null pointer dereference
2013-12-12 23:08:47 +01:00
Lennart Poettering
e4bb80a076 bus: fix rewind logic 2013-12-12 20:49:32 +01:00
Lennart Poettering
c4ef331782 service: process watchdog timeouts with lowest priority 2013-12-12 20:49:32 +01:00
Kay Sievers
5bb658a178 bus: remove explicit activator-specific flags, the kdbus supports it now 2013-12-12 20:27:23 +01:00
Kay Sievers
07442efff8 bus: update kdbus.h 2013-12-12 20:19:12 +01:00
Lennart Poettering
3df7a7e610 bus: always pass valid timeout to kdbus 2013-12-12 20:00:45 +01:00
Lennart Poettering
0f437184b6 bus: enforce endianess and marshalling for messages we send 2013-12-12 20:00:45 +01:00
Shawn Landden
9ff09bcb86 timedatectl: work with old timedated
Which does have TimeUSec. Should we specifically check for this method
instead of assuming time=0 means it doesn't exist?

Before:
shawn@debian-T61:~/git/systemd$ ./timedatectl
      Local time: Wed 1969-12-31 16:00:00 PST
  Universal time: Thu 1970-01-01 00:00:00 UTC
        RTC time: n/a
        Timezone: America/Los_Angeles (PST, -0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 1969-10-26 01:59:59 PDT
                  Sun 1969-10-26 01:00:00 PST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 1970-04-26 01:59:59 PST
                  Sun 1970-04-26 03:00:00 PDT

After:
shawn@debian-T61:~/git/systemd$ ./timedatectl
      Local time: Wed 2013-12-11 14:03:21 PST
  Universal time: Wed 2013-12-11 22:03:21 UTC
        RTC time: n/a
        Timezone: America/Los_Angeles (PST, -0800)
     NTP enabled: n/a
NTP synchronized: no
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2013-11-03 01:59:59 PDT
                  Sun 2013-11-03 01:00:00 PST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2014-03-09 01:59:59 PST
                  Sun 2014-03-09 03:00:00 PDT
2013-12-12 20:00:45 +01:00
Zbigniew Jędrzejewski-Szmek
189b2384d6 build-sys: use internal library for dhcp client tests
Also clean up AM_CFLAGS in a few places.
2013-12-12 11:43:34 -05:00
Patrik Flykt
d2fe46b514 dhcp: Add function to free DHCP client data 2013-12-12 11:43:34 -05:00
Patrik Flykt
751246ee37 dhcp: Add notification callback
Define a notification callback and events for stopping and client
lease expiry. Add functions to fetch IP parameters from a lease.
2013-12-12 11:43:34 -05:00
Patrik Flykt
51debc1e39 dhcp: Compute expire, T1 and T2 timers
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-12 11:43:34 -05:00
Patrik Flykt
3e3d8f7857 dhcp: Process DHCP Ack/Nak message
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-12 11:43:34 -05:00
Patrik Flykt
564ba3b0ef dhcp: Add maximum message size option
Add maximum message size option to keep some DHCP server implementations
from sending too big messages. See ConnMan commit
0c5c862749c05193cf4c513628328c6db02b5222.
2013-12-12 11:43:34 -05:00
Patrik Flykt
e2dfc79f06 dhcp: Send DHCP Request to acquire an IP address
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-12 11:43:34 -05:00
Patrik Flykt
8c00042c93 dhcp: Handle received DHCP Offer message
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-12 11:43:34 -05:00
Patrik Flykt
d3d8ac2f2b dhcp: Add timeout and main loop support
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-12 11:43:34 -05:00
Patrik Flykt
117539f8b7 build: Add dependency on libsystemd-bus needed for main loop 2013-12-12 11:43:34 -05:00
Patrik Flykt
bbdf06d9f2 dhcp: Add function to stop the DHCP client
The client is stopped and brought back to its initial state.
2013-12-12 11:43:34 -05:00