Mercurial > hg > dhcpcd
changeset 4476:60b8905c878e draft
IPv6ND: Use generic initialisers rather than inet_pton
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 24 Apr 2019 12:18:25 +0100 |
| parents | 0f69a209f608 |
| children | 1513ec4c83ec |
| files | src/ipv6.h src/ipv6nd.c |
| diffstat | 2 files changed, 6 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ipv6.h Wed Apr 24 11:00:57 2019 +0000 +++ b/src/ipv6.h Wed Apr 24 12:18:25 2019 +0100 @@ -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)
--- a/src/ipv6nd.c Wed Apr 24 11:00:57 2019 +0000 +++ b/src/ipv6nd.c Wed Apr 24 12:18:25 2019 +0100 @@ -332,7 +332,11 @@ { 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 @@ #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 @@ 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 @@ #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);
