Fix RA on *BSD (missing sa_len)

This commit is contained in:
Simon Kelley
2012-02-26 20:13:45 +00:00
parent 741c2952d4
commit 22d904db95
2 changed files with 11 additions and 5 deletions

View File

@@ -106,8 +106,11 @@ void send_from(int fd, int nowild, char *packet, size_t len,
msg.msg_controllen = 0;
goto retry;
}
if (retry_send())
goto retry;
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
}
}

View File

@@ -20,10 +20,11 @@
not used by DHCPv4 code. */
#include "dnsmasq.h"
#include <netinet/icmp6.h>
#ifdef HAVE_DHCP6
#include <netinet/icmp6.h>
struct ra_param {
int ind, managed, found_context, first;
char *if_name;
@@ -102,8 +103,7 @@ void ra_start_unsolicted(time_t now)
for (context = daemon->ra_contexts; context; context = context->next)
context->ra_time = now + (rand16()/13000);
/* re-do ras after a short time, in case the first gets lost.
This is reset once that's done. */
/* re-do frequently for a minute or so, in case the first gets lost. */
ra_short_period_start = now;
}
@@ -241,6 +241,9 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
/* decide where we're sending */
memset(&addr, 0, sizeof(addr));
#ifdef HAVE_SOCKADDR_SA_LEN
addr.sin6_len = sizeof(struct sockaddr_in6);
#endif
addr.sin6_family = AF_INET6;
addr.sin6_port = htons(IPPROTO_ICMPV6);
if (dest)
@@ -251,8 +254,8 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
addr.sin6_scope_id = iface;
}
else
inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr);
inet_pton(AF_INET6, ALL_HOSTS, &addr.sin6_addr);
send_from(daemon->icmp6fd, 0, daemon->outpacket.iov_base, save_counter(0),
(union mysockaddr *)&addr, (struct all_addr *)&parm.link_local, iface);