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.
This commit is contained in:
parent
ce2ea782c2
commit
67a4683364
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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... */
|
||||
|
|
Loading…
Reference in New Issue