1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

12243 Commits

Author SHA1 Message Date
Alex Crawford
85e22bfc3f networkd: add DHCP options for private zone 2015-08-04 03:23:43 -07:00
Alex Crawford
dbe465c93e basic: add LIST_INSERT_BEFORE
Similar in function to LIST_INSERT_AFTER, this will insert a new element
into the list before the specified position. If the specified position
is NULL, the element is added as the tail of the list.
2015-08-04 03:23:43 -07:00
Richard Maw
1fe6fa1679 machinectl: support relative host paths in copy-{from,to} 2015-08-04 09:11:23 +00:00
Richard Maw
d844017677 machined: Relax path checks for Copy{From,To}
Absolute paths should be sufficient to prevent funny business,
and while path_is_safe() checks this, it also checks whether the path
contains . or .. components, which while odd, aren't a security risk.
2015-08-04 09:11:23 +00:00
Susant Sahani
bff92d2c2f networkd: DHCP fix CID 1315105
CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in
dhcp_server_handle_message()
*** CID 1315105: Resource leaks (RESOURCE_LEAK)
/src/libsystemd-network/sd-dhcp-server.c: 800 in
2015-08-04 11:31:03 +05:30
Daniel Mack
2a984ebfd9 Merge pull request #845 from poettering/terminal-o-nonblock
add O_NONBLOCK to terminal handling
2015-08-03 20:57:19 +02:00
Daniel Mack
0da1624818 tree-wide: convert some more mfree() candidates 2015-08-03 19:39:42 +02:00
Lennart Poettering
35bdab779f terminal-util: no real reason to assert on O_CREAT
That's just handle this as a normal error.
2015-08-03 19:07:33 +02:00
Lennart Poettering
7d927c9a4d terminal-util: cast a couple of ioctl()s to void 2015-08-03 19:07:33 +02:00
Lennart Poettering
0a8b555ceb terminal-util: when resetting terminals, don't wait for carrier
In case of non-CLOCAL lines (i.e. those with carrier detect configured)
we shouldnt wait for a carrier if all we try to do is reset the TTY.
Hence, whenever we open such a TTY pass O_NONBLOCK.

Note that we continue to open ttys we intend to write to without
O_ONBLOCK, we only add it in cases we invoke ioctl()s or other terminal
operations without reading or writing to the device.

Fixes #835.
2015-08-03 19:06:35 +02:00
Tom Gundersen
9317cbecf8 Merge pull request #844 from poettering/clock-boottime2
tree-wide: convert bootchart and lldp code to use clock_boottime_or_m…
2015-08-03 17:58:54 +02:00
Tom Gundersen
6934f402cd Merge pull request #843 from poettering/clock-boottime
sd-event: make sure sd_event_now() cannot fail
2015-08-03 17:57:26 +02:00
Lennart Poettering
27ec691bfd tree-wide: convert bootchart and lldp code to use clock_boottime_or_monotonic()
We should avoid using CLOCK_BOOTTIME directly unless we actually can
sensible distuingish it from CLOCK_MONOTONIC. CLOCK_BOOTTIME is only
fully feature on very recent Linux kernels, hence we should stick to a
fallback logic, which is already available in the
clock_boottime_or_monotonic() call.
2015-08-03 17:40:46 +02:00
Lennart Poettering
5ef9b2203e Merge pull request #840 from systemd-mailing-devs/1438566907-9544-1-git-send-email-wangkefeng.wang@huawei.com
logind: add standard gpio power button support
2015-08-03 17:34:54 +02:00
Lennart Poettering
38a03f06a7 sd-event: make sure sd_event_now() cannot fail
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.

This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.

Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.

This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.

This change is inspired by #841.
2015-08-03 17:34:49 +02:00
Tom Gundersen
3b31df8301 resolved: transaction - increase number of retry attempts
With the exponential backoff, we can perform more requests in the same amount of time,
so bump this a bit.

In case of large RTT this may be necessary in order not to regress, and in case
of large packet-loss it will make us more robust. The latter is particularly
relevant once we start probing for features (and hence may see packet-loss
until we settle on the right feature level).
2015-08-03 14:25:49 +02:00
Tom Gundersen
9df3ba6c6c resolved: transaction - exponentially increase retry timeouts
Rather than fixing this to 5s for unicast DNS and 1s for LLMNR, start
at a tenth of those values and increase exponentially until the old
values are reached. For LLMNR the recommended timeout for IEEE802
networks (which basically means all of the ones we care about) is 100ms,
so that should be uncontroversial. For unicast DNS I have found no
recommended value. However, it seems vastly more likely that hitting a
500ms timeout is casued by a packet loss, rather than the RTT genuinely
being greater than 500ms, so taking this as a startnig value seems
reasonable to me.

In the common case this greatly reduces the latency due to normal packet
loss. Moreover, once we get support for probing for features, this means
that we can send more packets before degrading the feature level whilst
still allowing us to settle on the correct feature level in a reasonable
timeframe.

The timeouts are tracked per server (or per scope for the multicast
protocols), and once a server (or scope) receives a successfull package
the timeout is reset. We also track the largest RTT for the given
server/scope, and always start our timouts at twice the largest
observed RTT.
2015-08-03 14:06:58 +02:00
Tom Gundersen
240b589b14 resolved: cache - use clock_boottime_or_monotonic()
We cannot rely on CLOCK_BOOTTIME being supported by the kernel, so fallack
to CLOCK_MONOTONIC if the former is not supported.
2015-08-03 13:42:44 +02:00
Daniel Mack
b04d9f2871 Merge pull request #837 from ssahani/dhcp
networkd: fix neworkd crash
2015-08-03 09:55:41 +02:00
Kefeng Wang
405e116f57 logind: add standard gpio power button support
Many boards like hisilicon D02 board use standard gpio key to power down system.
A description of gpio-key in dts shown below,

gpio_keys {
	compatible = "gpio-keys";
	#address-cells = <1>;
	#size-cells = <0>;

	pwrbutton {
		label = "Power Button";
		gpios = <&porta 8 1>;
		linux,code = <116>;  // KEY_POWER, used by SC System Power Down
	};
};

-bash-4.3# udevadm info -a /dev/input/event3

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/gpio_keys/input/input3/event3':
    KERNEL=="event3"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/gpio_keys/input/input3':
    KERNELS=="input3"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="gpio_keys"
    ATTRS{phys}=="gpio-keys/input0"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/platform/gpio_keys':
    KERNELS=="gpio_keys"
    SUBSYSTEMS=="platform"
    DRIVERS=="gpio-keys"
    ATTRS{keys}=="116"
    ATTRS{switches}==""
    ATTRS{driver_override}=="(null)"
    ATTRS{disabled_keys}==""
    ATTRS{disabled_switches}==""

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""
2015-08-03 04:04:27 +02:00
Namhyung Kim
ba243e5155 sd-bus: cleanup bus_reset_parsed_address()
Both strv_free() and mfree() return NULL pointer after free.
2015-08-02 23:12:08 +09:00
Namhyung Kim
253f96e53e sd-bus: use mfree() in bus_reset_queues()
Recently mfree() was introduced to reduce work of tedious free + reset
pointers.  Use it in bus_reset_queues() too.
2015-08-02 23:12:08 +09:00
Namhyung Kim
0fd8d506f4 sd-bus: cleanup bus_close_fds()
The safe_close() already checks the fd and returns -1.
2015-08-02 23:12:08 +09:00
Susant Sahani
49f6e11e89 networkd: fix neworkd crash
fix issue #827

hostname should be init to NULL.
2015-08-02 00:16:02 +05:30
Lennart Poettering
58d5d500d8 Merge pull request #813 from dvdhrm/bus-client
busctl: make sure --address connects as bus-client
2015-07-31 20:24:47 +02:00
David Herrmann
36fd918260 Merge pull request #812 from zonque/test
Add some more tests
2015-07-31 20:23:19 +02:00
Daniel Mack
6f7897f9d2 Merge pull request #814 from dvdhrm/mfree
tree-wide: introduce mfree()
2015-07-31 20:17:33 +02:00
David Herrmann
8d87d4a989 busctl: make sure --address connects as bus-client
There is really no reason to use `busctl` to connect to legacy private
bus endpoints. Fix this and make sure `busctl --address=unix:path=/foo`
works!
2015-07-31 20:00:21 +02:00
Daniel Mack
e76398868a test-socket-util: add test for in_addr_is_null() 2015-07-31 19:58:29 +02:00
Daniel Mack
ff9265d089 test-util: add more tests
Add tests for safe_ato[iu]16() and some more unbase32hexmem() torture.
2015-07-31 19:58:29 +02:00
Daniel Mack
da8ba7219a test: add test for static lists
Test af-list and arphdr-list.
2015-07-31 19:58:27 +02:00
David Herrmann
97b11eedff tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
        free(foobar);
        foobar = NULL;
to this:
        foobar = mfree(foobar);
2015-07-31 19:56:38 +02:00
Daniel Mack
c474a4ecfa Merge pull request #811 from namhyung/busctl-misc-v2
busctl: Misc cleanups and a fix (v2)
2015-07-31 19:40:57 +02:00
Daniel Mack
6ba32d1c2f Merge pull request #810 from mamikk/bitmap-fixes-v2
Bitmap fixes v2
2015-07-31 19:21:51 +02:00
Namhyung Kim
cbfa6a4131 busctl: fix assertion failure on --size option
Using --size option triggers an assert failure below because
parse_size() requires the second argument, base, being either 1000 or
1024.  As it's for a packet size, it'd be better using IEC binary
suffix (base 1024) IMHO.

  $ busctl --size 2048
  Assertion 'base == 1000 || base == 1024' failed at src/basic/util.c:2222,
  function parse_size(). Aborting.
  Aborted (core dumped)
2015-08-01 02:20:47 +09:00
Namhyung Kim
d28ebe27f2 busctl: add missing description of --size option
The size option was to specify maximum captured patch length but was
missing its description in the command line help.  Add it.
2015-08-01 02:20:37 +09:00
Namhyung Kim
c030a850ba busctl: add and use strcmp_ptr()
In member_compare_func(), it compares interface, type and name of
members.  But as it can contain NULL pointer, it needs to check them
before calling strcmp().  So make it as a separate strcmp_ptr
function (named after streq_ptr) so that it can be used by others.

Also let streq_ptr() to use it in order to make the code simpler.
2015-08-01 02:16:24 +09:00
Martin Mikkelsen
951c3eefac bitmap: make bitmap_clear free the bitmap array
Given two bitmaps and the following code:

  Bitmap *a = bitmap_new(), *b = bitmap_new();
  bitmap_set(a, 1);
  bitmap_clear(a);
  bitmap_set(a, 0);
  bitmap_set(b, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because while
bitmap_clear() resets the number of elements in the array it does not
clear the array and bitmap_set() expects the array to be cleared.
GREEDY_REALLOC0 looks at the allocated size and not the actual size so
it does not clear any memory.

Fix this by freeing the allocated memory and resetting the whole Bitmap
to an initial state in bitmap_clear().

This also adds test code for this issue.
2015-07-31 19:08:26 +02:00
Martin Mikkelsen
d5fa819958 bitmap: fix bitmap_equal on bitmaps with unset bits
Given two bitmaps and the following code:

Bitmap *a = bitmap_new(), *b = bitmap_new();
bitmap_set(a, 0);
bitmap_unset(a, 0);

These two bitmaps should now have the same bits set and they should be
equal but bitmap_equal() will return false in this case because the
bitmaps array in a is larger because of the bit which was previously
set.

Fix this by comparing only the bits which exists in both bitmaps and
then check that the rest of the bits (if any) is all zero.

This also adds test code for this issue.
2015-07-31 18:57:13 +02:00
David Herrmann
b2a0ac5e5b bus-proxy: allow empty arguments to UpdateActivationEnvironment()
There is no reason to prevent empty argument lists on
UpdateActivationEnvironment(). Make sure we don't fail, but still skip
the call to pid1.
2015-07-31 18:56:38 +02:00
Lennart Poettering
aba8a9d1d2 Merge pull request #806 from dvdhrm/proxy-cookie
bus-proxy: fix cookie namespacing
2015-07-31 17:56:02 +02:00
David Herrmann
10189fd6be logind: release VT-positions when closing sessions
Make sure we release VT-positions when a session is closed. Otherwise,
lingering sessions will occupy VTs and prevent next logins from
succeeding.

Note that we already release session-devices when closing a session, so
there cannot be anyone using the VT anymore.
2015-07-31 16:52:29 +02:00
David Herrmann
970ad53dd6 bus-proxy: fix cookie namespacing
If we generate messages from within bus-proxyd, we really must make sure
that we do not clutter the cookie-namespace of our client. The client has
full control over it, so we cannot steal cookies from it. However, we can
re-use the cookie the client used for our request. As long as we only
send a single message, we're fine.
2015-07-31 16:42:38 +02:00
Kay Sievers
b506d3141b timesyncd: remove RLIMIT_NPROC
NSS plugins might create additional threads. Remove the limit, we cannot
really make any assumptions here.
2015-07-31 15:33:49 +02:00
Daniel Mack
e87cedf350 Merge pull request #804 from dvdhrm/proxy-directed2
bus-proxy: make NameAcquired/Lost directed (v2)
2015-07-31 15:04:21 +02:00
Daniel Mack
832089af55 Merge pull request #805 from dvdhrm/proxy-activation
bus-proxy: make StartServiceByName synchronous
2015-07-31 15:03:49 +02:00
David Herrmann
11f254be0c bus-proxy: make StartServiceByName synchronous
The StartServiceByName() call was provided by dbus-daemon to activate a
service without sending a message. On receiption, dbus-daemon schedules
an activation request (different modes are supported) and sends back the
reply once activation is done.

With kdbus, we marked StartServiceByName() as deprecated. There is no
real reason to start services explicitly. Instead, applications should
just *use* the service and rely on it being activated implicitly.
However, we provide compatibility with dbus-daemon and implement
StartServiceByName() on the proxy via a call to
org.freedesktop.DBus.Peer.Ping() on the destination. This will activate
the peer implicitly as part of the no-op Ping() method call (regardless
whether the peer actually implements that call).

Now, the problem is, StartServiceByName() was synchronous on dbus-daemon
but isn't on bus-proxy. Hence, on return, there is no guarantee that
ListNames includes the activated name. As this is required by some
applications, we need to make this synchronous.

This patch makes the proxy track the Ping() method call and send the
reply of StartServiceByName() only once Ping() returned. We do not look
at possible errors of Ping(), as there is no strict requirement for the
peer to implement org.freedesktop.DBus.Peer. Furthermore, any interesting
error should have already been caught by sd_bus_send() before.

Note:
        This race was triggered by gdbus. The gdbus-proxy implementation
        relies on a name to be available after StartServiceByName()
        returns. This is highly fragile and should be dropped by gdbus.
        Even if the call is synchronous, there is no reason whatsoever to
        assume the service did not exit-on-idle before ListNames()
        returns.
        However, this race is much less likely than the startup race, so
        we try to be compatible to dbus-daemon now.
2015-07-31 13:56:39 +02:00
David Herrmann
a87d2ed1ce bus-proxy: don't filter directed signals
NameAcquired and NameLost are directed signals. Never ever filter them on
dbus1. On dbus1, filters *exclusively* apply to broadcasts! Hence, we
must always forward directed signals unconditionally!
2015-07-31 13:28:23 +02:00
David Herrmann
e3c57a86f6 bus-proxy: fix NameAcquired and NameLost to be directed
The NameAcquired and NameLost signals are _directed_ signals. Make sure
we properly set the destination correctly, and verify it in our
proxy-test.
2015-07-31 13:28:21 +02:00
David Herrmann
0810bc568a basic: fix error/memleak in socket-util
Probably a typo, checking 'ret' instead of the return value 'p'. This
might cause the function to return failure, even though it succeeded.
Furthermore, it might leak resources.
2015-07-31 11:52:21 +02:00
Kay Sievers
540536ffd1 systemd-boot: sort /EFI/Linux/*.efi files 2015-07-30 18:28:02 +02:00
Daniel Mack
8e542fcdc4 unit-name: fix memory leak
Fix a memory leak introduced by 2fc09a9c. 's' is used twice in this
function, and if free_and_strdup() fails, the pointer is left untouched.
2015-07-30 15:51:50 +02:00
Daniel Mack
ed070f131f Merge pull request #787 from dvdhrm/bus-list
sd-bus: fix parsing of KDBUS_CMD_LIST
2015-07-30 15:35:52 +02:00
David Herrmann
89c240e3a5 sd-bus: fix parsing of KDBUS_CMD_LIST
We *must not* assume that an entry returned by KDBUS_CMD_LIST only
carries a single KDBUS_ITEM_OWNED_NAME. Similarly, we already parse
multiple such items for message-metadata, so make sure we support the
same on KDBUS_CMD_LIST.

By relying on the kernel to return all names separately, we limit the
kernel API significantly. Stop this and let the kernel decide how to
return its data.
2015-07-30 14:12:09 +02:00
Daniel Mack
2fc09a9cdd tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions.
2015-07-30 13:09:01 +02:00
Daniel Mack
65c85ef511 Merge pull request #779 from poettering/fflush-and-check
tree-wide: port everything over to fflush_and_check()
2015-07-29 20:43:54 +02:00
Tom Gundersen
1051d049a8 Merge pull request #764 from ssahani/vxlan1
networkd: Add VXLAN Netlink attributes
2015-07-29 20:40:17 +02:00
Daniel Mack
c2570b3de2 Merge branch 'master' of github.com:systemd/systemd 2015-07-29 20:31:15 +02:00
Lennart Poettering
dacd6cee76 tree-wide: port everything over to fflush_and_check()
Some places invoked fflush() directly with their own manual error
checking, let's unify all that by using fflush_and_check().

This also unifies the general error paths of fflush()+rename() file
writers.
2015-07-29 20:31:07 +02:00
Daniel Mack
7fc309b3a8 Merge branch 'pr/761' 2015-07-29 20:31:02 +02:00
Tom Gundersen
be0c13707d networkd-wait-online: only consider interfaces given on the commandline
If some interfaces are given on the commandline, ignore all others.
2015-07-29 20:30:50 +02:00
Kay Sievers
8110e144ff sd-boot: stub - export LoaderDevicePartUUID 2015-07-29 19:36:17 +02:00
Daniel Mack
85636547e7 Merge pull request #778 from ssahani/flow
networkd: fix size of networkd binary
2015-07-29 19:04:13 +02:00
Susant Sahani
6870b41563 networkd: fix size of networkd binary
This patch fixes the size of networkd
Bug #775

before:

size systemd-networkd
   text	   data	    bss	    dec	    hex	filename
1493755	8424392	   2337	9920484	 975fe4	systemd-networkd

After

$ size systemd-networkd
   text	   data	    bss	    dec	    hex	filename
1493555	  35752	   2337	1531644	 175efc	systemd-networkd
2015-07-29 22:20:06 +05:30
Lennart Poettering
c4a6d5085a Merge pull request #777 from kaysievers/gtp-auto
gpt-auto-generator: merge efi-boot-generator
2015-07-29 18:45:48 +02:00
Lennart Poettering
2b32ffa07d Merge pull request #774 from dvdhrm/gvariant3
gvariant: fix encoding of unary type and root-variant (v3)
2015-07-29 18:20:17 +02:00
Kay Sievers
59512f21d7 gpt-auto-generator: merge efi-boot-generator 2015-07-29 18:16:48 +02:00
David Herrmann
03ebf5e89b sd-bus: fix encoding/decoding gvariant root container
The gvariant root container contains a 'variant' at the end, which embeds
the whole message body. This variant *must* contain a structure so we are
compatible to dbus1. Otherwise, it could encode at most 1 type, instead
of a full signature.

Our gvariant message parser already parses the variant-content as a
structure, so we're mostly good. However, it does *not* include the
opening and closing parantheses, nor does it parse them.

This patch fixes the decoder to verify a message contains the
parantheses, and also make the encoder add those parantheses into the
marshaled message.
2015-07-29 16:46:24 +02:00
David Herrmann
e53d21d007 sd-bus: fix marshaling of unary type
The unary type has a fixed size of 1 in gvariant. Make sure we properly
encode it as such. Right now, we encode/decode it as empty sequence.
2015-07-29 16:38:14 +02:00
Daniel Mack
409f2e178c Merge pull request #769 from poettering/socket-util-no-log
socket-util: library calls shouldn't log on their own
2015-07-29 13:05:36 +02:00
David Herrmann
9a8fb5ae17 sd-bus: drop redundant code
If c->item_size is 0, the next item to parse in a structure is empty.
However, this also implies that the signature must be empty. The latter
case is already handled just fine by enter_struct_or_dict_entry() so
there is no reason to handle the same case in the caller.
2015-07-29 13:03:09 +02:00
David Herrmann
a388569f60 sd-bus: don't assert() on valid signatures
Right now sd_bus_message_skip() will abort execution if passed a
signature of the unary type "()". Regardless whether this should be
supported or not, we really must not abort. Drop the incorrect assertion
and add a test-case for this.
2015-07-29 13:03:09 +02:00
Daniel Mack
3512af1706 Merge pull request #768 from poettering/resolved-localhost
resolved: never attempt to resolve loopback addresses via DNS/LLMNR/mDNS
2015-07-29 12:44:22 +02:00
Lennart Poettering
1938ac5136 socket-util: library calls shouldn't log on their own
Instead, make sure that all callers log properly.
2015-07-29 12:38:22 +02:00
Lennart Poettering
9436e8cae4 resolved: never attempt to resolve loopback addresses via DNS/LLMNR/mDNS
We already refuse to resolve "localhost", hence we should also refuse
resolving "127.0.0.1" and friends.
2015-07-29 12:30:49 +02:00
Torstein Husebø
94e5ba370a treewide: fix typos 2015-07-29 12:29:46 +02:00
David Herrmann
48579c4b6a Merge pull request #747 from dvdhrm/consoled
terminal: drop unfinished code
2015-07-29 12:03:34 +02:00
Susant Sahani
ea84fd5cb3 networkd: vxlan add support for GBP
This patch add support for vxlan  VXLAN Group Policy Option.

https://tools.ietf.org/html/draft-smith-vxlan-group-policy-00
http://lwn.net/Articles/628683/
2015-07-29 14:05:34 +05:30
Susant Sahani
c06aead0c3 sd-netlink: introduce api for new NL type NLA_FLAG 2015-07-29 11:59:16 +05:30
Susant Sahani
de566208ee sd-netlink: add support for new type NETLINK_TYPE_FLAG
NETLINK_TYPE_FLAG is NLA_FLAG.

This new type will be used in NLA_FLAG for example

IFLA_VXLAN_GBP  and IFLA_VXLAN_REMCSUM_NOPARTIAL
2015-07-29 11:29:04 +05:30
Susant Sahani
452c956933 sd-netlink: add support for vxlan attributes 2015-07-29 11:28:57 +05:30
Tom Gundersen
79ac8ba973 networkd-wait-online: fix race
We must consider 'pending' links as if they may be managed by networkd, as this
is the state we enter before deciding wether networkd should manage the link
or not, so we better wait for this decision being made.
2015-07-29 01:45:46 +02:00
Tom Gundersen
bfcc67093d resolved: packet - refuse empty type bitmaps
The NSEC type itself must at least be in the bitmap, so NSEC records with empty
bitmaps must be bogus.
2015-07-28 23:25:52 +02:00
Tom Gundersen
2ad613addb resolved: packet - fix read_type_window()
We were tracking the bit offset inside each byte, rather than inside the whole bitmap.
2015-07-28 23:25:52 +02:00
Tom Gundersen
1792f2231f resolve: packet - fix append_types()
We were counting the number of bits set rather than the number of bytes they occupied.
2015-07-28 23:25:52 +02:00
Tom Gundersen
0a05b6b760 Merge pull request #758 from poettering/dns-is-equal
resolved: compare dns question arrays properly
2015-07-28 21:36:37 +02:00
Tom Gundersen
a494468652 Merge pull request #732 from ssahani/macvtap
networkd: add support for Macvtap
2015-07-28 19:44:02 +02:00
Lennart Poettering
1086182d83 resolved: compare dns question arrays properly
Let's optimize things a bit and properly compare DNS question arrays,
instead of checking if they are mutual supersets. This also makes ANY
query handling more accurate.
2015-07-28 18:38:54 +02:00
Daniel Mack
4e18de3d27 udev: Fix udev_builtin_run_once()
Honour the boolean return value type.
This was an oversight in f89d10ae4.
2015-07-28 14:38:31 +02:00
Daniel Mack
f89d10ae45 udev: check more builtins[] pointers before dereferencing
Fix some more locations where pointers from builtins[] are dereferenced
before checking. Related to 8cacf69b1.
2015-07-28 13:58:40 +02:00
Daniel Mack
87b46c575a Merge pull request #756 from ldzhong/fix
udev: avoid coredump when initializing udev builtins
2015-07-28 13:32:09 +02:00
Lidong Zhong
8cacf69b1b udev: avoid coredump when initializing udev builtins
If one of the macros(HAVE_BLKID/HAVE_KMOD/HAVE_ACL) is not
defined, there will be a coredump
2015-07-28 19:07:05 +08:00
Karel Zak
6f20f850f7 mount: remove obsolete -n
It seems that systemd still uses legacy -n option. The option has been
originally designed to avoid write to /etc/mtab during boot when root
FS is not ready or read-only.

This is not necessary for long time, because /etc/mtab is not a real
file (it's symlink) and write to the file is impossible. All utils
should be able to detect the symlink and ignore mtab. This concept is
supported for very long time before systemd.

The userspase mount options are currently maintained by libmount
(mount(8) and mount.nfs) in /run/mount) which is tmpfs initialized
during early boot.
2015-07-28 11:31:45 +02:00
Lennart Poettering
cd3d7c00bf Merge pull request #375 from msekletar/test-install-crashers
install: make unit_file_get_list aware of UNIT_FILE_INDIRECT
2015-07-28 03:20:24 +02:00
Lennart Poettering
4e5c1db95d Merge pull request #362 from d-hatayama/fix_selinux_unit_check_v2
selinux: fix missing SELinux unit access check
2015-07-28 01:44:18 +02:00
Daniel Mack
8baebe85cc Merge pull request #748 from teg/dns-name-between-4
basic: dns-name - between()
2015-07-28 00:40:15 +02:00
Daniel Mack
77cc990db9 Merge pull request #739 from intelfx/systemd-analyze-plot-user-instance
analyze: correctly draw the plot for user instances.
2015-07-28 00:28:19 +02:00
Ivan Shapovalov
06bef033be analyze: correctly draw the plot for user instances
Start-up timestamp of a user instance (userspace_time in struct boot_times)
actually may be arbitrarily big. This, because all timestamps are offset by
that value, leads to creation of arbitrarily wide SVGs which almost completely
consist of blank space.

Fix this by inverse-offsetting all timestamps by that value if user instance
operation is requested.

Fixes #740.
2015-07-28 01:16:24 +03:00
Tom Gundersen
ae72b22c40 shared: dns-name - add dns_name_between()
Given three DNS names this function indicates if the second argument lies
strictly between the first and the third according to the canonical DNS
name order. Note that the order is circular, so the last name is
considered to be before the first.
2015-07-28 00:07:32 +02:00
Tom Gundersen
5dfd7011ba shared: dns-name - use the canonical dns name ordering
The canonical DNS name ordering considers the rightmost label the most significant,
we were considering it the least significant. This is important when implementing
NSEC, which relies on the correct order.
2015-07-28 00:07:32 +02:00
Tom Gundersen
642900d3fa shared: dns-name - introduce dns_label_unescape_suffix()
Intended to be called repeatedly, and returns then successive unescaped labels
from the most to the least significant (left to right).

This is slightly inefficient as it scans the string three times (two would be
sufficient): once to find the end of the string, once to find the beginning
of each label and lastly once to do the actual unescaping. The latter two
could be done in one go, but that seemed unnecessarily convoluted.
2015-07-28 00:07:31 +02:00
Ivan Shapovalov
29b8b5ce87 analyze: move acquire_boot_times() above acquire_time_data()
Next patch will make the latter call into the former.
2015-07-28 01:01:10 +03:00
Daniel Mack
3992bee819 Merge pull request #744 from poettering/vnethdr-fix
networkd: capitalize VNetHeader= as VnetHeader=
2015-07-27 21:34:11 +02:00
Tom Gundersen
75c0cab158 util: base32hex - explain distinction with base32 2015-07-27 20:34:47 +02:00
Tom Gundersen
c73ee39d10 resolved: transaction - don't explicitly verify packet source
This is handled by the kernel now that the socket is connect()ed.
2015-07-27 20:34:28 +02:00
Tom Gundersen
088480faf1 resolved: transaction - don't unref server when creating TCP socket
This was a bug.
2015-07-27 20:34:15 +02:00
Tom Gundersen
72290734be resolved: scope - write() unicast DNS packets
As we have connect()ed to the desired DNS server, we no longer need to pass
control messages manually when sending packets. Simplify the logic accordingly.
2015-07-27 20:32:24 +02:00
Tom Gundersen
471d40d92f resolved: transaction - introduce dns_transaction_emit()
This function emits the UDP packet via the scope, but first it will
determine the current server (and connect to it) and store the
server in the transaction.

This should not change the behavior, but simplifies the code.
2015-07-27 20:30:54 +02:00
Lennart Poettering
2aba142edd networkd: capitalize VNetHeader= as VnetHeader=
Even when we use shortened, combined words, we still should uppercase
where a new word starts. I couldn't find a canonically capitalized
version of this term, hence I think we should follow our naming rules
here.
2015-07-27 20:24:31 +02:00
Tom Gundersen
c19ffd9fbf resolved: transaction - move a couple of functions
No functional change, but makes follow-up patch clearer.
2015-07-27 20:18:43 +02:00
David Herrmann
d537694a98 terminal: drop unfinished code
This drops the libsystemd-terminal and systemd-consoled code for various
reasons:

 * It's been sitting there unfinished for over a year now and won't get
   finished any time soon.

 * Since its initial creation, several parts need significant rework: The
   input handling should be replaced with the now commonly used libinput,
   the drm accessors should coordinate the handling of mode-object
   hotplugging (including split connectors) with other DRM users, and the
   internal library users should be converted to sd-device and friends.

 * There is still significant kernel work required before sd-console is
   really useful. This includes, but is not limited to, simpledrm and
   drmlog.

 * The authority daemon is needed before all this code can be used for
   real. And this will definitely take a lot more time to get done as
   no-one else is currently working on this, but me.

 * kdbus maintenance has taken up way more time than I thought and it has
   much higher priority. I don't see me spending much time on the
   terminal code in the near future.

If anyone intends to hack on this, please feel free to contact me. I'll
gladly help you out with any issues. Once kdbus and authorityd are
finished (whenever that will be..) I'll definitely pick this up again. But
until then, lets reduce compile times and maintenance efforts on this code
and drop it for now.
2015-07-27 20:15:34 +02:00
Tom Gundersen
0db643664c resolved: transaction - move DNS UDP socket creation to the scope
With access to the server when creating the socket, we can connect()
to the server and hence simplify message sending and receiving in
follow-up patches.
2015-07-27 20:13:11 +02:00
Tom Gundersen
647f6aa8fc resolved: transaction - close socket when changing server
Close the socket when changing the server in a transaction, in
order for it to be reopened with the right server when we send
the next packet.

This fixes a regression where we could get stuck with a failing
server.
2015-07-27 20:01:07 +02:00
Tom Gundersen
86ad4cd709 resolved: transaction - don't request PKTINFO for unicast DNS
This was only ever used by LLMNR, so don't request this for unicast DNS packets.
2015-07-27 19:56:45 +02:00
Tom Gundersen
0eb99d0a6a resloved: transaction - unify IPv4 and IPv6 sockets
A transaction can only have one socket at a time, so no need to distinguish these.
2015-07-27 19:52:48 +02:00
David Herrmann
2d5c8a2756 sd-bus: fix path of object-manager signals
Each signal of the ObjectManager interface carries the path of the object
in question as an argument. Therefore, a caller will deduce the object
this signal is generated for, by parsing the _argument_. A caller will
*not* use the object-path of the message itself (i.e., message->path).
This is done on purpose, so the caller can rely on message->path to be
the path of the actual object-manager that generated this signal, instead
of the path of the object that triggered this signal.

This commit fixes all InterfacesAdded/Removed signals to use the path of
the closest object-manager as message->path. 'closest' in this case means
closest parent with at least one object-manager registered.

This fix raises the question what happens if we stack object-managers in
a hierarchy. Two implementations are possible: First, we report each
object only on the nearest object-manager. Second, we report it on each
parent object-manager. This patch chooses the former. This is compatible
with other existing ObjectManager implementations, which are required to
call GetManagedObjects() recursively on each object they find, which
implements the ObjectManager interface.
2015-07-27 19:15:08 +02:00
Daniel Mack
ad8373e9e3 bus-proxy: augment debug message for dropped broadcasts a bit
Add the PID we are proxying for, as well as the message's sender and
destination string, to the debug message that is printed when the proxy
drops unmatched broadcasts.
2015-07-27 15:41:53 +02:00
Susant Sahani
f33ff02b1a networkd: add support for macvtap
This patch add support for macvtap.

see http://virt.kernelnewbies.org/MacVTap
2015-07-27 11:18:28 +05:30
Susant Sahani
d13125752d sd-netlink: Add macvtap support 2015-07-27 11:18:07 +05:30
Martin Pitt
baee30afce networkd-wait-online: fix -i argument
-i (aka --interface) takes an argument. Tell getopt_long() that, so that optarg
isn't NULL.
2015-07-26 15:39:09 +02:00
Kay Sievers
7189be2728 Merge pull request #716 from michaelolbrich/automount-fixes
Automount fixes
2015-07-26 13:56:50 +02:00
Kay Sievers
2909365c51 Merge pull request #724 from dbuch/master
proxyd: downgrade to log_debug() for unmatched broadcasts
2015-07-26 11:43:13 +02:00
Kay Sievers
fc7bdb583f systemd-boot: fix whitespace 2015-07-26 00:38:01 +02:00
Kay Sievers
2da6d7b91d Merge pull request #634 from icarlosvenegas/sd-boot-show-efi-cmdline_v2
sd-boot: Show stub cmdline when edit (v2)
2015-07-26 00:35:23 +02:00
Daniel Buch
e1d654341b proxyd: downgrade to log_debug() for unmatched broadcasts 2015-07-25 14:12:39 +02:00
Zbigniew Jędrzejewski-Szmek
23da66bb40 networkd: rename RootBlock to AllowPortToBeRoot
Justification is similar to BPDUGuard rename. "Positive" values
are easier. This is a rather uncommon option, so using a slightly
longer name should not be a problem, and may in fact may make it
easier to guess what the option does without reading the
documentation.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
072f9e4af4 networkd: turn UnicastFlood on by default
Looking at the kernel commit, "on" seems to be the default value:
commit 867a59436fc35593ae0e0efcd56cc6d2f8506586
Author: Vlad Yasevich <vyasevic@redhat.com>
Date:   Wed Jun 5 10:08:01 2013 -0400

    bridge: Add a flag to control unicast packet flood.

    Add a flag to control flood of unicast traffic.  By default, flood is
    on and the bridge will flood unicast traffic if it doesn't know
    the destination.  When the flag is turned off, unicast traffic
    without an FDB will not be forwarded to the specified port.

... and it seems to be the reasonable thing to do by default.
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
84c3409631 networkd: rename BPDUGuard to UseBPDU
Rename to follow the follow the style of other options.

In general "positive" options are preferred to "negative" ones,
because they are easier to describe and easier for humans to
parse (c.f. the shortening on the man page entry).
2015-07-24 23:44:42 -04:00
Zbigniew Jędrzejewski-Szmek
a9b70f9dfd network: rename DiffServiceCodePoint to CopyDSCP
Old name was slightly misleading, because this flag does not determine
whether DSCP is used overall, but only if it is copied to the
decapsulated packet. Rename to better reflect that.

"Copy" does not imply direction. This is on purpose, because we might
later on enhance the setting to allow/disallow copying in the other
direction, to the encapsulated packet. If that is implemented,
CopyDSCP could understand additional values. This is nicer than
having two separate settings and follows the example of DHCP=.

Also, we try to avoid abbreviations, but we allow acronyms
like MTU, in DiscoverPathMTU=.

This setting was recently added, so it's fine to rename it without
backwards compat.
2015-07-24 23:44:34 -04:00
Zbigniew Jędrzejewski-Szmek
6e74cadeef netlink-types: use consistent whitespace at EOL
Follow up for v222-124-g79e27dbcb1.
2015-07-24 23:43:51 -04:00
Kay Sievers
c11ae0bace bootctl: add missing newline 2015-07-25 03:26:32 +02:00
Thomas Hindoe Paaboel Andersen
7bea001ea4 ata_id: remove unused union member
The last use of octa was removed in 01f61d331b
2015-07-25 00:14:13 +02:00
Michael Olbrich
3dbadf9ef9 automount: handle state changes of the corresponding mount unit correctly
The expire timeout must be started/stopped if the corresponding mount unit
changes its state, e.g. it is started via local-fs.target or stopped by a
manual umount.
2015-07-24 22:30:26 +02:00
Michael Olbrich
5f8ae398ae automount: don't try to umount if it already happened
Return the token immediately instead. Otherwise the token is never returned
to the kernel, because the umount job is a noop and will not trigger a
state change.
2015-07-24 22:30:22 +02:00
Daniel Mack
816b4547da resolved: fix DNS_TYPE_ANY vs DNS_CLASS_ANY confusion
Assigning a TPYE enum value to a class variable is certainly wrong.
However, they both have the same value, so the result was correct
nevertheless.
2015-07-24 19:54:00 +02:00
Daniel Mack
b83b298102 Merge pull request #704 from richardmaw-codethink/empty-arg-unquote
unquote_first_word: parse ` '' ` as an empty argument instead of no arg
2015-07-24 19:49:29 +02:00
Tom Gundersen
0b071992bb Merge pull request #714 from zonque/automount
automount: do not start expiration timer for TimeoutIdleSec=0
2015-07-24 19:15:54 +02:00
Daniel Mack
93a3b53b2b automount: do not start expiration timer for TimeoutIdleSec=0
The timer value for automount unit specified with TimeoutIdleSec= is rounded
up to one second if that directive is set to 0.

Fix this by bailing early in automount_enter_runnning() in case no timeout is
requested.
2015-07-24 18:33:52 +02:00
daurnimator
29ddae7b78 sd-bus: remove _VTABLE from new method vtable initialiser 2015-07-24 22:59:19 +10:00
daurnimator
09c8a7c63c sd-bus: add 'offset' member for vtable methods
Defaults to zero, which retains the current behaviour.
Fixes #577
2015-07-24 22:22:54 +10:00
Daniel Mack
45d9a30414 tree-wide: do not use _cleanup_free_ on const pointers
free() cannot be used with const pointers. However, our _cleanup_free_
handler features cast logic that hides that qualifier, so we don't get a
warning.
2015-07-24 13:52:30 +02:00
David Herrmann
95cdf5e3a9 sd-bus: don't treat KDBUS_ITEM_TIMESTAMP as unknown item
In bus_kernel_translate_message(), we print a DEBUG message on unknown
items. But right now, we also print this message for KDBUS_ITEM_TIMESTAMP
despite parsing it properly. Fix this!
2015-07-24 12:53:23 +02:00
Daniel Mack
603d5da504 Merge pull request #606 from dvdhrm/bus-proxy-pedantic-matches2
bus-proxy: never pass on unmatched broadcasts (v2)
2015-07-24 12:50:56 +02:00
Daniel Mack
77b7f80509 Merge pull request #695 from poettering/journal-fixes
Journal fixes
2015-07-24 12:04:30 +02:00
Daniel Mack
7121b2152a Merge pull request #702 from ldzhong/fix
udev: fix parameter process
2015-07-24 11:59:30 +02:00
Richard Maw
14e685c29d unquote_first_word: parse '' as an empty argument instead of no argument 2015-07-24 09:29:46 +00:00
Lidong Zhong
e14b6f211c udev: fix parameter process 2015-07-24 16:39:55 +08:00
Daniel Mack
a20fbee75a Merge pull request #699 from ysbnim/master
exit-status: add missing string for EXIT_SMACK_PROCESS_LABEL
2015-07-24 10:20:40 +02:00
Daniel Mack
b4c279bea7 Merge pull request #696 from poettering/automount-expiry-freq
automount: lower the idle polling frequency a bit
2015-07-24 10:09:06 +02:00
Daniel Mack
4026f52a24 Merge pull request #697 from poettering/service-bus-name
core: print a nicer warning when two units have the same BusName= set…
2015-07-24 10:08:44 +02:00