Commit Graph

39875 Commits

Author SHA1 Message Date
Lennart Poettering 3ff7a50d66 man: document the two new journalctl commands 2019-05-09 14:26:42 -04:00
Lennart Poettering 1e187d2dd5 units: automatically revert to /run logging on shutdown if necessary
Fixes: #867
2019-05-09 14:26:42 -04:00
Lennart Poettering c0dfcb318c journalctl: add new --relinquish and --smart-relinquish options
The latter is identical to the former, but becomes a NOP if
/var/log/journal is on the same mount as /, and thus during shutdown
unmounting /var is not necessary and hence we can keep logging until the
very end.
2019-05-09 14:26:42 -04:00
Lennart Poettering b4e26d1d8e journald: add API to move logging from /var to /run again
We now have this nice little Varlink API, let's beef it up a bit.
2019-05-09 14:26:42 -04:00
Lennart Poettering 4f413af2a0 journalctl: port --flush/--sync/--rotate to use varlink method calls 2019-05-09 14:26:40 -04:00
Lennart Poettering 1ec23479e1 journald: also offer flush/rotate/sync as varlink method calls
This makes the operations previously available via asynchronous signals
also available as regular varlink method calls, i.e. with sane
completion.
2019-05-09 14:14:20 -04:00
Lennart Poettering d768467563 fuzzer: add varlink fuzzer 2019-05-09 14:14:20 -04:00
Lennart Poettering 635d059fa5 tests: add varlink test 2019-05-09 14:14:20 -04:00
Lennart Poettering d41bd96f54 shared: add minimal varlink implementation
This adds a minimal Varlink (https://varlink.org/) implementation to our
tree. Given that we already have a JSON logic it's an easy thing to add.

Why bother?

We currently have major problems with IPC before dbus-daemon is up, and
in all components that dbus-daemon itself makes use of (such as various
NSS modules to resolve users as well as the journal which dbus-daemon
logs to). Because of that we so far ended up creating various (usually
crappy) work-arounds either coming up with secondary IPC systems or
sharing data statelessly in /run or similar. Let's clean this up, and
instead use a clean, well-defined, broker-less IPC for cases like that.

This is a minimal implementation of Varlink, i.e. the most basic logic
only. Stuff that's missing is left out on purpose: there's no
introspection/validation and there's no name service. It might make
sense to add that later, but for now let's only do the minimum buy-in we
can get away with. In particular as I'd assume that at least initially
we only use this IPC for our internal communication avoiding
introspection and the name service should be fine.

Specifically, I'd expect that we add IPC interfaces to the following
concepts with this scheme:

1. nss-resolve (so that hostname lookups with resolved work before
   resolved is up)
2. journald (so that IPC calls to journald don't have to go through
   dbus-daemon thus creating a cyclic dependency between journald and
   dbus-daemon)
3. nss-systemd (so that dynamic user lookups via PID 1 work sanely even
   inside of dbus-daemon, because otherwise we'd want to use dbus to run
   dbus which causes deadlocks)
4. networkd (to make sure one can talk to it in the initrd already,
   long before dbus is around)

And there might be other cases similar to this.
2019-05-09 14:14:20 -04:00
Yu Watanabe da35a1c9fc
Merge pull request #12513 from ssahani/vxlan
networkd: Allow users to set the IPv4 DF bit in outgoing packets
2019-05-09 11:26:43 +02:00
Susant Sahani 1189c00a3c networkd: VXLAN add support to configure IP Don't fragment.
Allow users to set the IPv4 DF bit in outgoing packets, or to inherit its
value from the IPv4 inner header. If the encapsulated protocol is IPv6 and
DF is configured to be inherited, always set it.
2019-05-09 06:40:33 +02:00
Susant Sahani 2a36d4006d sd-netlink: Add VXLAN netlink properties
Add IFLA_VXLAN_DF and IFLA_VXLAN_TTL_INHERIT
2019-05-09 06:40:33 +02:00
Susant Sahani 1c8b0eccc7 networkd: Assign VXLAN destination port to when GPE is set
When VXLAN destination port is unset and GPE is set
then assign 4790 to destination port. Kernel does the same as
well as iproute.

IANA VXLAN-GPE port is 4790
2019-05-09 06:40:33 +02:00
Susant Sahani 4eb086a387 networkd: fix link_up() (#12505)
Fillup IFLA_INET6_ADDR_GEN_MODE while we do link_up.

Fixes the following error:
```
dummy-test: Could not bring up interface: Invalid argument
```

After reading the kernel code when we do a link up
```
net/core/rtnetlink.c
IFLA_AF_SPEC
 af_ops->set_link_af(dev, af);
  inet6_set_link_af
   if (tb[IFLA_INET6_ADDR_GEN_MODE])
             Here it looks for IFLA_INET6_ADDR_GEN_MODE
```
Since link up we didn't filling up that it's failing.

Closes #12504.
2019-05-09 04:05:35 +02:00
Zbigniew Jędrzejewski-Szmek 180f1e3359
Merge pull request #12445 from cdown/dmm_docs
cgroup: Some memory protection fixes
2019-05-08 18:09:45 +02:00
Lennart Poettering e95be7def2
Merge pull request #12411 from keszybz/pr/12394
run: when emitting the calendarspec warning, use red
2019-05-08 10:11:32 -04:00
Lennart Poettering fd5e11f0bd
Merge pull request #12509 from poettering/table-fixlets
two trivial fixes to table formatting code
2019-05-08 10:10:55 -04:00
Evgeny Vereshchagin 7f2cdceaed util-lib: fix a typo in rdrand
Otherwise, the fuzzers will fail to compile with MSan:
```
../../src/systemd/src/basic/random-util.c:64:40: error: use of undeclared identifier 'sucess'; did you mean 'success'?
        msan_unpoison(&success, sizeof(sucess));
                                       ^~~~~~
                                       success
../../src/systemd/src/basic/alloc-util.h:169:50: note: expanded from macro 'msan_unpoison'
                                                 ^
../../src/systemd/src/basic/random-util.c:38:17: note: 'success' declared here
        uint8_t success;
                ^
1 error generated.
[80/545] Compiling C object 'src/basic/a6ba3eb@@basic@sta/process-util.c.o'.
ninja: build stopped: subcommand failed.
Fuzzers build failed
```
2019-05-08 16:10:06 +02:00
Chris Down 465ace74d9 cgroup: Test that it's possible to set memory protection to 0 again
The previous commit fixes this up, and this should prevent it
regressing.
2019-05-08 12:06:32 +01:00
Chris Down 22bf131be2 cgroup: Support 0-value for memory protection directives
These make sense to be explicitly set at 0 (which has a different effect
than the default, since it can affect processing of `DefaultMemoryXXX`).

Without this, it's not easily possible to relinquish memory protection
for a subtree, which is not great.
2019-05-08 12:06:32 +01:00
Chris Down 7e7223b3d5 cgroup: Readd some plumbing for DefaultMemoryMin
Somehow these got lost in the previous PR, rendering DefaultMemoryMin
not very useful.
2019-05-08 12:06:32 +01:00
Chris Down acdb4b5236 cgroup: Polish hierarchically aware protection docs a bit
I missed adding a section in `systemd.resource-control` about
DefaultMemoryMin in #12332.

Also, add a NEWS entry going over the general concept.
2019-05-08 12:06:32 +01:00
Lennart Poettering fd0a16d8a5
Merge pull request #11887 from evverx/fuzzbuzz
tests: hook up fuzz targets to FuzzBuzz
2019-05-08 12:40:03 +02:00
Lennart Poettering 324d9acab7 machinectl/loginctl: show json output if requested even if zero entries 2019-05-08 06:33:36 -04:00
Lennart Poettering a1c7a1f057 format-table: correct prototype 2019-05-08 06:33:36 -04:00
Zbigniew Jędrzejewski-Szmek d1c377da0d
Merge pull request #12489 from ssahani/vxlan
networkd: VXLAN rename Id to VNI
2019-05-08 12:02:54 +02:00
Zbigniew Jędrzejewski-Szmek ad3b2109c3
Merge pull request #12507 from poettering/random-fixlets
three minor fixes to random-util.c
2019-05-08 12:02:02 +02:00
Zbigniew Jędrzejewski-Szmek 0d0464d39d journalctl,shared/log: use yellow for warnings
In program output, highlighting warnings with ANSI_HIGHLIGHT is not enough,
because it doesn't stand out enough. Yellow is more appropriate.

I was worried that yellow wouldn't be visible on white background, but (at
least gnome-terminal) uses a fairly dark yellow that is fully legible on white
and light-colored backgrounds. We also used yellow in many places,
e.g. systemctl, so this should be fine.

Note: yellow is unreadable on urxvt with white background (urxvt +rv). But
grey, which we already used, is also unreadable, so urxvt users would have
to disable colors anyway, so this change does not make the problem
intrinsically worse. See
https://github.com/systemd/systemd/issues/12482#issuecomment-490374210.
2019-05-08 09:50:38 +02:00
Zbigniew Jędrzejewski-Szmek 1a04395959 Enable log colors for most of tools in /usr/bin
When emitting the calendarspec warning we want to see some color.
Follow-up for 04220fda5c.

Exceptions:
- systemctl, because it has a lot hand-crafted coloring
- tmpfiles, sysusers, stdio-bridge, etc, because they are also used in
  services and I'm not sure if this wouldn't mess up something.
2019-05-08 09:50:21 +02:00
Zbigniew Jędrzejewski-Szmek 37b8d2f699 basic/log: use colors to highlight messages like journalctl 2019-05-08 09:45:38 +02:00
Susant Sahani 61b824c561 networkd: bridge fdb add support to configure VXLAN VNI 2019-05-08 03:43:43 +02:00
Zbigniew Jędrzejewski-Szmek 29e19a6f19 fuzz: fix spelling of MACsec and MACAddress in the corpus 2019-05-08 06:53:07 +05:30
Zbigniew Jędrzejewski-Szmek 291539b75e check-directives: use diff to show what the differences really are
This also makes the comparison more detailed, since we check spelling,
including case.
2019-05-08 06:52:58 +05:30
Susant Sahani 8c32c5884d networkd: VXLAN use correct type for VNI 2019-05-08 06:52:54 +05:30
Susant Sahani 4cc0fd7531 networkd: VXLAN add support to configure Generic Protocol Extension
See https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-07
2019-05-08 06:52:42 +05:30
Lennart Poettering b2adc2ae3a
Merge pull request #12501 from keszybz/silence-strncpy-warnings
Silence strncpy warnings
2019-05-08 01:39:32 +02:00
Lennart Poettering 328f850e36 random-util: rename "err" to "success"
After all rdrand returns 1 on success, and 0 on failure, hence let's
name this accordingly.
2019-05-07 18:51:26 -04:00
Evgeny Vereshchagin fcbabd0f90 travis: make sure that the fuzz targets can be built on OSS-Fuzz 2019-05-07 21:39:01 +00:00
Evgeny Vereshchagin 9337418565 travis: make sure the fuzz targets can be built on FuzzBuzz 2019-05-07 21:39:01 +00:00
Evgeny Vereshchagin 87ac55a129 tests: hook up fuzz targets to FuzzBuzz 2019-05-07 21:39:01 +00:00
Lennart Poettering 80eb560a5b random-util: hash AT_RANDOM getauxval() value before using it
Let's be a bit paranoid and hash the 16 bytes we get from getauxval()
before using them. AFter all they might be used by other stuff too (in
particular ASLR), and we probably shouldn't end up leaking that seed
though our crappy pseudo-random numbers.
2019-05-07 17:31:20 -04:00
Lennart Poettering cc28145d51 random-util: use gcc's bit_RDRND definition if it exists 2019-05-07 17:31:20 -04:00
Lennart Poettering 1a0ffa1e73 random-util: rename RANDOM_DONT_DRAIN → RANDOM_MAY_FAIL
The old flag name was a bit of a misnomer, as /dev/urandom cannot be
"drained". Once it's initialized it's initialized and then is good
forever. (Only /dev/random has a concept of 'draining', but we never use
that, as it's an obsolete interface).

The flag is still useful though, since it allows us to suppress accesses
to the random pool while it is not initialized, as that trips up the
kernel and it logs about any such attempts, which we really don't want.
2019-05-07 17:30:40 -04:00
Zbigniew Jędrzejewski-Szmek 099c77fd5f scsi_serial: replace some crazy strncpy() calls by strnlen()
gcc was warning about strncpy() leaving an unterminated string.
In this case, it was correct.

The code was doing strncpy()+strncat()+strlen() essentially to determine
if the strings have expected length. If the length was correct, a buffer
overread was performed (or at least some garbage bytes were used from the
uninitialized part of the buffer). Let's do the length check first and then
only copy stuff if everything agrees.

For some reason the function was called "prepend", when it obviously does
an "append".
2019-05-07 21:06:44 +02:00
Zbigniew Jędrzejewski-Szmek 6695c200bd shared/utmp-wtmp: silence gcc warning about strncpy truncation
Unfortunately the warning must be known, or otherwise the pragma generates a
warning or an error. So let's do a meson check for it.

Is it worth doing this to silence the warning? I think so, because apparently
the warning was already emitted by gcc-8.1, and with the recent push in gcc to
catch more such cases, we'll most likely only get more of those.
2019-05-07 21:05:26 +02:00
Susant Sahani 76fbd4d73d networkd: VXLan TTL must be <= 255
Ignore when TTL > 255
2019-05-07 20:34:45 +02:00
Susant Sahani 83cb24ac20 networkd: VXLan Make group and remote variable separate
VXLAN Document Group=
2019-05-07 20:34:27 +02:00
Zbigniew Jędrzejewski-Szmek 717e8eda77
Merge pull request #12475 from yuwata/network-fix-12452
network: add network_ref/_unref() and make Link object take a reference of Network object
2019-05-07 20:03:22 +02:00
Zbigniew Jędrzejewski-Szmek 9175aabfb6
Merge pull request #12481 from ssahani/dhcp-max-retry
networkd: Allow DHCP4 client to set the number to attempt to configure/reconfigure
2019-05-07 19:58:40 +02:00
Susant Sahani 6f213e4a34 networkd: VXLAN rename Id to VNI
It makes more sense to call VXLAN ID as

1. the VXLAN Network Identifier (VNI) (or VXLAN Segment ID)
2. test-network: rename VXLAN Id to VNI
3. fuzzer: Add VXLAN VNI directive to fuzzer
2019-05-07 20:52:11 +05:30