summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-05-04 20:14:08 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-05-07 16:55:19 +0200
commit67a4683364e802e5b5566ca1a144228e87024739 (patch)
treeb6bb45fae920e508a8111b6aa41e3ddc150c3087 /src/network
parentce2ea782c287d4055b24b95bd02d1326b0482b3b (diff)
downloadsystemd-67a4683364e802e5b5566ca1a144228e87024739.tar.gz
network: use IN_ADDR_NULL and ETHER_ADDR_NULL
The change in manager_rtnl_process_address() may not be necessary, but for safety, let's initialize the value.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkctl.c6
-rw-r--r--src/network/networkd-address.c2
-rw-r--r--src/network/networkd-manager.c6
-rw-r--r--src/network/test-network.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/src/network/networkctl.c b/src/network/networkctl.c
index 3881aaa42b..eb3521b794 100644
--- a/src/network/networkctl.c
+++ b/src/network/networkctl.c
@@ -320,8 +320,8 @@ static int get_gateway_description(
return r;
for (m = reply; m; m = sd_netlink_message_next(m)) {
- union in_addr_union gw = {};
- struct ether_addr mac = {};
+ union in_addr_union gw = IN_ADDR_NULL;
+ struct ether_addr mac = ETHER_ADDR_NULL;
uint16_t type;
int ifi, fam;
@@ -514,7 +514,7 @@ static int dump_address_labels(sd_netlink *rtnl) {
for (m = reply; m; m = sd_netlink_message_next(m)) {
_cleanup_free_ char *pretty = NULL;
- union in_addr_union prefix = {};
+ union in_addr_union prefix = IN_ADDR_NULL;
uint8_t prefixlen;
uint32_t label;
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 42d61cc0e5..600bad474d 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -490,7 +490,7 @@ int address_remove(
}
static int address_acquire(Link *link, Address *original, Address **ret) {
- union in_addr_union in_addr = {};
+ union in_addr_union in_addr = IN_ADDR_NULL;
struct in_addr broadcast = {};
_cleanup_(address_freep) Address *na = NULL;
int r;
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 13e3d7f200..a842d131a5 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -266,7 +266,7 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
unsigned char protocol, scope, tos, table, rt_type;
int family;
unsigned char dst_prefixlen, src_prefixlen;
- union in_addr_union dst = {}, gw = {}, src = {}, prefsrc = {};
+ union in_addr_union dst = IN_ADDR_NULL, gw = IN_ADDR_NULL, src = IN_ADDR_NULL, prefsrc = IN_ADDR_NULL;
Route *route = NULL;
int r;
@@ -484,7 +484,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
int family;
unsigned char prefixlen;
unsigned char scope;
- union in_addr_union in_addr;
+ union in_addr_union in_addr = IN_ADDR_NULL;
struct ifa_cacheinfo cinfo;
Address *address = NULL;
char buf[INET6_ADDRSTRLEN], valid_buf[FORMAT_TIMESPAN_MAX];
@@ -728,7 +728,7 @@ static int manager_rtnl_process_link(sd_netlink *rtnl, sd_netlink_message *messa
int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, void *userdata) {
uint8_t tos = 0, to_prefixlen = 0, from_prefixlen = 0, protocol = 0;
struct fib_rule_port_range sport = {}, dport = {};
- union in_addr_union to = {}, from = {};
+ union in_addr_union to = IN_ADDR_NULL, from = IN_ADDR_NULL;
RoutingPolicyRule *rule = NULL;
uint32_t fwmark = 0, table = 0;
const char *iif = NULL, *oif = NULL;
diff --git a/src/network/test-network.c b/src/network/test-network.c
index 6e169e0fca..21ee97e84e 100644
--- a/src/network/test-network.c
+++ b/src/network/test-network.c
@@ -121,7 +121,7 @@ static int test_load_config(Manager *manager) {
static void test_network_get(Manager *manager, sd_device *loopback) {
Network *network;
- const struct ether_addr mac = {};
+ const struct ether_addr mac = ETHER_ADDR_NULL;
/* let's assume that the test machine does not have a .network file
that applies to the loopback device... */