Compare commits

...
7 changed files with 29 additions and 13 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 tested alpha code, it is NOT YET PRODUCTION READY. Test
reports would be greatly valued. 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 version 2.59
Fix regression in 2.58 which caused failure to start up 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. # unsubstituted VERSION, but no git available.
echo UNKNOWN echo UNKNOWN
else 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 if [ $? -eq 0 ]; then
echo ${vers#v} echo "${vers}" | head -n 1 | tail -c +2
else else
cat VERSION cat VERSION
fi fi
+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) void send_event(int fd, int event, int data, char *msg)
{ {
struct event_desc ev; 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 make_icmp_sock(void);
int icmp_ping(struct in_addr addr); int icmp_ping(struct in_addr addr);
#endif #endif
void send_alarm(void);
void send_event(int fd, int event, int data, char *msg); void send_event(int fd, int event, int data, char *msg);
void clear_cache_and_reload(time_t now); void clear_cache_and_reload(time_t now);
void poll_resolv(int force, int do_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; 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));
} }
} }
+1 -1
View File
@@ -348,7 +348,7 @@ static void nl_routechange(struct nlmsghdr *h)
ra_start_unsolicted(dnsmasq_time()); ra_start_unsolicted(dnsmasq_time());
/* cause lease_update_file to run after we return, in case we were called from /* cause lease_update_file to run after we return, in case we were called from
iface_enumerate and can't re-enter it now */ iface_enumerate and can't re-enter it now */
alarm(1); send_alarm();
} }
#endif #endif
+11 -10
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;
@@ -41,7 +42,7 @@ static int iface_search(struct in6_addr *local, int prefix,
int scope, int if_index, int dad, void *vparam); 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 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; static time_t ra_short_period_start;
void ra_init(time_t now) void ra_init(time_t now)
@@ -53,16 +54,14 @@ void ra_init(time_t now)
int class = IPTOS_CLASS_CS6; int class = IPTOS_CLASS_CS6;
#endif #endif
int val = 255; /* radvd uses this value */ int val = 255; /* radvd uses this value */
size_t len1 = sizeof(int); size_t len = sizeof(int);
size_t len2 = sizeof(int);
ICMP6_FILTER_SETBLOCKALL(&filter); ICMP6_FILTER_SETBLOCKALL(&filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter); ICMP6_FILTER_SETPASS(ND_ROUTER_SOLICIT, &filter);
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter); ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filter);
if ((fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1 || 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_UNICAST_HOPS, &hop_limit, &len) ||
getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &multicast_hop_limit, &len2) ||
#if defined(IP_TOS) && defined(IPTOS_CLASS_CS6) #if defined(IP_TOS) && defined(IPTOS_CLASS_CS6)
setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 || setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &class, sizeof(class)) == -1 ||
#endif #endif
@@ -104,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;
} }
@@ -198,7 +196,7 @@ static void send_ra(int iface, char *iface_name, struct in6_addr *dest)
ra->type = ICMP6_ROUTER_ADVERT; ra->type = ICMP6_ROUTER_ADVERT;
ra->code = 0; ra->code = 0;
ra->hop_limit = dest ? unicast_hop_limit : multicast_hop_limit; ra->hop_limit = hop_limit;
ra->flags = 0; ra->flags = 0;
ra->lifetime = htons(1800); /* AdvDefaultLifetime*/ ra->lifetime = htons(1800); /* AdvDefaultLifetime*/
ra->reachable_time = 0; 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 */ /* 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)
@@ -401,7 +402,7 @@ static int iface_search(struct in6_addr *local, int prefix,
int scope, int if_index, int dad, void *vparam) int scope, int if_index, int dad, void *vparam)
{ {
struct search_param *param = vparam; struct search_param *param = vparam;
struct dhcp_context *context, *tmp; struct dhcp_context *context;
(void)scope; (void)scope;
(void)dad; (void)dad;