Commit 0b2d2900 authored by danielinux's avatar danielinux

Manual merge some ipv6 timer diff from development branch

parent 7c254b15
......@@ -21,7 +21,7 @@ int pico_sntp_sync(char *sntp_server, void (*cb_synced)(pico_err_t status));
\end{itemize}
\subsubsection*{Return value}
On success, this call returns 0 if the synchronisation operation has succeeded.
On success, this call returns 0 if the synchronisation operation has successfully started. When both IPv4 and IPv6 are enabled, success on one is sufficient.
On error, -1 is returned and \texttt{pico$\_$err} is set appropriately.
\subsubsection*{Errors}
......
......@@ -49,7 +49,7 @@
\begin{document}
\title{picoTCP User Documentation}
\author{Copyright \copyright 2013-2015 Altran NV. All right reserved.}
\author{Copyright \copyright 2017 Altran Belgium NV. All right reserved.}
\maketitle
\date{\today}
\maketitle
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#define dbg(...) do {} while(0)
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
.
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
Authors: Daniele Lacamera, Kristof Roelants
*********************************************************************/
......@@ -397,15 +397,14 @@ int pico_ipv6_is_unspecified(const uint8_t addr[PICO_SIZE_IP6])
static struct pico_ipv6_route *pico_ipv6_route_find(const struct pico_ip6 *addr)
{
struct pico_ipv6_route *r = NULL;
struct pico_tree_node *index = NULL;
struct pico_ipv6_route *r = NULL;
int i = 0;
if (!pico_ipv6_is_localhost(addr->addr) && (pico_ipv6_is_linklocal(addr->addr) || pico_ipv6_is_sitelocal(addr->addr))) {
return NULL;
}
pico_tree_foreach_reverse(index, &IPV6Routes)
{
pico_tree_foreach_reverse(index, &IPV6Routes) {
r = index->keyValue;
for (i = 0; i < PICO_SIZE_IP6; ++i) {
if ((addr->addr[i] & (r->netmask.addr[i])) != ((r->dest.addr[i]) & (r->netmask.addr[i]))) {
......@@ -895,21 +894,17 @@ static struct pico_frame *pico_ipv6_alloc(struct pico_protocol *self, struct pic
IGNORE_PARAMETER(self);
switch (dev->mode) {
#ifdef LL_MODE_IEEE802154
case LL_MODE_IEEE802154:
f = pico_proto_6lowpan_ll.alloc(&pico_proto_6lowpan_ll, dev, (uint16_t)(size + PICO_SIZE_IP6HDR));
break;
#elif defined (LL_MODE_IEEE802154_NO_MAC)
case LL_MODE_IEEE802154_NO_MAC:
f = pico_proto_6lowpan_ll.alloc(&pico_proto_6lowpan_ll, dev, (uint16_t)(size + PICO_SIZE_IP6HDR));
break;
if (0) {}
#ifdef PICO_SUPPORT_6LOWPAN
else if (PICO_DEV_IS_6LOWPAN(dev)) {
f = pico_proto_6lowpan_ll.alloc(&pico_proto_6lowpan_ll, dev, (uint16_t)(size + PICO_SIZE_IP6HDR));
}
#endif
default:
else {
#ifdef PICO_SUPPORT_ETH
f = pico_proto_ethernet.alloc(&pico_proto_ethernet, dev, (uint16_t)(size + PICO_SIZE_IP6HDR));
f = pico_proto_ethernet.alloc(&pico_proto_ethernet, dev, (uint16_t)(size + PICO_SIZE_IP6HDR));
#else
f = pico_frame_alloc(size + PICO_SIZE_IP6HDR + PICO_SIZE_ETHHDR);
f = pico_frame_alloc(size + PICO_SIZE_IP6HDR + PICO_SIZE_ETHHDR);
#endif
}
......@@ -1485,7 +1480,8 @@ static inline struct pico_ipv6_route *ipv6_route_add_link(struct pico_ip6 gatewa
{
struct pico_ip6 zerogateway = {{0}};
struct pico_ipv6_route *r = pico_ipv6_route_find(&gateway);
if (!r ) { /* Specified Gateway is unreachable */
if (!r) { /* Specified Gateway is unreachable */
pico_err = PICO_ERR_EHOSTUNREACH;
return NULL;
}
......@@ -1495,7 +1491,6 @@ static inline struct pico_ipv6_route *ipv6_route_add_link(struct pico_ip6 gatewa
return NULL;
}
return r;
}
......@@ -1512,7 +1507,7 @@ struct pico_ipv6_route *pico_ipv6_gateway_by_dev(struct pico_device *dev)
if (!pico_ipv6_is_unspecified(route->gateway.addr) && pico_ipv6_is_unspecified(route->netmask.addr)) {
/* Iterate over device's links */
while (link) {
/* If link is equal to route's link, routing list is not empty */
/* If link is equal to route's link, router list is not empty */
if (0 == ipv6_link_compare(link, route->link))
return route;
link = pico_ipv6_link_by_dev_next(dev, link);
......@@ -1563,6 +1558,7 @@ int pico_ipv6_route_add(struct pico_ip6 address, struct pico_ip6 netmask, struct
test.netmask = netmask;
test.metric = (uint32_t)metric;
if (pico_tree_findKey(&IPV6Routes, &test)) {
/* Route already exists */
pico_err = PICO_ERR_EINVAL;
return -1;
}
......@@ -2062,7 +2058,7 @@ struct pico_ipv6_link *pico_ipv6_global_get(struct pico_device *dev)
{
struct pico_ipv6_link *link = pico_ipv6_link_by_dev(dev);
while (link && !pico_ipv6_is_global(link->address.addr)) {
printf("[0x%02X] - is global: %d - %d\n", link->address.addr[0], pico_ipv6_is_global(link->address.addr), link->address.addr[0] >> 0x05);
dbg("[0x%02X] - is global: %d - %d\n", link->address.addr[0], pico_ipv6_is_global(link->address.addr), link->address.addr[0] >> 0x05);
link = pico_ipv6_link_by_dev_next(dev, link);
}
return link;
......
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
.
......@@ -168,7 +168,6 @@ struct pico_ipv6_link *pico_ipv6_prefix_configured(struct pico_ip6 *prefix);
struct pico_ipv6_route *pico_ipv6_gateway_by_dev(struct pico_device *dev);
struct pico_ipv6_route *pico_ipv6_gateway_by_dev_next(struct pico_device *dev, struct pico_ipv6_route *last);
int pico_ipv6_lifetime_set(struct pico_ipv6_link *l, pico_time expire);
int pico_ipv6_dev_routing_enable(struct pico_device *dev);
int pico_ipv6_dev_routing_disable(struct pico_device *dev);
void pico_ipv6_router_down(struct pico_ip6 *address);
......
......@@ -77,9 +77,7 @@ static int pico_ipv6_neighbor_compare(void *ka, void *kb)
struct pico_ipv6_neighbor *a = ka, *b = kb;
return pico_ipv6_compare(&a->address, &b->address);
}
static PICO_TREE_DECLARE(NCache, pico_ipv6_neighbor_compare);
PICO_TREE_DECLARE(NCache, pico_ipv6_neighbor_compare);
static struct pico_ipv6_neighbor *pico_nd_find_neighbor(struct pico_ip6 *dst)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment