1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00
Commit Graph

15515 Commits

Author SHA1 Message Date
Tom Gundersen
6f08fb7b34 sd-dhcp-server: test - skip when lacking perms 2014-06-13 19:11:31 +02:00
Andreas Henriksson
223217749e install: fix invalid free() in unit_file_mask()
int unit_file_mask(...) in ./src/shared/install.c calls
get_config_path(...) which can in 4 error cases return without setting
"ret", and thus "prefix" can be uninitialized when unit_file_mask(...)
finishes (which it does directly after the error is returned from
get_config_path(...)).
2014-06-13 19:01:07 +02:00
Andreas Henriksson
f8a0bb5285 udev: fix invalid free() in enable_name_policy()
static bool enable_name_policy(...) in ./src/udev/net/link-config.c
calls proc_cmdline(...) to get "line" initialized, but
proc_cmdline(...) does not guarantee that atleast when both
conditions (detect_container(NULL) > 0) and
read_full_file(...) returned < 0.
2014-06-13 19:00:42 +02:00
Andreas Henriksson
3e09eb5c83 core: fix invalid free() in killall()
static int killall(....) in ./src/core/killall.c tries to get "s"
initialized by calling get_process_comm(...) which calls
read_one_line_file(...) which if it fails will mean it is left
uninitialized.
It is then used in argument to strna(s) call where it is
dereferenced(!), in addition to nothing else initializing it before
the scope it is in finishes.
2014-06-13 19:00:13 +02:00
Andreas Henriksson
8186d9dda0 sd-dhcp-client: fix invalid free() in client_send_request()
static int client_send_request(...) in
./src/libsystemd-network/sd-dhcp-client.c tries to initialize
"request" by calling client_message_init(...), which has atleast
5 error cases where it can return without that happening.
This leads to the function finishing without "request" being initialized.
2014-06-13 18:57:33 +02:00
Tom Gundersen
97578344f3 networkd: link - left-align debug messages
Still add some whitespace betwen ifname and the message to get the
messages aligned (as I find it easier to spot specific messages this way).
2014-06-13 18:34:34 +02:00
Tom Gundersen
dd43110f78 networkd: add dhcp server support
When enabled in [Network] it will set up a dhcp server on the interface, listening
on one of its statically configured IPv4 addresses and with a fixed size pool of
leases determined from it.

Example:

[Match]
Name=ve-arch-tree

[Network]
Address=192.168.12.5/24
DHCPServer=yes

[Route]
Gateway=192.168.12.5
Destination=192.168.12.0/24

In this case we will configure ve-arch-tree with the address 192.168.12.5 and
hand out addresses in the range 192.168.12.6 - 192.168.12.38.

In the future, we should (as suggested by Lennart) introduce a syntax to pick the
server address automatically.
2014-06-13 17:07:20 +02:00
Tom Gundersen
500792d818 sd-dhcp-server: add RELEASE support 2014-06-13 17:07:20 +02:00
Tom Gundersen
5b34277c20 sd-dhcp-server: add dummy DECLINE support 2014-06-13 17:07:20 +02:00
Tom Gundersen
87322b3aee sd-dhcp-server: track bound leases
Make sure we don't hand out the same IP twice. We still don't
handle lease expiry.
2014-06-13 17:07:19 +02:00
Tom Gundersen
c7d9ffe6d6 sd-dhcp-server: add support for clients requesting lease lifetime 2014-06-13 17:07:19 +02:00
Tom Gundersen
bd57b45029 sd-dhcp-server: add basic NAK support 2014-06-13 17:07:19 +02:00
Tom Gundersen
2dead8129f sd-dhcp-server: add basic REQUEST/ACK support 2014-06-13 17:07:19 +02:00
Tom Gundersen
4dc3556804 sd-dhcp-server: add basic DISCOVER/OFFER support 2014-06-13 17:07:19 +02:00
Tom Gundersen
969b009d94 sd-dhcp-server: add support for sending messages 2014-06-13 17:07:19 +02:00
Tom Gundersen
20af7091de sd-dhcp-server: add support for setting the server address 2014-06-13 17:07:19 +02:00
Tom Gundersen
8de4a226c7 sd-dhcp-server: bind to raw socket for sending
We would like to use the UDP socket, but we cannot as we need to specify
the MAC address manually.
2014-06-13 16:53:13 +02:00
Tom Gundersen
816e2e7af9 sd-dhcp-server: add basic message parsing
Parse the maximum message size the client can accept and the client id, falling back to
sane defaults if they are not set.
2014-06-13 16:53:13 +02:00
Tom Gundersen
be077570f7 sd-dhcp-server: add basic message handling and verification 2014-06-13 16:53:13 +02:00
Tom Gundersen
3a864fe4a8 sd-dhcp-server: bind to a given interface
We will (at least at first), restrict our focus to running the server
on at most one interface.
2014-06-13 16:53:13 +02:00
Tom Gundersen
ff734080aa sd-dhcp-server: add basic functionality for starting/stopping server
Bind to UDP socket and listen for messages, discarding anything we receive.
2014-06-13 16:53:13 +02:00
Tom Gundersen
b44cd88210 sd-dhcp-server: add basic functionality for creating/destroying server instance 2014-06-13 16:53:13 +02:00
Tom Gundersen
fef0e0f3b2 dhcp-network: allow UDP socket to listen on any address
For this to work nicely we need to use REUSEADDR so that more than one socket
can be open at the same time. Also, we request the ifindex to be appended
to incoming messages, so we know whence it came.
2014-06-13 16:53:13 +02:00
Lennart Poettering
55745f2054 tmpfiles: add minimal tmpfiles snippet to rebuild the most essential stuff from /etc 2014-06-13 13:29:25 +02:00
Lennart Poettering
ecde7065f7 units: rebuild /etc/passwd, the udev hwdb and the journal catalog files on boot
Only when necessary of course, nicely guarded with the new
ConditionNeedsUpdate= condition we added.
2014-06-13 13:26:32 +02:00
Lennart Poettering
a55654d598 core: add new ConditionNeedsUpdate= unit condition
This new condition allows checking whether /etc or /var are out-of-date
relative to /usr. This is the counterpart for the update flag managed by
systemd-update-done.service. Services that want to be started once after
/usr got updated should use:

        [Unit]
        ConditionNeedsUpdate=/etc
        Before=systemd-update-done.service

This makes sure that they are only run if /etc is out-of-date relative
to /usr. And that it will be executed after systemd-update-done.service
which is responsible for marking /etc up-to-date relative to the current
/usr.

ConditionNeedsUpdate= will also checks whether /etc is actually
writable, and not trigger if it isn't, since no update is possible then.
2014-06-13 13:26:32 +02:00
Lennart Poettering
8ea48dfcd3 update-done: add minimal tool to manage system updates for /etc and /var, if /usr has changed
In order to support offline updates to /usr, we need to be able to run
certain tasks on next boot-up to bring /etc and /var in line with the
updated /usr. Hence, let's devise a mechanism how we can detect whether
/etc or /var are not up-to-date with /usr anymore: we keep "touch
files" in /etc/.updated and /var/.updated that are mtime-compared with
/usr. This means:

Whenever the vendor OS tree in /usr is updated, and any services that
shall be executed at next boot shall be triggered, it is sufficient to
update the mtime of /usr itself. At next boot, if /etc/.updated and/or
/var/.updated is older than than /usr (or missing), we know we have to
run the update tools once. After that is completed we need to update the
mtime of these files to the one of /usr, to keep track that we made the
necessary updates, and won't repeat them on next reboot.

A subsequent commit adds a new ConditionNeedsUpdate= condition that
allows checking on boot whether /etc or /var are outdated and need
updating.

This is an early step to allow booting up with an empty /etc, with
automatic rebuilding of the necessary cache files or user databases
therein, as well as supporting later updates of /usr that then propagate
to /etc and /var again.
2014-06-13 13:26:32 +02:00
Lennart Poettering
dc92e62c6c condition: minor modernizations 2014-06-13 13:26:32 +02:00
Lennart Poettering
d4c049bfcd units: don't conditionalize sysctl service
We install two sysctl snippets ourselves, hence the condition will
always trigger, so no point in tryng to optimize things with this, it
just will make things slower, if anything.
2014-06-13 13:26:32 +02:00
Lennart Poettering
db62b5b37e units: remove conditions from systemd-tmpfiles-setup
There's no point in conditionalizing systemd-tmpfiles at boot, since we
ship tmpfiles snippets ourselves, hence they will always trigger anyway.

Also, there's no reason to pull in local-fs.target from the service,
hence drop that.
2014-06-13 13:26:32 +02:00
Lennart Poettering
9194c8e4c3 system-update-generator: modernizations 2014-06-13 13:26:32 +02:00
Lennart Poettering
7de77d1cf5 sysusers: hide generate .conf file 2014-06-13 13:26:32 +02:00
Lennart Poettering
dd25523073 update TODO 2014-06-13 13:26:32 +02:00
Lennart Poettering
48e93f88ff sysusers: move systemd-sysusers to libexec for now 2014-06-13 13:26:32 +02:00
Kay Sievers
6555ad8e9d tmpfiles: skip mknod() on -EPERM (device cgroup) 2014-06-13 04:12:50 +02:00
Kay Sievers
c1b6b04f0e sysusers: do not set todo to create a user when we only need a group 2014-06-13 03:28:54 +02:00
Thomas Hindoe Paaboel Andersen
f268f57f63 cryptsetup: check that password is not null
Beef up the assert to protect against passing null to strlen.

Found with scan-build.
2014-06-13 00:30:40 +02:00
Lennart Poettering
f8b5d99408 sysuser: generate default snippet incorporating TTY_GID properly
When the user specifies --with-tty-gid= then we should honour that and
write it to the snippet, too.
2014-06-12 23:22:27 +02:00
Lennart Poettering
7ec9fb4be9 sysusers: add new input group to default snippet 2014-06-12 23:08:51 +02:00
Lennart Poettering
753615e85d tmpfiles: minor modernizations 2014-06-12 23:07:34 +02:00
Lennart Poettering
034753ac13 machine: minor modernizations 2014-06-12 23:07:33 +02:00
Lennart Poettering
1b99214789 sysusers: add minimal tool to reconstruct /etc/passwd and /etc/group from static files
systemd-sysusers is a tool to reconstruct /etc/passwd and /etc/group
from static definition files that take a lot of inspiration from
tmpfiles snippets. These snippets should carry information about system
users only. To make sure it is not misused for normal users these
snippets only allow configuring UID and gecos field for each user, but
do not allow configuration of the home directory or shell, which is
necessary for real login users.

The purpose of this tool is to enable state-less systems that can
populate /etc with the minimal files necessary, solely from static data
in /usr. systemd-sysuser is additive only, and will never override
existing users.

This tool will create these files directly, and not via some user
database abtsraction layer. This is appropriate as this tool is supposed
to run really early at boot, and is only useful for creating system
users, and system users cannot be stored in remote databases anyway.

The tool is also useful to be invoked from RPM scriptlets, instead of
useradd. This allows moving from imperative user descriptions in RPM to
declarative descriptions.

The UID/GID for a user/group to be created can either be chosen dynamic,
or fixed, or be read from the owner of a file in the file system, in
order to support reconstructing the correct IDs for files that shall be
owned by them.

This also adds a minimal user definition file, that should be
sufficient for most basic systems. Distributions are expected to patch
these files and augment the contents, for example with fixed UIDs for
the users where that's necessary.
2014-06-12 23:07:33 +02:00
Kay Sievers
0138a2dcc5 debug-shell: add condition for tty device to run on 2014-06-12 22:26:43 +02:00
Kay Sievers
3dff3e00e0 udev: assign group "input" to all input devices 2014-06-12 14:59:53 +02:00
Mantas Mikulėnas
c54bed5d51 NEWS: fix directory name 2014-06-11 19:12:11 +02:00
Lennart Poettering
4c0d13bdd5 NEWS: add missing comment about the "floppy" group 2014-06-11 18:42:38 +02:00
Lennart Poettering
cd14eda321 NEWS: mention that resolved's resolv.conf fragment moved 2014-06-11 15:32:20 +02:00
Lennart Poettering
42a04ee69c build-sys: update library versions 2014-06-11 15:30:28 +02:00
Lennart Poettering
dc1d6c02fc NEWS: add contributor list for 214 2014-06-11 15:04:59 +02:00
Lennart Poettering
58e027023b units: order network-online.target after network.target
There might be implementations around where the network-online logic
might not talk to any network configuration service (and thus not have
to wait for it), hence let's explicitly order network-online.target
after network.target to avoid any ambiguities.
2014-06-11 15:00:45 +02:00