Merge pull request #455 from simonduq/fix/coap-endpoint-is-reachable
CoAP: fix `coap_endpoint_is_connected`
This commit is contained in:
commit
288f1c9e7f
|
@ -49,6 +49,7 @@
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "net/ipv6/uip-udp-packet.h"
|
#include "net/ipv6/uip-udp-packet.h"
|
||||||
#include "net/ipv6/uiplib.h"
|
#include "net/ipv6/uiplib.h"
|
||||||
|
#include "net/routing/routing.h"
|
||||||
#include "coap.h"
|
#include "coap.h"
|
||||||
#include "coap-engine.h"
|
#include "coap-engine.h"
|
||||||
#include "coap-endpoint.h"
|
#include "coap-endpoint.h"
|
||||||
|
@ -58,10 +59,6 @@
|
||||||
#include "coap-keystore.h"
|
#include "coap-keystore.h"
|
||||||
#include "coap-keystore-simple.h"
|
#include "coap-keystore-simple.h"
|
||||||
|
|
||||||
#if UIP_CONF_IPV6_RPL
|
|
||||||
#include "rpl.h"
|
|
||||||
#endif /* UIP_CONF_IPV6_RPL */
|
|
||||||
|
|
||||||
/* Log configuration */
|
/* Log configuration */
|
||||||
#include "coap-log.h"
|
#include "coap-log.h"
|
||||||
#define LOG_MODULE "coap-uip"
|
#define LOG_MODULE "coap-uip"
|
||||||
|
@ -260,13 +257,12 @@ coap_endpoint_is_secure(const coap_endpoint_t *ep)
|
||||||
int
|
int
|
||||||
coap_endpoint_is_connected(const coap_endpoint_t *ep)
|
coap_endpoint_is_connected(const coap_endpoint_t *ep)
|
||||||
{
|
{
|
||||||
#if UIP_CONF_IPV6_RPL
|
|
||||||
#ifndef CONTIKI_TARGET_NATIVE
|
#ifndef CONTIKI_TARGET_NATIVE
|
||||||
if(rpl_get_any_dag() == NULL) {
|
if(!uip_is_addr_linklocal(&ep->ipaddr)
|
||||||
|
&& NETSTACK_ROUTING.node_is_reachable() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* UIP_CONF_IPV6_RPL */
|
|
||||||
|
|
||||||
#ifdef WITH_DTLS
|
#ifdef WITH_DTLS
|
||||||
if(ep != NULL && ep->secure != 0) {
|
if(ep != NULL && ep->secure != 0) {
|
||||||
|
|
Loading…
Reference in New Issue