platform/upstream/systemd.git
8 years agobasic: Debug-logging of Virtualisation detection
Stefan Schallenberg aka nafets227 [Thu, 18 Feb 2016 20:10:28 +0000 (21:10 +0100)]
basic: Debug-logging of Virtualisation detection

print out every single detection executed and its result.

8 years agoMerge pull request #2723 from poettering/importd-man
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 18:39:56 +0000 (13:39 -0500)]
Merge pull request #2723 from poettering/importd-man

8 years agoman: style fixes
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 18:46:16 +0000 (13:46 -0500)]
man: style fixes

8 years agoman: change recommended order of NSS modules in /etc/nsswitch.conf
Lennart Poettering [Tue, 23 Feb 2016 17:24:03 +0000 (18:24 +0100)]
man: change recommended order of NSS modules in /etc/nsswitch.conf

So far we recommended placing "nss-mymachines" after "nss-resolve" in the order
of preference in /etc/nsswitch.conf. This change reverse this order.

Rationale: single-label names are resolved via LLMNR by resolved, which has to
time out if no peer by that name exists. By placing "nss-mymachines" first
(which always responds immediately) we avoid running into this timeout for most
containers. Both modules should return the same data if LLMNR is used by the
container anyway.

While we are at it, improve the man pages of the three NSS modules in other
ways a bit.

8 years agoMerge pull request #2708 from vcaputo/journal-restore-offline-state-on-error
Lennart Poettering [Tue, 23 Feb 2016 15:55:16 +0000 (16:55 +0100)]
Merge pull request #2708 from vcaputo/journal-restore-offline-state-on-error

journal: restore offline state on error

8 years agoMerge pull request #2717 from keszybz/networkctl-prettification
Lennart Poettering [Tue, 23 Feb 2016 15:54:52 +0000 (16:54 +0100)]
Merge pull request #2717 from keszybz/networkctl-prettification

Networkctl prettification

8 years agoman: link some unit files to their online bus API documentation
Lennart Poettering [Tue, 23 Feb 2016 15:24:01 +0000 (16:24 +0100)]
man: link some unit files to their online bus API documentation

8 years agoman: add minimal man page for systemd-importd.service
Lennart Poettering [Tue, 23 Feb 2016 15:23:42 +0000 (16:23 +0100)]
man: add minimal man page for systemd-importd.service

8 years agonetworkctl: only print lldp legend for capabilities that were actually seen
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 04:23:56 +0000 (23:23 -0500)]
networkctl: only print lldp legend for capabilities that were actually seen

8 years agobasic: simplify ether_addr_is_null
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 13:17:19 +0000 (08:17 -0500)]
basic: simplify ether_addr_is_null

8 years agoFix two typos
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 13:17:19 +0000 (08:17 -0500)]
Fix two typos

8 years agoman: update link to Fedora Cloud images
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 13:17:03 +0000 (08:17 -0500)]
man: update link to Fedora Cloud images

Better to use the mirror manager and https.

8 years agoMerge pull request #2709 from vcaputo/normalize_inc_dec_usage
Martin Pitt [Tue, 23 Feb 2016 07:45:54 +0000 (08:45 +0100)]
Merge pull request #2709 from vcaputo/normalize_inc_dec_usage

tree-wide: make ++/-- usage consistent WRT spacing

8 years agoMerge pull request #2707 from teg/man-network
Martin Pitt [Tue, 23 Feb 2016 07:25:13 +0000 (08:25 +0100)]
Merge pull request #2707 from teg/man-network

network: minor manpage clarifications

8 years agoMerge pull request #2698 from poettering/personality
Martin Pitt [Tue, 23 Feb 2016 07:19:20 +0000 (08:19 +0100)]
Merge pull request #2698 from poettering/personality

Personality fixes

8 years agotree-wide: make ++/-- usage consistent WRT spacing
Vito Caputo [Tue, 23 Feb 2016 04:32:04 +0000 (20:32 -0800)]
tree-wide: make ++/-- usage consistent WRT spacing

Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.

8 years agojournal: restore offline state on error
Vito Caputo [Tue, 23 Feb 2016 04:00:13 +0000 (20:00 -0800)]
journal: restore offline state on error

If we fail to create the thread, technically we should leave the
offline_state as OFFLINE_JOINED, not OFFLINE_SYNCING.

8 years agoMerge pull request #2706 from whot/hwdb-updates
Zbigniew Jędrzejewski-Szmek [Tue, 23 Feb 2016 00:56:23 +0000 (19:56 -0500)]
Merge pull request #2706 from whot/hwdb-updates

Lenovo T460 and P50 touchpad axis corrections

8 years agoman: link - add suggestion for debugging
Tom Gundersen [Tue, 23 Feb 2016 00:09:31 +0000 (01:09 +0100)]
man: link - add suggestion for debugging

udevadm test-builtin can be very useful for testing .link files, so add a reference.

Addresses issue #2406.

8 years agoman: network - clarify BindCarrier documentation
Tom Gundersen [Mon, 22 Feb 2016 23:29:32 +0000 (00:29 +0100)]
man: network - clarify BindCarrier documentation

Make it clear that we are talking of links (in the sense used in networkd) and not ports.

Addresses issue #964.

8 years agoman: network - improve IPv6Token documentation
Tom Gundersen [Mon, 22 Feb 2016 23:21:53 +0000 (00:21 +0100)]
man: network - improve IPv6Token documentation

Enabling router advertisement may even trigger SLAAC or DHCPv6 to be used to configure
IPv6 addresses on the link. It may not be obvious that only in the SLAAC case will the
Token have an effect. Clarify this in the man page.

Addresses issue #863.

8 years agohwdb: reshuffle Lenovo entries to sort alphabetically by model
Peter Hutterer [Mon, 22 Feb 2016 23:52:21 +0000 (09:52 +1000)]
hwdb: reshuffle Lenovo entries to sort alphabetically by model

8 years agohwdb: add axis range corrections for the Lenovo T460 and P50
Peter Hutterer [Mon, 22 Feb 2016 23:49:08 +0000 (09:49 +1000)]
hwdb: add axis range corrections for the Lenovo T460 and P50

8 years agoMerge pull request #2701 from keszybz/udev-rules
Lennart Poettering [Mon, 22 Feb 2016 22:25:36 +0000 (23:25 +0100)]
Merge pull request #2701 from keszybz/udev-rules

udev-rules cleanup fix

8 years agogithub: CONTRIBUTING.md moved, let's fix the link to it
Lennart Poettering [Mon, 22 Feb 2016 22:22:42 +0000 (23:22 +0100)]
github: CONTRIBUTING.md moved, let's fix the link to it

8 years agotests: add personality tests
Lennart Poettering [Mon, 22 Feb 2016 17:36:54 +0000 (18:36 +0100)]
tests: add personality tests

8 years agoutil-lib: simplify personality() string matching
Lennart Poettering [Mon, 22 Feb 2016 17:29:05 +0000 (18:29 +0100)]
util-lib: simplify personality() string matching

8 years agovirt: make sure we don't ignore some errors
Lennart Poettering [Mon, 22 Feb 2016 15:28:17 +0000 (16:28 +0100)]
virt: make sure we don't ignore some errors

8 years agoman: extend the Personality= documentation
Lennart Poettering [Mon, 22 Feb 2016 15:01:53 +0000 (16:01 +0100)]
man: extend the Personality= documentation

Among other fixes, add information about more architectures that are supported
these days.

8 years agoutil-lib: support various ppc archs in personality logic
Lennart Poettering [Mon, 22 Feb 2016 14:50:35 +0000 (15:50 +0100)]
util-lib: support various ppc archs in personality logic

8 years agoutil-lib: use the architecture ids from architecture.h for personalities
Lennart Poettering [Mon, 22 Feb 2016 14:39:52 +0000 (15:39 +0100)]
util-lib: use the architecture ids from architecture.h for personalities

We have this ids, hence let's use them universally.

8 years agobuild-sys: move shared/architecture.[ch] into basic/
Lennart Poettering [Mon, 22 Feb 2016 14:26:54 +0000 (15:26 +0100)]
build-sys: move shared/architecture.[ch] into basic/

After all, it is pretty generic, has no external deps besides libc, and is very
similar to virt.[ch] which is also in basic/

8 years agoMerge pull request #2704 from poettering/lldp-internal-fix
Martin Pitt [Mon, 22 Feb 2016 22:21:46 +0000 (23:21 +0100)]
Merge pull request #2704 from poettering/lldp-internal-fix

build-sys: add missing header file to Makefile.am

8 years agobuild-sys: add missing header file to Makefile.am
Lennart Poettering [Mon, 22 Feb 2016 20:55:22 +0000 (21:55 +0100)]
build-sys: add missing header file to Makefile.am

Fixes: #2700

8 years agoudev-rules: fix querying of attributes
Zbigniew Jędrzejewski-Szmek [Mon, 22 Feb 2016 17:17:08 +0000 (12:17 -0500)]
udev-rules: fix querying of attributes

faccessat returns 0 on success.

A cosmetic fix is also included: the slash was doubled unnecessarily.

8 years agoudev-test.pl: add --strace option
Zbigniew Jędrzejewski-Szmek [Mon, 22 Feb 2016 17:15:17 +0000 (12:15 -0500)]
udev-test.pl: add --strace option

It's useful when trying to see what the tests are doing.
I hardcoded '-efile' as the option to strace, but in the future
it might be useful to make this configurable.

8 years agoMerge pull request #2685 from poettering/lldp-fixes2
Tom Gundersen [Mon, 22 Feb 2016 16:38:34 +0000 (17:38 +0100)]
Merge pull request #2685 from poettering/lldp-fixes2

lldp fixes, second iteration

8 years agoMerge pull request #2695 from mustrumr/fix-calendarspec-skip
Lennart Poettering [Mon, 22 Feb 2016 15:16:05 +0000 (16:16 +0100)]
Merge pull request #2695 from mustrumr/fix-calendarspec-skip

calendarspec: fix find_next skipping times

8 years agoMerge pull request #2692 from ssahani/tunnel
Zbigniew Jędrzejewski-Szmek [Mon, 22 Feb 2016 13:59:39 +0000 (08:59 -0500)]
Merge pull request #2692 from ssahani/tunnel

networkd: tunnel fix tunnel address

8 years agoMerge pull request #2694 from zonque/proxyarp-missing
Lennart Poettering [Mon, 22 Feb 2016 13:33:27 +0000 (14:33 +0100)]
Merge pull request #2694 from zonque/proxyarp-missing

missing.h: Explicitly check for IFLA_BRPORT_PROXYARP

8 years agocalendarspec: fix find_next skipping times
Hristo Venev [Mon, 22 Feb 2016 13:02:48 +0000 (08:02 -0500)]
calendarspec: fix find_next skipping times

reset usec when bumping hours/minutes

8 years agomissing.h: Explicitly check for IFLA_BRPORT_PROXYARP
Daniel Mack [Mon, 22 Feb 2016 12:10:16 +0000 (13:10 +0100)]
missing.h: Explicitly check for IFLA_BRPORT_PROXYARP

RHEL explicitly disables IFLA_BRPORT_PROXYARP by renaming the enum value.

In order to support unpatched builds, we have two options:

a) redefine the enum value through missing.h and ignore the fact that it
   is really unsupported, or

b) omit that enum value on rtnl_prot_info_bridge_port_types[]

As we are not actually using this netlink type anywhere, and because it
is only hooked up for the sake of completeness, this patch opts for the
former.

8 years agoMerge pull request #2687 from poettering/resolved-fix-2683
Daniel Mack [Mon, 22 Feb 2016 08:59:07 +0000 (09:59 +0100)]
Merge pull request #2687 from poettering/resolved-fix-2683

networkd: make sure we allocate the NTA set before we add items to it

8 years agoMerge pull request #2686 from poettering/github-templates
Daniel Mack [Mon, 22 Feb 2016 08:58:23 +0000 (09:58 +0100)]
Merge pull request #2686 from poettering/github-templates

add github issue template

8 years agoMerge pull request #2688 from poettering/calendar-fix-2678
Zbigniew Jędrzejewski-Szmek [Mon, 22 Feb 2016 02:29:41 +0000 (21:29 -0500)]
Merge pull request #2688 from poettering/calendar-fix-2678

A fix for #2678

8 years agoutil-lib: fix returned error code
Lennart Poettering [Sun, 21 Feb 2016 22:27:20 +0000 (23:27 +0100)]
util-lib: fix returned error code

Make sure we propagate errors properly.

8 years agoutil-lib: add (void) cast to indicate that we don't care about the normalization...
Lennart Poettering [Sun, 21 Feb 2016 22:25:38 +0000 (23:25 +0100)]
util-lib: add (void) cast to indicate that we don't care about the normalization success

After all, we verify that every calendar part is not out of bounds later on,
and it's fully OK if the normalization has no effect.

8 years agonetworkd: make sure we allocate the NTA set before we add items to it
Lennart Poettering [Sun, 21 Feb 2016 21:27:01 +0000 (22:27 +0100)]
networkd: make sure we allocate the NTA set before we add items to it

See: #2683

8 years agoMerge pull request #2650 from vcaputo/async_fsync
Lennart Poettering [Sun, 21 Feb 2016 20:35:50 +0000 (21:35 +0100)]
Merge pull request #2650 from vcaputo/async_fsync

Perform journal offlines asynchronously when possible

8 years agoMerge pull request #2681 from keszybz/udev-rules
Lennart Poettering [Sun, 21 Feb 2016 20:22:55 +0000 (21:22 +0100)]
Merge pull request #2681 from keszybz/udev-rules

udev-rules cleanup and coverity warning silencing

8 years agogithub: add a basic issue template
Lennart Poettering [Sun, 21 Feb 2016 20:15:17 +0000 (21:15 +0100)]
github: add a basic issue template

As documented here:

https://help.github.com/articles/creating-an-issue-template-for-your-repository/

8 years agogithub: move CONTRIBUTING.md into .github subdirectory
Lennart Poettering [Sun, 21 Feb 2016 20:05:02 +0000 (21:05 +0100)]
github: move CONTRIBUTING.md into .github subdirectory

As suggested by:

https://github.com/blog/2111-issue-and-pull-request-templates

8 years agoman: document the new EmitLLDP= .network setting
Lennart Poettering [Sun, 21 Feb 2016 19:58:01 +0000 (20:58 +0100)]
man: document the new EmitLLDP= .network setting

Also, beef up the LLDP documentation a bit.

8 years agoupdate TODO
Lennart Poettering [Thu, 18 Feb 2016 21:54:57 +0000 (22:54 +0100)]
update TODO

8 years agosd-lldp: beef up callback logic
Lennart Poettering [Sun, 21 Feb 2016 19:38:39 +0000 (20:38 +0100)]
sd-lldp: beef up callback logic

Instead of just notifying about the fact that something changed in the
database, actually inform the callback what precisely changed. This is useful,
so that the LLDP tx logic can be put into "fast" mode as soon as a previously
unknown peer appears, as suggested by the LLDP spec.

8 years agonetworkctl: ellipsize long LLDP fields in table output
Lennart Poettering [Sun, 21 Feb 2016 13:31:51 +0000 (14:31 +0100)]
networkctl: ellipsize long LLDP fields in table output

8 years agonetworkctl: add missing newline to printf() format string
Lennart Poettering [Sun, 21 Feb 2016 13:27:06 +0000 (14:27 +0100)]
networkctl: add missing newline to printf() format string

8 years agonetwork: turn on LLDP tx+rx for the default container network configuration
Lennart Poettering [Sun, 21 Feb 2016 13:06:08 +0000 (14:06 +0100)]
network: turn on LLDP tx+rx for the default container network configuration

Containers are relatively trusted and the veth tunnels are small networks,
hence let's turn on LLDP both ways for them.

8 years agonetworkd: add basic LLDP transmission support
Lennart Poettering [Sun, 21 Feb 2016 13:14:08 +0000 (14:14 +0100)]
networkd: add basic LLDP transmission support

Let's add some minimalistic LLDP sender support. The idea is that this is
either on or off, and all fields determined automatically rather than
configured explicitly.

8 years agosd-lldp: filter out LLDP messages coming from our own MAC address
Lennart Poettering [Sun, 21 Feb 2016 13:11:34 +0000 (14:11 +0100)]
sd-lldp: filter out LLDP messages coming from our own MAC address

Let's not get confused should we be connected to some bridge that mirrors back
our packets.

8 years agoimport: don't claim we had copied a settings file if we didn't
Lennart Poettering [Sat, 20 Feb 2016 23:10:55 +0000 (00:10 +0100)]
import: don't claim we had copied a settings file if we didn't

8 years agoman: update references to fedora cloud image
Lennart Poettering [Sat, 20 Feb 2016 22:45:19 +0000 (23:45 +0100)]
man: update references to fedora cloud image

We are now at F23, hence let's use that as example.

8 years agonetworkd: make a couple of functions static
Lennart Poettering [Sat, 20 Feb 2016 22:27:57 +0000 (23:27 +0100)]
networkd: make a couple of functions static

These functions are nowadays used only within networkd-link.c, hence ther's no
point in littering our public namespace with them.

8 years agonetworkd: rework when LLDP reception is enabled
Lennart Poettering [Sat, 20 Feb 2016 21:35:02 +0000 (22:35 +0100)]
networkd: rework when LLDP reception is enabled

Being on the link-layer LLDP is nothing we should turn on only when there's a
link beat. Instead, turn it on, whenever the iface is UP regardless if there's
a link beat or not. This closes the race between a link beat being available
and us subscribing to LLDP as a result.

8 years agonetworkctl: print a nice warning when networkd isn't running
Lennart Poettering [Sat, 20 Feb 2016 21:25:43 +0000 (22:25 +0100)]
networkctl: print a nice warning when networkd isn't running

8 years agonetworkctl: if there's no data from networkd about an iface show as "unmanaged"
Lennart Poettering [Sat, 20 Feb 2016 21:12:14 +0000 (22:12 +0100)]
networkctl: if there's no data from networkd about an iface show as "unmanaged"

After all, if we know that an interface exists but networkd did not store any
info about it, then it's definitely unmanaged by it.

(Note that we add this fix-up to networkctl, and not to sd-network, simply
because a missing file might also be result of the interface not existing.)

8 years agosd-network: use xsprintf() instead of asprintf() where we can
Lennart Poettering [Sat, 20 Feb 2016 21:06:12 +0000 (22:06 +0100)]
sd-network: use xsprintf() instead of asprintf() where we can

8 years agonetworkctl: add a couple of (void) casts
Lennart Poettering [Sat, 20 Feb 2016 20:34:38 +0000 (21:34 +0100)]
networkctl: add a couple of (void) casts

Where we knowingly ignore possible error results, let's cast to void.

8 years agonetworkd: rework how carrier bindings are serialized
Lennart Poettering [Fri, 19 Feb 2016 19:43:03 +0000 (20:43 +0100)]
networkd: rework how carrier bindings are serialized

Instead of serializing the interface name, expose the interface index, since
that's the only stable identifier.

8 years agonetworkd: turn on LLDP reception by default, in "routers-only" mode
Lennart Poettering [Fri, 19 Feb 2016 18:59:32 +0000 (19:59 +0100)]
networkd: turn on LLDP reception by default, in "routers-only" mode

This way "networkctl status" becomes a bit more useful by default, as router
information is just visible, without any further configuration.

LLDP reception is fully passive and relatively low simple and low traffic,
hence this should be safe to enable by default.

8 years agonetworkctl: extend "networkctl status" per-interface output to include LLDP info
Lennart Poettering [Fri, 19 Feb 2016 18:50:14 +0000 (19:50 +0100)]
networkctl: extend "networkctl status" per-interface output to include LLDP info

This adds a small and useful field to the "systemctl status" output: the
router(s) the interface is connected to as reported via LLDP. Example output:

● 2: enp0s25
       Link File: /usr/lib/systemd/network/99-default.link
            Type: ether
           State: degraded (configured)
            Path: pci-0000:00:19.0
          Driver: e1000e
    Connected To: GS1900 on port 2 (foobar)

i.e. the last line is the relevant one.

8 years agonetworkctl: make use of xsprintf() where we can
Lennart Poettering [Fri, 19 Feb 2016 18:24:16 +0000 (19:24 +0100)]
networkctl: make use of xsprintf() where we can

8 years agonetworkctl: simplify networkctl
Lennart Poettering [Fri, 19 Feb 2016 18:21:30 +0000 (19:21 +0100)]
networkctl: simplify networkctl

Move decode_and_sort_links() into acquire_info_all() which is the only place
this is used. The result is then nicely symmetric to acquire_info_strv().

8 years agonetworkctl: rework interface data acquisition
Lennart Poettering [Fri, 19 Feb 2016 18:18:12 +0000 (19:18 +0100)]
networkctl: rework interface data acquisition

Let's always use the same calls to acquire interface data. Specifically port
"networkctl status" to use acquire_link_info_strv() and acquire_link_info_all()
like the other calls.

8 years agonetworkctl: extend "networkctl list" and "networctl lldp" to optionally take interfac...
Lennart Poettering [Fri, 19 Feb 2016 17:57:11 +0000 (18:57 +0100)]
networkctl: extend "networkctl list" and "networctl lldp" to optionally take interface names

This way, the output may be reduced to only show data about the specified
interfaces.

8 years agonetworkctl: add new call that unifies link data acquisition between "status" and...
Lennart Poettering [Fri, 19 Feb 2016 17:26:18 +0000 (18:26 +0100)]
networkctl: add new call that unifies link data acquisition between "status" and "lldp" verbs

8 years agonetworkctl: fix dispatch_verb() table
Lennart Poettering [Fri, 19 Feb 2016 17:21:17 +0000 (18:21 +0100)]
networkctl: fix dispatch_verb() table

VERB_DEFAULT may only appear once.

8 years agonetworkctl: split out system status stuff into its own function
Lennart Poettering [Fri, 19 Feb 2016 17:20:40 +0000 (18:20 +0100)]
networkctl: split out system status stuff into its own function

8 years agosd-lldp: rework sd-lldp API
Lennart Poettering [Fri, 19 Feb 2016 16:58:52 +0000 (17:58 +0100)]
sd-lldp: rework sd-lldp API

This reworks the sd-lldp substantially, simplifying things on one hand, and
extending the logic a bit on the other.

Specifically:

- Besides the sd_lldp object only one other object is maintained now,
  sd_lldp_neighbor. It's used both as storage for literal LLDP packets, and for
  maintainging info about peers in the database. Separation between packet, TLV
  and chassis data is not maintained anymore. This should be a major
  simplification.

- The sd-lldp API has been extended so that a couple of per-neighbor fields may
  be queried directly, without iterating through the object. Other fields that
  may appear multiple times, OTOH have to be iterated through.

- The maximum number of entries in the neighbor database is now configurable
  during runtime.

- The generation of callbacks from sd_lldp objects is more restricted:
  callbacks are only invoked when actual data changed.

- The TTL information is now hooked with a timer event, so that removals from
  the neighbor database due to TTLs now result in a callback event.

- Querying LLDP neighbor database will now return a strictly ordered array, to
  guarantee stability.

- A "capabilities" mask may now be configured, that selects what type of LLDP
  neighbor data is collected. This may be used to restrict collection of LLDP
  info about routers instead of all neighbors. This is now exposed via
  networkd's LLDP= setting.

- sd-lldp's API to serialize the collected data to text files has been removed.
  Instead, there's now an API to extract the raw binary data from LLDP neighbor
  objects, as well as one to convert this raw binary data back to an LLDP
  neighbor object. networkd will save this raw binary data to /run now, and the
  client side can simply parse the information.

- support for parsing the more exotic TLVs has been removed, since we are not
  using that. Instead there are now APIs to extract the raw data from TLVs.
  Given how easy it is to parse the TLVs clients should do so now directly
  instead of relying on our APIs for that.

- A lot of the APIs that parse out LLDP strings have been simplified so that
  they actually return strings, instead of char arrays with a length. To deal
  with possibly dangerous characters the strings are escaped if needed.

- APIs to extract and format the chassis and port IDs as strings has been
  added.

- lldp.h has been simplified a lot. The enums are anonymous now, since they
  were never used as enums, but simply as constants. Most definitions we don't
  actually use ourselves have eben removed.

8 years agoudev-rules: use _cleanup_ for fclose
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 15:04:36 +0000 (10:04 -0500)]
udev-rules: use _cleanup_ for fclose

8 years agoudev-rules: make error messages about rules more uniform
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 05:26:32 +0000 (00:26 -0500)]
udev-rules: make error messages about rules more uniform

Also downgrade non-fatal warnings to log_warning.

Previously rule_add_key() would check the output array and log a cryptic
error and return -1. Most of the time the return value was ignored. This
does not seems right, because the buffer can overflow with enough rules.
It would also check if we have enough space for the *next* rule, even if
there might be not next rule, i.e. off-by-one.

Replace this with a check that we have enough space for a next rule before
we start parsing.

Normally using macros to alter flow is not allowed, but in this case I
think it is worth it, because it allows lots of boilerplate code to be
removed and hides repeated boring parameters, making function logic much
easier to follow.

8 years agoudev-rules: rewrite function to avoid clobbering arguments
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 04:00:45 +0000 (23:00 -0500)]
udev-rules: rewrite function to avoid clobbering arguments

If the attribute wasn't found, the last filename looked at was returned in
the input/output argument. This just seems bad style.

The return value was ignored, so change function to return void.

8 years agoudev-rules: modernize syntax a bit
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 01:40:41 +0000 (20:40 -0500)]
udev-rules: modernize syntax a bit

8 years agoudev-rules: log_oom() on memory error and abort processing of event
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 01:09:34 +0000 (20:09 -0500)]
udev-rules: log_oom() on memory error and abort processing of event

CID #1313566.

Also, change the return value to void, because it is ignored anyway.

8 years agosd-device: use (void) before set_iterate calls
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 00:16:01 +0000 (19:16 -0500)]
sd-device: use (void) before set_iterate calls

set_iterate sets the output argument to NULL on error, and the return
value is not used in this case.

CID #1306804-09.

8 years agotime-util: check for overflow in conversion from ts to nsec_t
Zbigniew Jędrzejewski-Szmek [Sun, 21 Feb 2016 00:10:38 +0000 (19:10 -0500)]
time-util: check for overflow in conversion from ts to nsec_t

CID #1320855.

8 years agocore: exclude .slice units from "systemctl isolate"
Lennart Poettering [Thu, 18 Feb 2016 21:51:23 +0000 (22:51 +0100)]
core: exclude .slice units from "systemctl isolate"

Fixes: #1969

8 years agonetworkd: fix logging of error codes
Lennart Poettering [Thu, 18 Feb 2016 21:49:48 +0000 (22:49 +0100)]
networkd: fix logging of error codes

8 years agonetworkd: enable LLDP only on ethernet
Lennart Poettering [Thu, 18 Feb 2016 21:49:02 +0000 (22:49 +0100)]
networkd: enable LLDP only on ethernet

8 years agosd-netlink: fix ifi_iftype type
Lennart Poettering [Thu, 18 Feb 2016 21:47:34 +0000 (22:47 +0100)]
sd-netlink: fix ifi_iftype type

The iftype is an unsigned short, and not just an unsigned.

8 years agosd-lldp: fix how we create the LLDP listening socket
Lennart Poettering [Thu, 18 Feb 2016 21:45:22 +0000 (22:45 +0100)]
sd-lldp: fix how we create the LLDP listening socket

Specifiy the ethernet family, and make sure we se the O_CLOEXEC and O_NONBLOCK
bits how we should for all fds.

8 years agotree-wide: place #pragma once at the same place everywhere
Lennart Poettering [Tue, 16 Feb 2016 19:05:15 +0000 (20:05 +0100)]
tree-wide: place #pragma once at the same place everywhere

Usually, we place the #pragma once before the copyright blurb in header files,
but in a few cases we didn't. Move those around, so that we do the same thing
everywhere.

8 years agosd-lldp: simplify lldp_network_bind_raw_socket() a bit
Lennart Poettering [Tue, 16 Feb 2016 18:47:25 +0000 (19:47 +0100)]
sd-lldp: simplify lldp_network_bind_raw_socket() a bit

Let's constify the filter program, drop a few includes and structure
definitions.

8 years agosd-lldp: move ETHERTYPE_LLDP to missing.h
Lennart Poettering [Tue, 16 Feb 2016 18:46:28 +0000 (19:46 +0100)]
sd-lldp: move ETHERTYPE_LLDP to missing.h

After all, most ETHERTYPE variables are defined in the system headers, hence
define these where we defined all other fill-ins for system headers.

8 years agotest-lldp: fix error checking expressions
Lennart Poettering [Tue, 16 Feb 2016 18:36:47 +0000 (19:36 +0100)]
test-lldp: fix error checking expressions

8 years agolibsystemd-network: sd-event uses 64bit priorities, expose them in the APIs as such
Lennart Poettering [Tue, 16 Feb 2016 18:33:36 +0000 (19:33 +0100)]
libsystemd-network: sd-event uses 64bit priorities, expose them in the APIs as such

8 years agosd-lldp: drop "port" object
Lennart Poettering [Tue, 16 Feb 2016 18:26:40 +0000 (19:26 +0100)]
sd-lldp: drop "port" object

Let's just keep the few parts we actually need of it in the main sd_lldp
object, so that we can simplify things quite a bit.

While we are at it, remove ifname and mac fields which we make no use of
whatsoever.

8 years agosd-lldp: drop keeping of statistics
Lennart Poettering [Tue, 16 Feb 2016 18:05:35 +0000 (19:05 +0100)]
sd-lldp: drop keeping of statistics

We don't expose them, and they are only of questionnable use.

8 years agolibsystemd-network: don't abbreviate "callback" as "cb" needlessly
Lennart Poettering [Tue, 16 Feb 2016 17:58:51 +0000 (18:58 +0100)]
libsystemd-network: don't abbreviate "callback" as "cb" needlessly

This isn't an excercise in creating APIs that are hard to understand, hence
let's call a callback a callback.

8 years agosd-lldp: drop state field
Lennart Poettering [Tue, 16 Feb 2016 17:56:37 +0000 (18:56 +0100)]
sd-lldp: drop state field

There's really no point in maintaining a state, the state machine is trivial,
and we actually never look at the state anyway, we just keep updating it.