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; msg.msg_controllen = 0;
goto retry; goto retry;
} }
if (retry_send()) if (retry_send())
goto retry; goto retry;
my_syslog(LOG_ERR, _("failed to send packet: %s"), strerror(errno));
} }
} }

View File

@@ -20,10 +20,11 @@
not used by DHCPv4 code. */ not used by DHCPv4 code. */
#include "dnsmasq.h" #include "dnsmasq.h"
#include <netinet/icmp6.h>
#ifdef HAVE_DHCP6 #ifdef HAVE_DHCP6
#include <netinet/icmp6.h>
struct ra_param { struct ra_param {
int ind, managed, found_context, first; int ind, managed, found_context, first;
char *if_name; char *if_name;
@@ -102,8 +103,7 @@ void ra_start_unsolicted(time_t now)
for (context = daemon->ra_contexts; context; context = context->next) for (context = daemon->ra_contexts; context; context = context->next)
context->ra_time = now + (rand16()/13000); context->ra_time = now + (rand16()/13000);
/* re-do ras after a short time, in case the first gets lost. /* re-do frequently for a minute or so, in case the first gets lost. */
This is reset once that's done. */
ra_short_period_start = now; 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 */ /* decide where we're sending */
memset(&addr, 0, sizeof(addr)); 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_family = AF_INET6;
addr.sin6_port = htons(IPPROTO_ICMPV6); addr.sin6_port = htons(IPPROTO_ICMPV6);
if (dest) if (dest)