diff options
-rw-r--r-- | src/libsystemd-network/dhcp6-protocol.h | 8 | ||||
-rw-r--r-- | src/libsystemd-network/fuzz-ndisc-rs.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/icmp6-util.c | 4 | ||||
-rw-r--r-- | src/libsystemd-network/icmp6-util.h | 16 | ||||
-rw-r--r-- | src/libsystemd-network/sd-dhcp6-client.c | 4 | ||||
-rw-r--r-- | src/libsystemd-network/sd-ndisc.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/sd-radv.c | 2 | ||||
-rw-r--r-- | src/libsystemd-network/test-dhcp6-client.c | 3 | ||||
-rw-r--r-- | src/libsystemd-network/test-ndisc-send.c | 4 |
9 files changed, 24 insertions, 21 deletions
diff --git a/src/libsystemd-network/dhcp6-protocol.h b/src/libsystemd-network/dhcp6-protocol.h index c70f93203d..ab75bad434 100644 --- a/src/libsystemd-network/dhcp6-protocol.h +++ b/src/libsystemd-network/dhcp6-protocol.h @@ -28,9 +28,11 @@ typedef struct DHCP6Message DHCP6Message; #define DHCP6_MIN_OPTIONS_SIZE \ 1280 - sizeof(struct ip6_hdr) - sizeof(struct udphdr) -#define IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT \ - { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02 } } } +#define IN6_ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS \ + ((const struct in6_addr) { { { \ + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, \ + } } } ) enum { DHCP6_PORT_SERVER = 547, diff --git a/src/libsystemd-network/fuzz-ndisc-rs.c b/src/libsystemd-network/fuzz-ndisc-rs.c index c52043a13b..ae780f4382 100644 --- a/src/libsystemd-network/fuzz-ndisc-rs.c +++ b/src/libsystemd-network/fuzz-ndisc-rs.c @@ -37,7 +37,7 @@ static void test_with_sd_ndisc(const uint8_t *data, size_t size) { static void test_with_icmp6_packet(const uint8_t *data, size_t size) { static const struct sockaddr_in6 dst = { .sin6_family = AF_INET6, - .sin6_addr = IN6ADDR_ALL_ROUTERS_MULTICAST_INIT, + .sin6_addr = IN6_ADDR_ALL_ROUTERS_MULTICAST, }; _cleanup_close_pair_ int fd_pair[2] = EBADF_PAIR; diff --git a/src/libsystemd-network/icmp6-util.c b/src/libsystemd-network/icmp6-util.c index d4b7ae5855..804da7652e 100644 --- a/src/libsystemd-network/icmp6-util.c +++ b/src/libsystemd-network/icmp6-util.c @@ -33,13 +33,13 @@ int icmp6_bind(int ifindex, bool is_router) { ICMP6_FILTER_SETBLOCKALL(&filter); if (is_router) { mreq = (struct ipv6_mreq) { - .ipv6mr_multiaddr = IN6ADDR_ALL_ROUTERS_MULTICAST_INIT, + .ipv6mr_multiaddr = IN6_ADDR_ALL_ROUTERS_MULTICAST, .ipv6mr_interface = ifindex, }; ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter); } else { mreq = (struct ipv6_mreq) { - .ipv6mr_multiaddr = IN6ADDR_ALL_NODES_MULTICAST_INIT, + .ipv6mr_multiaddr = IN6_ADDR_ALL_NODES_MULTICAST, .ipv6mr_interface = ifindex, }; ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter); diff --git a/src/libsystemd-network/icmp6-util.h b/src/libsystemd-network/icmp6-util.h index 49cdcba3ff..74acd4124c 100644 --- a/src/libsystemd-network/icmp6-util.h +++ b/src/libsystemd-network/icmp6-util.h @@ -12,13 +12,17 @@ #include "time-util.h" -#define IN6ADDR_ALL_ROUTERS_MULTICAST_INIT \ - { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 } } } +#define IN6_ADDR_ALL_ROUTERS_MULTICAST \ + ((const struct in6_addr) { { { \ + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, \ + } } } ) -#define IN6ADDR_ALL_NODES_MULTICAST_INIT \ - { { { 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 } } } +#define IN6_ADDR_ALL_NODES_MULTICAST \ + ((const struct in6_addr) { { { \ + 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, \ + } } } ) int icmp6_bind(int ifindex, bool is_router); int icmp6_send(int fd, const struct sockaddr_in6 *dst, const struct iovec *iov, size_t n_iov); diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 229ceef783..9f14a32896 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -743,8 +743,6 @@ static int client_append_mudurl(sd_dhcp6_client *client, uint8_t **buf, size_t * int dhcp6_client_send_message(sd_dhcp6_client *client) { _cleanup_free_ uint8_t *buf = NULL; - struct in6_addr all_servers = - IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT; struct sd_dhcp6_option *j; usec_t elapsed_usec, time_now; be16_t elapsed_time; @@ -839,7 +837,7 @@ int dhcp6_client_send_message(sd_dhcp6_client *client) { if (r < 0) return r; - r = dhcp6_network_send_udp_socket(client->fd, &all_servers, buf, offset); + r = dhcp6_network_send_udp_socket(client->fd, &IN6_ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS, buf, offset); if (r < 0) return r; diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index cba9470ce0..faa0ea2701 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -343,7 +343,7 @@ static int ndisc_recv(sd_event_source *s, int fd, uint32_t revents, void *userda static int ndisc_send_router_solicitation(sd_ndisc *nd) { static const struct sockaddr_in6 dst = { .sin6_family = AF_INET6, - .sin6_addr = IN6ADDR_ALL_ROUTERS_MULTICAST_INIT, + .sin6_addr = IN6_ADDR_ALL_ROUTERS_MULTICAST, }; static const struct nd_router_solicit header = { .nd_rs_type = ND_ROUTER_SOLICIT, diff --git a/src/libsystemd-network/sd-radv.c b/src/libsystemd-network/sd-radv.c index cde45388b7..316fcf1d2b 100644 --- a/src/libsystemd-network/sd-radv.c +++ b/src/libsystemd-network/sd-radv.c @@ -134,7 +134,7 @@ static int radv_send_router(sd_radv *ra, const struct in6_addr *dst, usec_t life struct sockaddr_in6 dst_addr = { .sin6_family = AF_INET6, - .sin6_addr = IN6ADDR_ALL_NODES_MULTICAST_INIT, + .sin6_addr = IN6_ADDR_ALL_NODES_MULTICAST, }; struct nd_router_advert adv = { .nd_ra_type = ND_ROUTER_ADVERT, diff --git a/src/libsystemd-network/test-dhcp6-client.c b/src/libsystemd-network/test-dhcp6-client.c index a987a17806..37d5a0cf6c 100644 --- a/src/libsystemd-network/test-dhcp6-client.c +++ b/src/libsystemd-network/test-dhcp6-client.c @@ -59,8 +59,7 @@ static const struct in6_addr local_address = { { { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, } } }; -static const struct in6_addr mcast_address = - IN6ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS_INIT; +static const struct in6_addr mcast_address = IN6_ADDR_ALL_DHCP6_RELAY_AGENTS_AND_SERVERS; static const struct in6_addr ia_na_address1 = { { { IA_NA_ADDRESS1_BYTES } } }; static const struct in6_addr ia_na_address2 = { { { IA_NA_ADDRESS2_BYTES } } }; static const struct in6_addr ia_pd_prefix1 = { { { IA_PD_PREFIX1_BYTES } } }; diff --git a/src/libsystemd-network/test-ndisc-send.c b/src/libsystemd-network/test-ndisc-send.c index 71e445c7e7..7b9c0e5f17 100644 --- a/src/libsystemd-network/test-ndisc-send.c +++ b/src/libsystemd-network/test-ndisc-send.c @@ -289,9 +289,9 @@ static int parse_argv(int argc, char *argv[]) { if (in6_addr_is_null(&arg_dest.in6)) { if (IN_SET(arg_icmp6_type, ND_ROUTER_ADVERT, ND_NEIGHBOR_ADVERT, ND_REDIRECT)) - arg_dest.in6 = (struct in6_addr) IN6ADDR_ALL_NODES_MULTICAST_INIT; + arg_dest.in6 = IN6_ADDR_ALL_NODES_MULTICAST; else - arg_dest.in6 = (struct in6_addr) IN6ADDR_ALL_ROUTERS_MULTICAST_INIT; + arg_dest.in6 = IN6_ADDR_ALL_ROUTERS_MULTICAST; } if (arg_set_source_mac) { |