diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2017-01-31 22:07:08 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2017-01-31 22:07:27 +0100 |
commit | 83d72cf224956eb08453051744649df89b217203 (patch) | |
tree | a81eb91dd77fe86f075697917bd9b20dda22d528 /src/odhcpd.c | |
parent | c4f9ace5560562d3ba7dfefb9e422240d594a460 (diff) |
odhcpd: fix coding style
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/odhcpd.c')
-rw-r--r-- | src/odhcpd.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/odhcpd.c b/src/odhcpd.c index bf1d496..b1e89b3 100644 --- a/src/odhcpd.c +++ b/src/odhcpd.c @@ -292,19 +292,20 @@ out: int odhcpd_get_linklocal_interface_address(int ifindex, struct in6_addr *lladdr) { - int status = -1; - struct sockaddr_in6 addr = {AF_INET6, 0, 0, ALL_IPV6_ROUTERS, ifindex}; - socklen_t alen = sizeof(addr); - int sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); - - if (!connect(sock, (struct sockaddr*)&addr, sizeof(addr)) && - !getsockname(sock, (struct sockaddr*)&addr, &alen)) { - *lladdr = addr.sin6_addr; - status = 0; - } + int status = -1; + struct sockaddr_in6 addr = {AF_INET6, 0, 0, ALL_IPV6_ROUTERS, ifindex}; + socklen_t alen = sizeof(addr); + int sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); + + if (!connect(sock, (struct sockaddr*)&addr, sizeof(addr)) && + !getsockname(sock, (struct sockaddr*)&addr, &alen)) { + *lladdr = addr.sin6_addr; + status = 0; + } + + close(sock); - close(sock); - return status; + return status; } void odhcpd_setup_route(const struct in6_addr *addr, int prefixlen, |