summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/random-util.c2
-rw-r--r--src/network/networkd-brvlan.c12
-rw-r--r--src/network/networkd-fdb.c7
-rw-r--r--src/network/networkd-link.c5
-rw-r--r--src/network/networkd-route.c2
5 files changed, 11 insertions, 17 deletions
diff --git a/src/basic/random-util.c b/src/basic/random-util.c
index 2f468db770..ad7b3eedf2 100644
--- a/src/basic/random-util.c
+++ b/src/basic/random-util.c
@@ -46,7 +46,7 @@ int dev_urandom(void *p, size_t n) {
* never block, and will always return some data from the
* kernel, regardless if the random pool is fully initialized
* or not. It thus makes no guarantee for the quality of the
- * returned entropy, but is good enough for or usual usecases
+ * returned entropy, but is good enough for our usual usecases
* of seeding the hash functions for hashtable */
/* Use the getrandom() syscall unless we know we don't have
diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c
index 77c08d090c..f621b8011b 100644
--- a/src/network/networkd-brvlan.c
+++ b/src/network/networkd-brvlan.c
@@ -39,12 +39,6 @@ static inline void set_bit(unsigned nr, uint32_t *addr) {
addr[nr / 32] |= (((uint32_t) 1) << (nr % 32));
}
-static inline int is_vid_valid(unsigned vid) {
- if (vid > VLANID_MAX || vid == 0)
- return -EINVAL;
- return 0;
-}
-
static int find_next_bit(int i, uint32_t x) {
int j;
@@ -240,21 +234,21 @@ static int parse_vid_range(const char *rvalue, uint16_t *vid, uint16_t *vid_end)
if (r < 0)
return r;
- if (!_vid)
+ if (_vid == 0)
return -ERANGE;
r = parse_vlanid(p, &_vid_end);
if (r < 0)
return r;
- if (!_vid_end)
+ if (_vid_end == 0)
return -ERANGE;
} else {
r = parse_vlanid(_rvalue, &_vid);
if (r < 0)
return r;
- if (!_vid)
+ if (_vid == 0)
return -ERANGE;
}
diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c
index 9829438ba2..be8aebee2d 100644
--- a/src/network/networkd-fdb.c
+++ b/src/network/networkd-fdb.c
@@ -26,6 +26,7 @@
#include "networkd-fdb.h"
#include "networkd.h"
#include "util.h"
+#include "vlan-util.h"
#define STATIC_FDB_ENTRIES_PER_NETWORK_MAX 1024U
@@ -240,9 +241,9 @@ int config_parse_fdb_vlan_id(
if (r < 0)
return log_oom();
- r = config_parse_unsigned(unit, filename, line, section,
- section_line, lvalue, ltype,
- rvalue, &fdb_entry->vlan_id, userdata);
+ r = config_parse_vlanid(unit, filename, line, section,
+ section_line, lvalue, ltype,
+ rvalue, &fdb_entry->vlan_id, userdata);
if (r < 0)
return r;
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index dce5c2be6e..0302f57f26 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -530,8 +530,7 @@ static void link_free(Link *link) {
free(link->ifname);
- if (link->kind)
- free(link->kind);
+ free(link->kind);
(void)unlink(link->state_file);
free(link->state_file);
@@ -2006,7 +2005,7 @@ static int link_joined(Link *link) {
log_link_error_errno(link, r, "Could not set bridge message: %m");
}
- if (link->network->bridge || NETDEV_KIND_BRIDGE == netdev_kind_from_string(link->kind)) {
+ if (link->network->bridge || streq("bridge", link->kind)) {
r = link_set_bridge_vlan(link);
if (r < 0)
log_link_error_errno(link, r, "Could not set bridge vlan: %m");
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 6359f967a2..52037f9c6d 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -492,7 +492,7 @@ int route_configure(
assert(route->family == AF_INET || route->family == AF_INET6);
if (route_get(link, route->family, &route->dst, route->dst_prefixlen, route->tos, route->priority, route->table, NULL) <= 0 &&
- set_size(route->link->routes) >= ROUTES_PER_LINK_MAX)
+ set_size(link->routes) >= ROUTES_PER_LINK_MAX)
return -E2BIG;
r = sd_rtnl_message_new_route(link->manager->rtnl, &req,