Compare commits

..
8 changed files with 40 additions and 23 deletions

No files matched your search

+6
View File
@@ -58,6 +58,12 @@ version 2.60
tested alpha code, it is NOT YET PRODUCTION READY. Test
reports would be greatly valued.
Support IPv6 router advertisements. This is a
simple-minded implementation, aimed at providing the
vestigial RA needed to go alongside IPv6. Is picks up
configuration from the DHCPv6 conf, and should just need
enabling with --enable-ra.
version 2.59
Fix regression in 2.58 which caused failure to start up
+2 -2
View File
@@ -18,10 +18,10 @@ elif grep '\$Format:%d\$' VERSION >/dev/null 2>&1; then
# unsubstituted VERSION, but no git available.
echo UNKNOWN
else
vers=`cat VERSION | sed 's/[(), ]/\n/ g' | grep $v[0-9] | head -n 1`
vers=`cat VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep $v[0-9]`
if [ $? -eq 0 ]; then
echo ${vers#v}
echo "${vers}" | head -n 1 | tail -c +2
else
cat VERSION
fi
+9 -8
View File
@@ -101,13 +101,6 @@ static int join_multicast(struct in6_addr *local, int prefix,
if (if_index == listenp->fd_or_iface)
return 1;
mreq.ipv6mr_interface = if_index;
inet_pton(AF_INET6, ALL_ROUTERS, &mreq.ipv6mr_multiaddr);
if (daemon->icmp6fd != -1 &&
setsockopt(daemon->icmp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
return 0;
if (!indextoname(fd, if_index, ifrn_name))
return 0;
@@ -126,7 +119,9 @@ static int join_multicast(struct in6_addr *local, int prefix,
if (!context)
return 1;
mreq.ipv6mr_interface = if_index;
inet_pton(AF_INET6, ALL_RELAY_AGENTS_AND_SERVERS, &mreq.ipv6mr_multiaddr);
if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
@@ -137,6 +132,12 @@ static int join_multicast(struct in6_addr *local, int prefix,
if (setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
return 0;
inet_pton(AF_INET6, ALL_ROUTERS, &mreq.ipv6mr_multiaddr);
if (daemon->icmp6fd != -1 &&
setsockopt(daemon->icmp6fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1)
return 0;
listenp = whine_malloc(sizeof(struct listen_param));
listenp->fd_or_iface = if_index;
listenp->next = param->next;
+5
View File
@@ -831,6 +831,11 @@ static void sig_handler(int sig)
}
}
void send_alarm(void)
{
send_event(pipewrite, EVENT_ALARM, 0, NULL);
}
void send_event(int fd, int event, int data, char *msg)
{
struct event_desc ev;
+1
View File
@@ -967,6 +967,7 @@ unsigned char *extended_hwaddr(int hwtype, int hwlen, unsigned char *hwaddr,
int make_icmp_sock(void);
int icmp_ping(struct in_addr addr);
#endif
void send_alarm(void);
void send_event(int fd, int event, int data, char *msg);
void clear_cache_and_reload(time_t now);
void poll_resolv(int force, int do_reload, time_t now);
+3
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));
}
}
+1 -1
View File
@@ -348,7 +348,7 @@ static void nl_routechange(struct nlmsghdr *h)
ra_start_unsolicted(dnsmasq_time());
/* cause lease_update_file to run after we return, in case we were called from
iface_enumerate and can't re-enter it now */
alarm(1);
send_alarm();
}
#endif
+13 -12
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;
@@ -41,7 +42,7 @@ static int iface_search(struct in6_addr *local, int prefix,
int scope, int if_index, int dad, void *vparam);
static int add_lla(int index, unsigned int type, char *mac, size_t maclen, void *parm);
static int unicast_hop_limit, multicast_hop_limit;
static int hop_limit;
static time_t ra_short_period_start;
void ra_init(time_t now)
@@ -53,16 +54,14 @@ void ra_init(time_t now)
int class = IPTOS_CLASS_CS6;
#endif
int val = 255; /* radvd uses this value */
size_t len1 = sizeof(int);
size_t len2 = sizeof(int);
size_t len = sizeof(int);
ICMP6_FILTER_SETBLOCKALL(&filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter);
if ((fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1 ||
getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &unicast_hop_limit, &len1) ||
getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &multicast_hop_limit, &len2) ||
getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hop_limit, &len) ||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
#endif
@@ -104,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;
}
@@ -198,7 +196,7 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
ra->type = ICMP6_ROUTER_ADVERT;
ra->code = 0;
ra->hop_limit = dest ? unicast_hop_limit : multicast_hop_limit;
ra->hop_limit = hop_limit;
ra->flags = 0;
ra->lifetime = htons(1800); /* AdvDefaultLifetime*/
ra->reachable_time = 0;
@@ -243,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)
@@ -253,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);
@@ -401,7 +402,7 @@ static int iface_search(struct in6_addr *local, int prefix,
int scope, int if_index, int dad, void *vparam)
{
struct search_param *param = vparam;
struct dhcp_context *context, *tmp;
struct dhcp_context *context;
(void)scope;
(void)dad;