"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/radv.c" between
dnsmasq-2.80.tar.gz and dnsmasq-2.81.tar.xz

About: Dnsmasq is a lightweight caching DNS forwarder and DHCP server.

radv.c  (dnsmasq-2.80):radv.c  (dnsmasq-2.81.tar.xz)
/* dnsmasq is Copyright (c) 2000-2018 Simon Kelley /* dnsmasq is Copyright (c) 2000-2020 Simon Kelley
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991, or the Free Software Foundation; version 2 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007. (at your option) version 3 dated 29 June, 2007.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
skipping to change at line 290 skipping to change at line 290
iface_id.net = iface_name; iface_id.net = iface_name;
iface_id.next = NULL; iface_id.next = NULL;
parm.tags = &iface_id; parm.tags = &iface_id;
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
{ {
context->flags &= ~CONTEXT_RA_DONE; context->flags &= ~CONTEXT_RA_DONE;
context->netid.next = &context->netid; context->netid.next = &context->netid;
} }
if (!iface_enumerate(AF_INET6, &parm, add_prefixes)) /* If no link-local address then we can't advertise since source address of
advertisement must be link local address: RFC 4861 para 6.1.2. */
if (!iface_enumerate(AF_INET6, &parm, add_prefixes) ||
parm.link_pref_time == 0)
return; return;
/* Find smallest preferred time within address classes, /* Find smallest preferred time within address classes,
to use as lifetime for options. This is a rather arbitrary choice. */ to use as lifetime for options. This is a rather arbitrary choice. */
min_pref_time = 0xffffffff; min_pref_time = 0xffffffff;
if (parm.glob_pref_time != 0 && parm.glob_pref_time < min_pref_time) if (parm.glob_pref_time != 0 && parm.glob_pref_time < min_pref_time)
min_pref_time = parm.glob_pref_time; min_pref_time = parm.glob_pref_time;
if (parm.ula_pref_time != 0 && parm.ula_pref_time < min_pref_time) if (parm.ula_pref_time != 0 && parm.ula_pref_time < min_pref_time)
min_pref_time = parm.ula_pref_time; min_pref_time = parm.ula_pref_time;
skipping to change at line 413 skipping to change at line 416
/* Set the MTU from ra_param if any, an MTU of 0 mean automatic for linux, */ /* Set the MTU from ra_param if any, an MTU of 0 mean automatic for linux, */
/* an MTU of -1 prevents the option from being sent. */ /* an MTU of -1 prevents the option from being sent. */
if (ra_param) if (ra_param)
mtu = ra_param->mtu; mtu = ra_param->mtu;
#ifdef HAVE_LINUX_NETWORK #ifdef HAVE_LINUX_NETWORK
/* Note that IPv6 MTU is not necessarily the same as the IPv4 MTU /* Note that IPv6 MTU is not necessarily the same as the IPv4 MTU
available from SIOCGIFMTU */ available from SIOCGIFMTU */
if (mtu == 0) if (mtu == 0)
{ {
char *mtu_name = ra_param ? ra_param->mtu_name : NULL; char *mtu_name = ra_param ? ra_param->mtu_name : NULL;
sprintf(daemon->namebuff, "/proc/sys/net/ipv6/conf/%s/mtu", mtu_name ? : i face_name); sprintf(daemon->namebuff, "/proc/sys/net/ipv6/conf/%s/mtu", mtu_name ? mtu _name : iface_name);
if ((f = fopen(daemon->namebuff, "r"))) if ((f = fopen(daemon->namebuff, "r")))
{ {
if (fgets(daemon->namebuff, MAXDNAME, f)) if (fgets(daemon->namebuff, MAXDNAME, f))
mtu = atoi(daemon->namebuff); mtu = atoi(daemon->namebuff);
fclose(f); fclose(f);
} }
} }
#endif #endif
if (mtu > 0) if (mtu > 0)
{ {
skipping to change at line 888 skipping to change at line 891
return 1; return 1;
} }
static int iface_search(struct in6_addr *local, int prefix, static int iface_search(struct in6_addr *local, int prefix,
int scope, int if_index, int flags, int scope, int if_index, int flags,
int preferred, int valid, void *vparam) int preferred, int valid, void *vparam)
{ {
struct search_param *param = vparam; struct search_param *param = vparam;
struct dhcp_context *context; struct dhcp_context *context;
struct iname *tmp;
(void)scope; (void)scope;
(void)preferred; (void)preferred;
(void)valid; (void)valid;
/* ignore interfaces we're not doing DHCP on. */
if (!indextoname(daemon->icmp6fd, if_index, param->name) ||
!iface_check(AF_LOCAL, NULL, param->name, NULL))
return 1;
for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next)
if (tmp->name && wildcard_match(tmp->name, param->name))
return 1;
for (context = daemon->dhcp6; context; context = context->next) for (context = daemon->dhcp6; context; context = context->next)
if (!(context->flags & (CONTEXT_TEMPLATE | CONTEXT_OLD)) && if (!(context->flags & (CONTEXT_TEMPLATE | CONTEXT_OLD)) &&
prefix <= context->prefix && prefix <= context->prefix &&
is_same_net6(local, &context->start6, context->prefix) && is_same_net6(local, &context->start6, context->prefix) &&
is_same_net6(local, &context->end6, context->prefix) && is_same_net6(local, &context->end6, context->prefix) &&
context->ra_time != 0 && context->ra_time != 0 &&
difftime(context->ra_time, param->now) <= 0.0) difftime(context->ra_time, param->now) <= 0.0)
{ {
/* found an interface that's overdue for RA determine new /* found an interface that's overdue for RA determine new
timeout value and arrange for RA to be sent unless interface is timeout value and arrange for RA to be sent unless interface is
still doing DAD.*/ still doing DAD.*/
if (!(flags & IFACE_TENTATIVE)) if (!(flags & IFACE_TENTATIVE))
param->iface = if_index; param->iface = if_index;
/* should never fail */
if (!indextoname(daemon->icmp6fd, if_index, param->name))
{
param->iface = 0;
return 0;
}
new_timeout(context, param->name, param->now); new_timeout(context, param->name, param->now);
/* zero timers for other contexts on the same subnet, so they don't timeo ut /* zero timers for other contexts on the same subnet, so they don't timeo ut
independently */ independently */
for (context = context->next; context; context = context->next) for (context = context->next; context; context = context->next)
if (prefix <= context->prefix && if (prefix <= context->prefix &&
is_same_net6(local, &context->start6, context->prefix) && is_same_net6(local, &context->start6, context->prefix) &&
is_same_net6(local, &context->end6, context->prefix)) is_same_net6(local, &context->end6, context->prefix))
context->ra_time = 0; context->ra_time = 0;
 End of changes. 7 change blocks. 
11 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)