Commit graph

66 commits

Author SHA1 Message Date
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering 3f6fd1ba65 util: introduce common version() implementation and use it everywhere
This also allows us to drop build.h from a ton of files, hence do so.
Since we touched the #includes of those files, let's order them properly
according to CODING_STYLE.
2015-09-29 21:08:37 +02:00
Lennart Poettering 1fc464f6fb cgtop: underline table header
Let's underline the header line of the table shown by cgtop, how it is
customary for tables. In order to do this, let's introduce new ANSI
underline macros, and clean up the existing ones as side effect.
2015-09-22 16:30:42 +02:00
Thomas Hindoe Paaboel Andersen 64d6c22905 tree-wide: do not shadow the global var timezone 2015-09-01 18:20:13 +02:00
Lennart Poettering 8eb9058dc1 dhcp,network: implement RFC 4833 (DHCP Timezone option)
This one is simply to add: encode the tzdata timezone in the DHCP
options and optionally make use of it.
2015-08-26 20:44:20 +02:00
Thomas Hindoe Paaboel Andersen 7d6884b65e tree-wide: fix indentation 2015-08-06 00:44:19 +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
Tom Gundersen 1c4baffc18 sd-netlink: rename from sd-rtnl 2015-06-13 19:52:54 +02:00
Tom Gundersen 31710be527 sd-rtnl: make joining broadcast groups implicit 2015-06-11 17:47:40 +02:00
Thomas Hindoe Paaboel Andersen 920b52e490 tree-wide: remove spurious space 2015-06-08 23:11:26 +02:00
Ronny Chevalier 732b7f39a2 networkctl: fix uninitialized variable
We ignore the return value of sd_device_get_devtype, then devtype could
be uninitialized when used with streq_ptr. So we need to initialize it
first.
2015-05-30 11:19:36 +02:00
Ronny Chevalier 288a74cce5 shared: add terminal-util.[ch] 2015-04-11 00:34:02 +02:00
Tom Gundersen 914d6c09f1 networkctl: port from libudev to sd-device 2015-04-02 00:18:27 +02:00
Harald Hoyer a7f7d1bde4 fix gcc warnings about uninitialized variables
like:

src/shared/install.c: In function ‘unit_file_lookup_state’:
src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
         return r < 0 ? r : state;
                ^
src/shared/install.c:1796:13: note: ‘r’ was declared here
         int r;
             ^
2015-03-27 14:57:38 +01:00
Zbigniew Jędrzejewski-Szmek b4e3d5e14c networkctl: avoid leak if a field was specified twice
The input data would have to be borked, so this is unlikely to happen,
but since we have a nice helper function to do it properly... why not?

CID #1261390.
2015-03-07 14:06:35 -05:00
Alin Rauta 0d4ad91dd4 networkd: add support for Uplink Failure Detection
Introduce BindCarrier= to indicate the set of links that determine if
the current link should be brought UP or DOWN.

[tomegun: add a bit to commit message]
2015-02-27 13:58:30 -05:00
Zbigniew Jędrzejewski-Szmek d9000fd3b3 man: add networkctl(1) 2015-01-19 21:44:53 -05:00
Zbigniew Jędrzejewski-Szmek ba52f15a58 networkctl: avoid potential use of unitialized variables
Those values are based on a file we read from disk, so we should
verify everything we receive, and make sure everything we print
is sensible.

Also, print fractional seconds for TTL.
2015-01-01 13:36:44 -05:00
Zbigniew Jędrzejewski-Szmek 1bf7dd6e7d networkctl: remove unused variable 2015-01-01 13:36:43 -05:00
Zbigniew Jędrzejewski-Szmek ef75325319 network: fix scanf/printf format
usec_t is defined as 64 bit wide, but long is 32 bit on many archs.
2015-01-01 13:36:43 -05:00
David Herrmann fbee1d8587 networkctl: fix strappend() error checking
Make sure to test the right variable for NULL.
2014-12-31 15:56:11 +01:00
Tom Gundersen 19727828d2 networkctl: lldp - respect arg_legend 2014-12-19 08:33:46 +01:00
Susant Sahani 49699bac94 LLDP: Add support for networkctl 2014-12-19 08:15:05 +05:30
Tom Gundersen 266b538958 networkctl: port to verbs helper 2014-12-19 03:16:45 +01:00
Tom Gundersen 81fd1dd3a2 networkctl: port from libudev to sd-hwdb 2014-12-15 20:40:09 +01:00
Thomas Hindoe Paaboel Andersen b7378b89d2 networkctl: remove unused variable 2014-12-12 21:57:44 +01:00
Lennart Poettering b1acce80cd networkctl: also draw a nice unicode cirlce when "networkctl status" is run without parameters 2014-12-12 19:11:35 +01:00
Lennart Poettering 1693a943ca networkctl: show interface names next to IP addresses if we dump adresses from all interfaces 2014-12-12 19:07:26 +01:00
Lennart Poettering 69fb1176c4 networkctl: also show gateway address when "networkctl status" without further arguments is passed 2014-12-12 18:57:15 +01:00
Lennart Poettering 888943fc62 networkctl: show MAC address OUI vendor next to MAC addresses 2014-12-12 18:56:35 +01:00
Tom Gundersen b6a3ca6d87 networkctl: use the shared functions for enumerating the local gateways 2014-12-04 12:19:27 +01:00
Lennart Poettering 1d050e1e0a rtnl: when querying local addresses and gateways, take address family into account 2014-12-04 01:42:42 +01:00
Thomas Hindoe Paaboel Andersen 6c03d27d9f networkctl: remove unused variable 2014-12-03 23:51:56 +01:00
Torstein Husebø 144232a8e0 networkd: fix typo
V2: found another one
2014-12-03 21:36:10 +01:00
Tom Gundersen d8500c5378 shared: add format helpers for printing MAC addresses
Use these in networctl.
2014-12-02 14:31:16 +01:00
Tom Gundersen c09da72900 networkctl: print the Gateway in the status output
This is the IP address of the default route on the link, if present. A
description is printed when available (the manufacturer of the gateway NIC based
on its MAC address).

In the future we should prefer LLDP information over MAC info.
2014-12-02 10:46:22 +01:00
Michal Schmidt 4a62c710b6 treewide: another round of simplifications
Using the same scripts as in f647962d64 "treewide: yet more log_*_errno
+ return simplifications".
2014-11-28 19:57:32 +01:00
Michal Schmidt 56f64d9576 treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.
2014-11-28 19:49:27 +01:00
Michal Schmidt f647962d64 treewide: yet more log_*_errno + return simplifications
Using:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
 'local $/;
  local $_=<>;
  s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg;
  print;'
 $f
done

And a couple of manual whitespace fixups.
2014-11-28 18:56:16 +01:00
Michal Schmidt da927ba997 treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
2014-11-28 13:29:21 +01:00
Michal Schmidt 0a1beeb642 treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:

find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'

Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
2014-11-28 12:04:41 +01:00
Tom Gundersen af5effc422 networkctl: show the link file applied to each link 2014-09-08 15:09:08 +02:00
Tom Gundersen 373d9f173f networkctl: show the network file applied to each link 2014-09-08 15:09:07 +02:00
Zbigniew Jędrzejewski-Szmek ddb7f7fc07 networkctl: do not mix dns and ntp servers 2014-08-28 09:41:29 -04:00
Thomas Hindoe Paaboel Andersen a6a4f52889 networkctl: use safe_qsort in case no links are present
Unlikely to happen but still...
2014-08-16 23:49:36 +02:00
Lennart Poettering c627729fc4 networkctl: show acquired system domains 2014-08-15 16:02:29 +02:00
Lennart Poettering 1405434b69 networkctl: two OOM fixes 2014-08-15 15:34:56 +02:00
Tom Gundersen 67272d157a sd-network: add support for wildcard domains 2014-08-15 15:15:24 +02:00
Lennart Poettering db73295acc util: never use ether_ntoa(), since it formats with %x, not %02x, which makes ethernet addresses look funny 2014-08-15 13:19:03 +02:00
Lennart Poettering 3e3db0ee86 networkctl: increase column width for link type to 18, to accomodate for 'ieee80211_radiotap' 2014-08-15 13:19:03 +02:00