"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ipv6.c" between
dhcpcd-7.1.0.tar.xz and dhcpcd-7.1.1.tar.xz

About: dhcpcd is a RFC2131 compliant DHCP (Dynamic Host Configuration Protocol) client.

ipv6.c  (dhcpcd-7.1.0.tar.xz):ipv6.c  (dhcpcd-7.1.1.tar.xz)
skipping to change at line 33 skipping to change at line 33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <arpa/inet.h>
#include <net/if.h> #include <net/if.h>
#include <net/route.h> #include <net/route.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h> #include <netinet/if_ether.h>
#include "config.h" #include "config.h"
#ifdef HAVE_SYS_BITOPS_H #ifdef HAVE_SYS_BITOPS_H
#include <sys/bitops.h> #include <sys/bitops.h>
#else #else
skipping to change at line 885 skipping to change at line 886
IN6_ARE_ADDR_EQUAL(&addr->addr, match) && IN6_ARE_ADDR_EQUAL(&addr->addr, match) &&
(!flags || addr->flags & flags)) (!flags || addr->flags & flags))
return 1; return 1;
return 0; return 0;
} }
struct ipv6_addr * struct ipv6_addr *
ipv6_findaddr(struct dhcpcd_ctx *ctx, const struct in6_addr *addr, unsigned int flags) ipv6_findaddr(struct dhcpcd_ctx *ctx, const struct in6_addr *addr, unsigned int flags)
{ {
struct ipv6_addr *dap, *nap; struct ipv6_addr *nap;
#ifdef DHCP6
struct ipv6_addr *dap;
#endif
dap = dhcp6_findaddr(ctx, addr, flags);
nap = ipv6nd_findaddr(ctx, addr, flags); nap = ipv6nd_findaddr(ctx, addr, flags);
#ifdef DHCP6
dap = dhcp6_findaddr(ctx, addr, flags);
if (!dap && !nap) if (!dap && !nap)
return NULL; return NULL;
if (dap && !nap) if (dap && !nap)
return dap; return dap;
if (nap && !dap) if (nap && !dap)
return nap; return nap;
if (nap->iface->metric < dap->iface->metric) if (nap->iface->metric < dap->iface->metric)
return nap; return nap;
return dap; return dap;
#else
return nap;
#endif
} }
ssize_t ssize_t
ipv6_addaddrs(struct ipv6_addrhead *addrs) ipv6_addaddrs(struct ipv6_addrhead *addrs)
{ {
struct ipv6_addr *ap, *apn; struct ipv6_addr *ap, *apn;
ssize_t i; ssize_t i;
struct timespec now; struct timespec now;
i = 0; i = 0;
skipping to change at line 1186 skipping to change at line 1194
if (cmd == RTM_DELADDR) if (cmd == RTM_DELADDR)
ipv6_freeaddr(ia); ipv6_freeaddr(ia);
} }
int int
ipv6_hasaddr(const struct interface *ifp) ipv6_hasaddr(const struct interface *ifp)
{ {
if (ipv6nd_iffindaddr(ifp, NULL, 0) != NULL) if (ipv6nd_iffindaddr(ifp, NULL, 0) != NULL)
return 1; return 1;
#ifdef DHCP6
if (dhcp6_iffindaddr(ifp, NULL, 0) != NULL) if (dhcp6_iffindaddr(ifp, NULL, 0) != NULL)
return 1; return 1;
#endif
return 0; return 0;
} }
struct ipv6_addr * struct ipv6_addr *
ipv6_iffindaddr(struct interface *ifp, const struct in6_addr *addr, ipv6_iffindaddr(struct interface *ifp, const struct in6_addr *addr,
int revflags) int revflags)
{ {
struct ipv6_state *state; struct ipv6_state *state;
struct ipv6_addr *ap; struct ipv6_addr *ap;
skipping to change at line 2271 skipping to change at line 2281
rt->rt_dflags |= RTDF_RA; rt->rt_dflags |= RTDF_RA;
TAILQ_INSERT_TAIL(routes, rt, rt_next); TAILQ_INSERT_TAIL(routes, rt, rt_next);
if (have_default) if (have_default)
*have_default = true; *have_default = true;
} }
} }
} }
return 0; return 0;
} }
#ifdef DHCP6
static int static int
inet6_dhcproutes(struct rt_head *routes, struct dhcpcd_ctx *ctx, inet6_dhcproutes(struct rt_head *routes, struct dhcpcd_ctx *ctx,
enum DH6S dstate) enum DH6S dstate)
{ {
struct interface *ifp; struct interface *ifp;
const struct dhcp6_state *d6_state; const struct dhcp6_state *d6_state;
const struct ipv6_addr *addr; const struct ipv6_addr *addr;
struct rt *rt; struct rt *rt;
TAILQ_FOREACH(ifp, ctx->ifaces, next) { TAILQ_FOREACH(ifp, ctx->ifaces, next) {
skipping to change at line 2294 skipping to change at line 2305
rt = inet6_makeprefix(ifp, NULL, addr); rt = inet6_makeprefix(ifp, NULL, addr);
if (rt) { if (rt) {
rt->rt_dflags |= RTDF_DHCP; rt->rt_dflags |= RTDF_DHCP;
TAILQ_INSERT_TAIL(routes, rt, rt_next); TAILQ_INSERT_TAIL(routes, rt, rt_next);
} }
} }
} }
} }
return 0; return 0;
} }
#endif
bool bool
inet6_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes) inet6_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
{ {
bool have_default; bool have_default;
/* Should static take priority? */ /* Should static take priority? */
if (inet6_staticroutes(routes, ctx) == -1) if (inet6_staticroutes(routes, ctx) == -1)
return false; return false;
/* First add reachable routers and their prefixes */ /* First add reachable routers and their prefixes */
have_default = false; have_default = false;
if (inet6_raroutes(routes, ctx, 0, &have_default) == -1) if (inet6_raroutes(routes, ctx, 0, &have_default) == -1)
return false; return false;
#ifdef DHCP6
/* We have no way of knowing if prefixes added by DHCP are reachable /* We have no way of knowing if prefixes added by DHCP are reachable
* or not, so we have to assume they are. * or not, so we have to assume they are.
* Add bound before delegated so we can prefer interfaces better */ * Add bound before delegated so we can prefer interfaces better */
if (inet6_dhcproutes(routes, ctx, DH6S_BOUND) == -1) if (inet6_dhcproutes(routes, ctx, DH6S_BOUND) == -1)
return false; return false;
if (inet6_dhcproutes(routes, ctx, DH6S_DELEGATED) == -1) if (inet6_dhcproutes(routes, ctx, DH6S_DELEGATED) == -1)
return false; return false;
#endif
#ifdef HAVE_ROUTE_METRIC #ifdef HAVE_ROUTE_METRIC
/* If we have an unreachable router, we really do need to remove the /* If we have an unreachable router, we really do need to remove the
* route to it beause it could be a lower metric than a reachable * route to it beause it could be a lower metric than a reachable
* router. Of course, we should at least have some routers if all * router. Of course, we should at least have some routers if all
* are unreachable. */ * are unreachable. */
if (!have_default) { if (!have_default) {
#endif #endif
/* Add our non-reachable routers and prefixes /* Add our non-reachable routers and prefixes
* Unsure if this is needed, but it's a close match to kernel * Unsure if this is needed, but it's a close match to kernel
 End of changes. 11 change blocks. 
2 lines changed or deleted 16 lines changed or added

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