summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--man/machinectl.xml2
-rw-r--r--src/basic/ether-addr-util.c11
-rw-r--r--src/basic/ether-addr-util.h7
-rw-r--r--src/basic/hostname-util.c5
-rw-r--r--src/machine/machinectl.c2
-rw-r--r--src/network/networkctl.c47
6 files changed, 51 insertions, 23 deletions
diff --git a/man/machinectl.xml b/man/machinectl.xml
index 8d65155d9e..967ca01470 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -933,7 +933,7 @@
<title>Download a Fedora image, set a root password in it, start
it as service</title>
- <programlisting># machinectl pull-raw --verify=no http://ftp.halifax.rwth-aachen.de/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.raw.xz
+ <programlisting># machinectl pull-raw --verify=no https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.raw.xz
# systemd-nspawn -M Fedora-Cloud-Base-23-20151030
# passwd
# exit
diff --git a/src/basic/ether-addr-util.c b/src/basic/ether-addr-util.c
index d2c030903b..a4d8d656da 100644
--- a/src/basic/ether-addr-util.c
+++ b/src/basic/ether-addr-util.c
@@ -43,17 +43,6 @@ char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR
return buffer;
}
-bool ether_addr_is_null(const struct ether_addr *addr) {
- assert(addr);
-
- return addr->ether_addr_octet[0] == 0 &&
- addr->ether_addr_octet[1] == 0 &&
- addr->ether_addr_octet[2] == 0 &&
- addr->ether_addr_octet[3] == 0 &&
- addr->ether_addr_octet[4] == 0 &&
- addr->ether_addr_octet[5] == 0;
-}
-
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b) {
assert(a);
assert(b);
diff --git a/src/basic/ether-addr-util.h b/src/basic/ether-addr-util.h
index 00c5159fe8..074363793e 100644
--- a/src/basic/ether-addr-util.h
+++ b/src/basic/ether-addr-util.h
@@ -28,5 +28,10 @@
#define ETHER_ADDR_TO_STRING_MAX (3*6)
char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]);
-bool ether_addr_is_null(const struct ether_addr *addr);
bool ether_addr_equal(const struct ether_addr *a, const struct ether_addr *b);
+
+#define ETHER_ADDR_NULL ((const struct ether_addr){})
+
+static inline bool ether_addr_is_null(const struct ether_addr *addr) {
+ return ether_addr_equal(addr, &ETHER_ADDR_NULL);
+}
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index a30cc86456..3cd2f2c872 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -48,8 +48,9 @@ bool hostname_is_set(void) {
char* gethostname_malloc(void) {
struct utsname u;
- /* This call tries to return something useful, either the actual hostname or it makes something up. The only
- * reason it might mail is OOM. It might even return "localhost" if that's set. */
+ /* This call tries to return something useful, either the actual hostname
+ * or it makes something up. The only reason it might fail is OOM.
+ * It might even return "localhost" if that's set. */
assert_se(uname(&u) >= 0);
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 908ae1c2bb..492d35f86f 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1763,7 +1763,7 @@ static int transfer_image_common(sd_bus *bus, sd_bus_message *m) {
r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
- log_error("Failed transfer image: %s", bus_error_message(&error, -r));
+ log_error("Failed to transfer image: %s", bus_error_message(&error, -r));
return r;
}
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index d1aec9a7dc..07ac15f478 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -901,10 +901,43 @@ static char *lldp_capabilities_to_string(uint16_t x) {
return ret;
}
+static void lldp_capabilities_legend(uint16_t x) {
+ unsigned w, i, cols = columns();
+ static const char const* table[] = {
+ "o - Other",
+ "p - Repeater",
+ "b - Bridge",
+ "w - WLAN Access Point",
+ "r - Router",
+ "t - Telephone",
+ "d - DOCSIS cable device",
+ "a - Station",
+ "c - Customer VLAN",
+ "s - Service VLAN",
+ "m - Two-port MAC Relay (TPMR)",
+ };
+
+ if (x == 0)
+ return;
+
+ printf("\nCapability Flags:\n");
+ for (w = 0, i = 0; i < ELEMENTSOF(table); i++)
+ if (x & (1U << i) || arg_all) {
+ bool newline;
+
+ newline = w + strlen(table[i]) + (w == 0 ? 0 : 2) > cols;
+ if (newline)
+ w = 0;
+ w += printf("%s%s%s", newline ? "\n" : "", w == 0 ? "" : "; ", table[i]);
+ }
+ puts("");
+}
+
static int link_lldp_status(int argc, char *argv[], void *userdata) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
_cleanup_free_ LinkInfo *links = NULL;
int i, r, c, m = 0;
+ uint16_t all = 0;
r = sd_netlink_open(&rtnl);
if (r < 0)
@@ -982,8 +1015,10 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
port_description = pdesc;
}
- if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0)
+ if (sd_lldp_neighbor_get_enabled_capabilities(n, &cc) >= 0) {
capabilities = lldp_capabilities_to_string(cc);
+ all |= cc;
+ }
printf("%-16s %-17s %-16s %-11s %-17s %-16s\n",
links[i].name,
@@ -997,12 +1032,10 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
}
}
- if (arg_legend)
- printf("\nCapability Flags:\n"
- "o - Other; p - Repeater; b - Bridge; w - WLAN Access Point; r - Router;\n"
- "t - Telephone; d - DOCSIS cable device; a - Station; c - Customer VLAN;\n"
- "s - Service VLAN, m - Two-port MAC Relay (TPMR)\n\n"
- "%i neighbors listed.\n", m);
+ if (arg_legend) {
+ lldp_capabilities_legend(all);
+ printf("\n%i neighbors listed.\n", m);
+ }
return 0;
}