Commit graph

21223 commits

Author SHA1 Message Date
Tom Gundersen 31053e929e Merge pull request #549 from ssahani/dhcp
networkd: allow hostname override
2015-07-20 17:58:45 +02:00
Daniel Mack 6913b32249 Merge pull request #626 from systemd-mailing-devs/1437135133-9646-2-git-send-email-vivenzio.pagliari@nokia.com
man: Typo fix in systemd.preset manpage
2015-07-20 12:16:32 +02:00
Daniel Mack afd56ac532 Merge pull request #614 from teg/bitmap-overflow
basic: bitmap - complete fix for bitshift overflow
2015-07-19 02:53:23 -04:00
Tom Gundersen cdf6f5ae04 basic: bitmap - complete fix for bitshift overflow
The bug found by David existed in several places, fix them all. Also
extend the tests to cover these cases.
2015-07-17 18:59:16 +02:00
Vivenzio Pagliari 9e0d90f99d Typo fix in systemd.preset manpage 2015-07-17 15:02:26 +02:00
Tom Gundersen 511ed79917 Merge pull request #611 from dvdhrm/bitmap-fixes
Bitmap fixes
2015-07-17 12:33:49 +02:00
David Herrmann 724dd73d1b Merge pull request #607 from ssahani/vxlan1
networkd: move config parsers to specific header files
2015-07-17 12:26:32 +02:00
David Herrmann d3621df89c Merge pull request #610 from utezduyar/include-signal-header
cgtop: include missing signal.h for sigwinch
2015-07-17 12:24:26 +02:00
David Herrmann a933570dea bitmap: avoid 32bit integer overflow in shift
We really must use 64bit integers to calculate long-long shifts.
Otherwise, we will never get higher masks than 2^31.
2015-07-17 12:19:06 +02:00
David Herrmann 22cedfe15f bitmap: allow bitmap_iterate() on NULL bitmap
Make sure we properly treat NULL bitmaps as empty. Right now, we don't
(which really looks like a typo).
2015-07-17 12:18:13 +02:00
Umut Tezduyar Lindskog 97b845b0fc cgtop: include missing signal.h for sigwinch 2015-07-17 10:39:06 +02:00
David Herrmann 2810332843 logind: never select closing sessions for a VT
If a session is in closing state (and already got rid of its VT), then
never re-select it for that VT. There is no reason why we should grant
something to a session that is already going away *AND* already got rid
of exactly that.
2015-07-16 18:46:12 +02:00
David Herrmann 304ae2b9a1 build: add ./test-bitmap to .gitignore
Make sure to ignore build files of Tom's recent test-bitmap addition.
2015-07-16 18:30:05 +02:00
David Herrmann da770c386f logind: prefer new sessions over older ones on VT switches
Our seat->positions[] array keeps track of the 'preferred' session on a
VT. The only situation this is used, is to select the session to activate
when a VT is activated. In the normal case, there's only one session per
VT so the selection is trivial.

Older greeters, however, implement take-overs when they start sessions on
the same VT that the greeter ran on. We recently limited such take-overs
to VTs where a greeter is running on, to force people to never share VTs
in new code that is written.

For legacy reasons, we need to be compatible to old greeters, though.
Hence, we allow those greeters to implement take-over. In such take-overs,
however, we should really make sure that the new sessions gets preferred
over the old one under all circumstances. Hence, make sure we override
the previous preferred session with a new session.
2015-07-16 18:23:55 +02:00
Tom Gundersen 0a010a05d3 Merge pull request #605 from dvdhrm/test-bus-proxy
sd-bus: add new test for NameAcquired via proxy/dbus-daemon
2015-07-16 18:17:57 +02:00
Susant Sahani 3b50bf800e networkd: move config_parse_tunnel_address
move config_parse_tunnel_address from networkd.h to

tunnel specific file networkd-netdev-tunnel.h
2015-07-16 20:16:53 +05:30
Susant Sahani a94d64d256 networkd: move config_parse_vxlan_group_address
move config_parse_vxlan_group_address from
networkd.h to networkd-netdev-vxlan.h
2015-07-16 20:14:05 +05:30
David Herrmann 9afd2b46f2 sd-bus: add new test for NameAcquired via proxy/dbus-daemon
This adds test-bus-proxy which should be used to test correct behavior of
systemd-bus-proxyd. The first test that was added is to verify we actually
receive NameAcquired signals for ourselves on bus-connect.
2015-07-16 16:35:09 +02:00
David Herrmann 2ec7c4279e Merge pull request #602 from teg/bitmap-iterator
bitmap: use external iterator
2015-07-16 15:12:26 +02:00
David Herrmann 1845880757 sd-bus: properly match ID changes
If the caller does not specify arg1 for NameOwnerChanged matches, we
really must take the ID from arg2 or arg3, if provided. They are
guaranteed to be identical to arg1 if either is supplied, but there is no
strict requiredment that arg1 is supplied. Hence, make sure to always
take the more restrictive match. Otherwise, we install rather wide
matches without anyone requiring them.
2015-07-16 15:01:52 +02:00
David Herrmann 1af5f746d5 sd-bus: destination-matches cannot match NameOwnerChanged
Make sure we don't install NameOwnerChanged matches if the caller passed
a destination='' match (except if it is the broadcast address). Per spec,
all NameOwnerChanged signals are broadcasts.

Only the NameLost/NameAcquired signals are unicasts, but those are never
received through sd-bus. Instead, the bus-proxy synthesizes them and it
already installs proper matches for them.
2015-07-16 15:01:52 +02:00
David Herrmann 4f1d774135 sd-bus: fix invalid stack access on test-bus-marshal
Make sure we actually parse "unsigned long long" if we encode a uint64_t.
Otherwise, we will get random data from the stack.
2015-07-16 15:01:52 +02:00
Tom Gundersen cb57dd4159 bitmap: use external iterator
Reuse the Iterator object from hashmap.h and expose a similar API.

This allows us to do

{
    Iterator i;
    unsigned n;

    BITMAP_FOREACH(n, b, i) {
        Iterator j;
        unsigned m;

        BITMAP_FOREACH(m, b, j) {
            ...
        }
    }
}

without getting confused. Requested by David.
2015-07-16 14:11:12 +02:00
David Herrmann 443a559813 sd-bus: fix gvariant structure encoding
In gvariant, all fixed-size objects need to be sized a multiple of their
alignment. If a structure has only fixed-size members, it is required to
be fixed size itself. If you imagine a structure like (ty), you have an
8-byte member followed by an 1-byte member. Hence, the overall inner-size
is 9. The alignment of the object is 8, though. Therefore, the specs
mandates final padding after fixed-size structures, to make sure it's
sized a multiple of its alignment (=> 16).

On the gvariant decoder side, we already account for this in
bus_gvariant_get_size(), as we apply overall padding to the size of the
structure. Therefore, our decoder correctly skips such final padding when
parsing fixed-size structure.

On the gvariant encoder side, however, we don't account for this final
padding. This patch fixes the structure and dict-entry encoders to
properly place such padding at the end of non-uniform fixed-size
structures.

The problem can be easily seen by running:
    $ busctl --user monitor
and
    $ busctl call --user org.freedesktop.systemd1 / org.foobar foobar "(ty)" 777 8

The monitor will fail to parse the message and print an error. With this
patch applied, everything works fine again.

This patch also adds a bunch of test-cases to force non-uniform
structures with non-pre-aligned positions.

Thanks to Jan Alexander Steffens <jan.steffens@gmail.com> for spotting
this and narrowing it down to non-uniform gvariant structures. Fixes #597.
2015-07-16 11:23:34 +02:00
Daniel Mack 42921716a4 Merge pull request #588 from teg/resolved-nsec
resolved: add basic NSEC and NSEC3 support
2015-07-15 17:27:35 -04:00
David Herrmann 7ee7b225bd build: add convenience target 'build-sources'
This target allows to trigger a build of $(BUILT_SOURCES) manually. This
is handy if you tend to use 'make systemd-foobar' to directly build a
single binary. Those do not pull in $(BUILT_SOURCES), unfortunately. See
automake docs for that.
2015-07-15 15:36:54 +02:00
David Herrmann 7d67077f78 sd-bus: fix object tree to be deeper than 2 levels
So right now our object-tree is limited to 2 levels at most
('/' and '/foo/...../bar'). We never link any intermediate levels, even
though that was clearly the plan. Fix the bus_node_allocate() helper to
actually link all intermediate nodes, too, not just the root node.

This fixes a simple inverse ptr-diff bug.

The downside of this fix is that we clearly never tested (nor used) the
object tree in any way. The only reason that the introspection works is
that our enumerators shortcut the object tree.

Lets see whether that code actually works..

Thanks to: Nathaniel McCallum <nathaniel@themccallums.org>
..for reporting this. See #524 for an actual example code.
2015-07-15 14:39:12 +02:00
David Herrmann bf4c113e17 sd-device: never return NULL+0
It is highly confusing if a getter function returns 0, but the value is
set to NULL. This, right now, triggers assertions as code relies on the
returned values to be non-NULL.

Like with sd-bus-creds and friends, return 0 only if a value is actually
available.

Discussed with Tom, and actually fixes real bugs as in #512.
2015-07-15 12:31:21 +02:00
David Herrmann ab822b624b sd-boot: ignore missing /etc/machine-id
If /etc/machine-id is missing (eg., gold images), we should not fail
installing sd-boot. This is a perfectly fine use-case and we should simply
skip installing the default loader config in that case.
2015-07-15 12:04:31 +02:00
Tom Gundersen 5d45a88084 resolved: rr - add NSEC3 support
Needed for DNSSEC.
2015-07-14 22:17:24 +02:00
Tom Gundersen 919a7f5f1c basic: util - add base32hexmem() function similar to hexmem()
This implements more of RFC4648.
2015-07-14 22:14:08 +02:00
Daniel Mack 8a2abb30b8 Merge pull request #587 from teg/unbase64mem-memleak
basic: util - fix memleak on error in unbase64mem()
2015-07-14 16:10:11 -04:00
Tom Gundersen 50f1e641a9 resolved: rr - add NSEC support
Needed for DNSSEC.
2015-07-14 21:53:10 +02:00
Tom Gundersen 5ffa42cb80 basic: add a Bitmap implementation
For when a Hashmap is overkill.
2015-07-14 21:53:10 +02:00
Tom Gundersen 2a2953b355 basic: util - fix memleak on error in unbase64mem() 2015-07-14 21:14:45 +02:00
Tom Gundersen dad8f7f2b6 Merge pull request #538 from mischief/multiple-routers
sd-dhcp-lease: fix handling of multiple routers

We only support one router, but in case more than one is given, we now ignore subsequent ones, rather than fall over.
2015-07-14 20:17:11 +02:00
Daniel Mack 9ecec7d766 Merge pull request #586 from teg/resolved-rrs-3
resolved: minor improvements to RR handling
2015-07-14 13:43:18 -04:00
Tom Gundersen d23a27a964 resolved: improve printing of unknown RRs
This implements the recommendations from RFC3597.
2015-07-14 19:36:35 +02:00
Daniel Mack c0d645b51f Merge pull request #585 from teg/resolved-harden-2
resolved: harden
2015-07-14 13:26:16 -04:00
David Herrmann ca970016b7 Merge commit 'refs/pull/436/head' of https://github.com/systemd/systemd
This merges:
  sd-netlink: respect attribute type flags

..fixing a conflict due to a typo fix.
2015-07-14 19:19:39 +02:00
Tom Gundersen abf126a355 resolved: rr - add DS support
Needed for DNSSEC.
2015-07-14 19:16:16 +02:00
Tom Gundersen 7c6423e191 resolved: rr - print formated timestamps in RRSIG 2015-07-14 19:16:12 +02:00
Tom Gundersen d20b1667db resolved: use one UDP socket per transaction
We used to have one global socket, use one per transaction instead. This
has the side-effect of giving us a random UDP port per transaction, and
hence increasing the entropy and making cache poisoining significantly
harder to achieve.

We still reuse the same port number for packets belonging to the same
transaction (resent packets).
2015-07-14 18:50:57 +02:00
Tom Gundersen 29815b6c60 resolved: implement RFC5452
This improves the resilience against cache poisoning by being stricter
about only accepting responses that match precisely the requst they
are in reply to.

It should be noted that we still only use one port (which is picked
at random), rather than one port for each transaction. Port
randomization would improve things further, but is not required by
the RFC.
2015-07-14 18:50:57 +02:00
Tom Gundersen 8300ba218e resolved: pin the server used in a transaction
We want to discover information about the server and use that in when crafting
packets to be resent.
2015-07-14 18:50:53 +02:00
Daniel Mack 73b836e22f Merge pull request #530 from dvdhrm/resolve-host-dbus
resolve-host: enable dbus-activation
2015-07-14 12:41:29 -04:00
Daniel Mack 0a9ccafe10 Merge pull request #579 from ssahani/tap-vnet-hdr
networkd: tap add support for vnet_hdr
2015-07-14 12:03:45 -04:00
Susant Sahani 43f78da4ed man: add man for tap vnet_hdr 2015-07-14 20:48:09 +05:30
Tom Gundersen 91b14d6ff3 resolved: reference count the dns servers
We want to reference the servers from their active transactions, so make sure
they stay around as long as the transaction does.
2015-07-14 12:03:04 +02:00
Tom Gundersen a0166609f7 resolved: packet - ensure there is space for IP+UDP headers
Currently we only make sure our links can handle the size of the payload witohut
taking the headers into account.
2015-07-14 12:03:04 +02:00