Commit Graph

233 Commits

Author SHA1 Message Date
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
Lennart Poettering 2301cb9fdb networkctl: print local domain name in status output 2014-08-15 03:10:20 +02:00
Lennart Poettering e92da1e5d0 networkctl: also use the same color logic when running "networkctl status" without arguments 2014-08-14 01:23:20 +02:00
Lennart Poettering d57c365bf8 networkctl: add the same color logic to "list" and "status" outputs
And always put operational state first, setup state second.
2014-08-14 01:18:37 +02:00
Lennart Poettering ab1525bc2d networkctl: name setup state variable setup_state 2014-08-14 01:10:08 +02:00
Lennart Poettering 2368512a31 networkctl: update column header to new 'setup' state naming 2014-08-14 01:08:46 +02:00
Tom Gundersen 438ca2bbd4 sd-networkd: rename link_get_state to link_get_setup_state
Suggested by Kay and Lennart.
2014-08-13 22:55:49 +02:00
Tom Gundersen d6731e4c79 sd-network: /_get_link_/_link_get_/
The link is the 'object', so make this in line with our usual naming convention.

Suggested by Kay and Lennart.
2014-08-13 22:37:45 +02:00
Daniel Buch 5323ead145 networkctl: color status dump without link name
Lets mimic colored operational state dump as if link name is appiled
2014-08-13 22:31:03 +02:00
Tom Gundersen 636db02d54 networkctl: add colors to admin state and fix alignment
It is useful to color in the admin state both to easily spot failed links, but also to quickly
distinguish between links that are fully configured and in degraded mode (only IPv4LL) or in
degraded mode and still waiting for DHCP.
2014-08-13 15:39:57 +02:00
Lennart Poettering f7d68aa8c9 networkctl: make networkctl status without link name show all local IP addresses 2014-08-12 16:19:37 +02:00
Lennart Poettering 6d0c65ffb4 networkctl: when outputing a list fo links, sort them by ifindex 2014-08-12 16:03:45 +02:00
Lennart Poettering df3fb561b2 networkctl: add a bit of color to the output 2014-08-12 15:41:01 +02:00
Lennart Poettering 9085f64a66 networkctl: add new switch "-a" to "networkctl status" to show verbose status of all local links 2014-08-12 15:19:30 +02:00
Lennart Poettering 1b17f21198 networkctl: properly format MAC addresses 2014-08-12 15:08:09 +02:00
Lennart Poettering 03cc0fd143 sd-network: add API to output all collected system-wide NTP and DNS servers
Also, output the collected information in "networkctl".
2014-08-12 15:06:51 +02:00
Lennart Poettering ee8c456895 networkd: add minimal client tool "networkd" to query network status
In the long run this should become a full fledged client to networkd
(but not before networkd learns bus support). For now, just pull
interesting data out of networkd, udev, and rtnl and present it to the
user, in a simple but useful output.
2014-08-12 01:54:40 +02:00