summaryrefslogtreecommitdiff
path: root/src/network/networkd-fdb.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-21 17:40:18 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-21 17:43:55 +0200
commit6a7a4e4d0a057febab787a2d5d3e0b52d2db2268 (patch)
treef9cd7704d51916281290e59740934b9b40365387 /src/network/networkd-fdb.c
parentfed2b07ebc9e8694b5b326923356028f464381ce (diff)
networkd: improve how networkd logs things
This makes adds a couple of fixes: - Introduces log_netdev_error_errno() and friends, which takes an error number, and matches what log_link_error_errno() and friends do. - Replaces a lof ot strerror() usage with log_netdev_error_errno(), log_link_error_errno() and log_erro_errno() - Uppercases the first character of many log messages, after all this is supposed to be english language - Drops manual negating of error codes before passing them to log functions, the log functions all do that internally anyway. Some other minor fixes. Behaviour should not change really.
Diffstat (limited to 'src/network/networkd-fdb.c')
-rw-r--r--src/network/networkd-fdb.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c
index b6b8327b23..72ac40dee3 100644
--- a/src/network/networkd-fdb.c
+++ b/src/network/networkd-fdb.c
@@ -88,7 +88,7 @@ static int set_fdb_handler(sd_rtnl *rtnl, sd_rtnl_message *m, void *userdata) {
r = sd_rtnl_message_get_errno(m);
if (r < 0 && r != -EEXIST)
- log_link_error(link, "Could not add FDB entry: %s", strerror(-r));
+ log_link_error_errno(link, r, "Could not add FDB entry: %m");
return 1;
}
@@ -133,10 +133,8 @@ int fdb_entry_configure(Link *const link, FdbEntry *const fdb_entry) {
/* send message to the kernel to update its internal static MAC table. */
r = sd_rtnl_call_async(rtnl, req, set_fdb_handler, link, 0, NULL);
- if (r < 0) {
- log_link_error(link, "Could not send rtnetlink message: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
return 0;
}
@@ -182,10 +180,8 @@ int config_parse_fdb_hwaddr(const char *unit,
assert(data);
r = fdb_entry_new_static(network, section_line, &fdb_entry);
- if (r < 0) {
- log_error("Failed to allocate a new FDB entry: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_oom();
/* read in the MAC address for the FDB table. */
r = sscanf(rvalue, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
@@ -229,18 +225,14 @@ int config_parse_fdb_vlan_id(const char *unit,
assert(data);
r = fdb_entry_new_static(network, section_line, &fdb_entry);
- if (r < 0) {
- log_error("Failed to allocate a new FDB entry: %s", strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_oom();
r = config_parse_unsigned(unit, filename, line, section,
section_line, lvalue, ltype,
rvalue, &fdb_entry->vlan_id, userdata);
- if (r < 0) {
- log_error("Failed to parse the unsigned integer: %s", strerror(-r));
+ if (r < 0)
return r;
- }
fdb_entry = NULL;