networkservicemesh / cmd-dashboard-backend

Apache License 2.0
0 stars 3 forks source link

Edge cases are not working properly #65

Open denis-tingaikin opened 2 days ago

denis-tingaikin commented 2 days ago

Found by @zolug

Description

Problem 1

There is a problem in the dashboard code: https://github.com/networkservicemesh/cmd-dashboard-backend/blob/main/main.go#L120 If the nse channel happens to get closed, the break will just break out from the select instead of the inner for loop, thus no new nse channel will be created.

Problem 2

code will only strip the tcp prefix in case of IPv6 addresses: https://github.com/networkservicemesh/cmd-dashboard-backend/blob/main/main.go#L123 

See at https://go.dev/play/p/ZVPkZFhXOoN

Thus, the IPv6 scheme can be lost, and it could not work with non-default schemes, and in case the default scheme is not TCP.

UPD: ipv4 could not work, because grpc Dial was unable to handle the tcp:// prefix.

TODO

  1. Fix issues
  2. Add unit tests for coverage.
zolug commented 1 day ago

As for the IPv4 dial problem here's the grpc related error:

2024/11/12 15:25:16 INFO: [core] Creating new client transport to "{Addr: \"tcp://10.244.4.4:5001\", ServerName: \"tcp:%2F%2F10.244.4.4:5001\", }": connection error: desc = "transport: Error while dialing: dial tcp: address tcp://10.244.4.4:5001: too many colons in address"
denis-tingaikin commented 1 day ago

Seems like https://github.com/networkservicemesh/api/issues/178 may just resolve this.