diff options
| author | Roy Marples <roy@marples.name> | 2019-04-24 12:18:25 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2019-04-24 12:18:25 +0100 |
| commit | 4d53b9d9bb2734b50c884978838b140a9266fa78 (patch) | |
| tree | 7c64605ae75cde1455070639f1eff5afad241393 | |
| parent | f96f6447a6b3adfd17ad2c07ca08154c4751b872 (diff) | |
| download | dhcpcd-4d53b9d9bb2734b50c884978838b140a9266fa78.tar.xz | |
IPv6ND: Use generic initialisers rather than inet_pton
| -rw-r--r-- | src/ipv6.h | 3 | ||||
| -rw-r--r-- | src/ipv6nd.c | 16 |
2 files changed, 6 insertions, 13 deletions
@@ -44,9 +44,6 @@ # endif #endif -#define ALLNODES "ff02::1" -#define ALLROUTERS "ff02::2" - #define EUI64_GBIT 0x01 #define EUI64_UBIT 0x02 #define EUI64_TO_IFID(in6) do {(in6)->s6_addr[8] ^= EUI64_UBIT; } while (0) diff --git a/src/ipv6nd.c b/src/ipv6nd.c index e8a06182..076f1864 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -332,7 +332,11 @@ ipv6nd_sendrsprobe(void *arg) { struct interface *ifp = arg; struct rs_state *state = RS_STATE(ifp); - struct sockaddr_in6 dst = { .sin6_family = AF_INET6 }; + struct sockaddr_in6 dst = { + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT, + .sin6_scope_id = ifp->index, + }; struct iovec iov = { .iov_base = state->rs, .iov_len = state->rslen }; unsigned char ctl[CMSG_SPACE(sizeof(struct in6_pktinfo))] = { 0 }; struct msghdr msg = { @@ -354,11 +358,6 @@ ipv6nd_sendrsprobe(void *arg) #ifdef HAVE_SA_LEN dst.sin6_len = sizeof(dst); #endif - dst.sin6_scope_id = ifp->index; - if (inet_pton(AF_INET6, ALLROUTERS, &dst.sin6_addr) != 1) { - logerr(__func__); - return; - } /* Set the outbound interface */ cm = CMSG_FIRSTHDR(&msg); @@ -403,6 +402,7 @@ ipv6nd_sendadvertisement(void *arg) struct dhcpcd_ctx *ctx = ifp->ctx; struct sockaddr_in6 dst = { .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_LINKLOCAL_ALLNODES_INIT, .sin6_scope_id = ifp->index, }; struct iovec iov = { .iov_base = ia->na, .iov_len = ia->na_len }; @@ -423,10 +423,6 @@ ipv6nd_sendadvertisement(void *arg) #ifdef SIN6_LEN dst.sin6_len = sizeof(dst); #endif - if (inet_pton(AF_INET6, ALLNODES, &dst.sin6_addr) != 1) { - logerr(__func__); - return; - } /* Set the outbound interface. */ cm = CMSG_FIRSTHDR(&msg); |
