Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TE7] IPv6 Only case resolve failing with chip-tool #11998

Closed
praveenCY opened this issue Nov 18, 2021 · 3 comments
Closed

[TE7] IPv6 Only case resolve failing with chip-tool #11998

praveenCY opened this issue Nov 18, 2021 · 3 comments

Comments

@praveenCY
Copy link
Contributor

Problem

Commissioning is failing for IPv6 only case with CASESession Timeout

Update below flag to disable ipv4 for resolve
chip_inet_config_enable_ipv4=false

CHIP:IN: Sending plaintext msg 0xaaaaf5414fa0 with MessageCounter:3028697144 to 0x0000000000000000 at monotonic time: 344622313 msec
CHIP:EM: Retransmitted MessageCounter:3028697144 on exchange 29121i Send Cnt 1
CHIP:IN: Sending plaintext msg 0xaaaaf5414fa0 with MessageCounter:3028697144 to 0x0000000000000000 at monotonic time: 344622568 msec
CHIP:EM: Retransmitted MessageCounter:3028697144 on exchange 29121i Send Cnt 2
CHIP:IN: Sending plaintext msg 0xaaaaf5414fa0 with MessageCounter:3028697144 to 0x0000000000000000 at monotonic time: 344622825 msec
CHIP:EM: Retransmitted MessageCounter:3028697144 on exchange 29121i Send Cnt 3
CHIP:EM: Failed to Send CHIP MessageCounter:3028697144 on exchange 29121i sendCount: 3 max retries: 3
CHIP:SC: CASESession timed out while waiting for a response from the peer. Current state was 1
CHIP:CTL: Device connection failed. Error ../../third_party/connectedhomeip/src/protocols/secure_channel/CASESession.cpp:291: CHIP Error 0x00000032: Timeout
CHIP:TOO: Device commissioning Failure: ../../third_party/connectedhomeip/src/protocols/secure_channel/CASESession.cpp:291: CHIP Error 0x00000032: Timeout
CHIP:-: ../../third_party/connectedhomeip/src/protocols/secure_channel/CASESession.cpp:291: CHIP Error 0x00000032: Timeout at ../../commands/common/CHIPCommand.cpp:84
CHIP:TOO: Run command failure: ../../third_party/connectedhomeip/src/protocols/secure_channel/CASESession.cpp:291: CHIP Error 0x00000032: Timeout

Reason
Resolve gets IPV6 link address instead of Global address (resolve works if Global address is resolved)

Ping to Link address works
ubuntu@matter-te-7:~/cli$ ping fe80::d64d:a4ff:fea0:2a4%2
PING fe80::d64d:a4ff:fea0:2a4%2(fe80::d64d:a4ff:fea0:2a4%eth0) 56 data bytes
64 bytes from fe80::d64d:a4ff:fea0:2a4%eth0: icmp_seq=1 ttl=255 time=253 ms
64 bytes from fe80::d64d:a4ff:fea0:2a4%eth0: icmp_seq=2 ttl=255 time=179 ms

Resolve

  • Working case
    CHIP:DIS: Node ID resolved for 0x0000000000BC5C01 to [2001:db6:1:0:d64d:a4ff:fea0:2a4]:5540

  • Failure case
    CHIP:DIS: Node ID resolved for 0x00000000029365F1 to [fe80::d64d:a4ff:fea0:2a4]:5540

Logs

@praveenCY
Copy link
Contributor Author

Wireshark Capture shows UDP packet from Controller and Device not sending anything back
image

acket is dropped in below code

nd6_send_ns

for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
  if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
        ip6_addr_netcmp_zone(target_addr, netif_ip6_addr(netif, i))) {
    src_addr = netif_ip6_addr(netif, i);
    break;
  }
}

if (i == LWIP_IPV6_NUM_ADDRESSES) {
  LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_WARNING, ("ICMPv6 NS: no available src address\n"));
  ND6_STATS_INC(nd6.err);
  return;
}

@praveenCY
Copy link
Contributor Author

praveenCY commented Nov 30, 2021

Issue is root caused to zone configuration in ip6_addr for latest lwip branch (this variable is not present in third_party/lwip : this is old lwip tag)
struct ip6_addr {
u32_t addr[4];
#if LWIP_IPV6_SCOPES
u8_t zone;
#endif /* LWIP_IPV6_SCOPES */
};

logs:
fe80:0:0:0:e65f:1ff:fe2f:c4b3 target_address.zone 60 ==> zone is configured as 60 but neighor_cache for the same LL address is 1 and ip6_addr_cmp fails in nd6_find_neighbor_cache_entry

fe80:0:0:0:290:4cff:fe0f:f260 neighbor_cache[i].next_hop_address.zone 1
fe80:0:0:0:e65f:1ff:fe2f:c4b3 neighbor_cache[i].next_hop_address.zone 1 (edited)

@praveenCY
Copy link
Contributor Author

Fix for this issue
--- a/src/inet/IPAddress.cpp
+++ b/src/inet/IPAddress.cpp
@@ -179,6 +179,7 @@ ip6_addr_t IPAddress::ToIPv6() const
{
ip6_addr_t ipAddr;
static_assert(sizeof(ipAddr.addr) == sizeof(Addr), "ip6_addr_t size mismatch");
+ memset(&ipAddr, 0x0, sizeof(ipAddr));
memcpy(&ipAddr.addr, Addr, sizeof(ipAddr.addr));
return ipAddr;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant