-
Notifications
You must be signed in to change notification settings - Fork 163
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
Path test in showpaths tool #2108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @sustrik and @sgmonroy)
go/tools/showpaths/paths.go, line 115 at r1 (raw file):
} for i := len(pathStatuses); i > 0; i-- { b := make([]byte, 65536, 65536)
Why such a big buffer? errors should fit in 1500 Bytes packets and if it doesn't fit you should get an error from ReadFrom
go/tools/showpaths/paths.go, line 116 at r1 (raw file):
for i := len(pathStatuses); i > 0; i-- { b := make([]byte, 65536, 65536) _, addr, err := scionConn.ReadFromSCION(b)
you should have a timeout here in case some packets are lost and you get no reply at all
go/tools/showpaths/paths.go, line 117 at r1 (raw file):
b := make([]byte, 65536, 65536) _, addr, err := scionConn.ReadFromSCION(b) if _, ok := err.(*snet.OpError); !ok {
I don't think this is enough. You should check the SCMP error you got back, and check for the expected class/type error.
You can call SCMP() on an OpError then check for C_Rourintg/T_R_BadHost
As discussed offline, we should check for:
- expected SCMP error C_Rourintg/T_R_BadHost
- print any other error
- unexpected packet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @sustrik)
go/tools/showpaths/paths.go, line 116 at r1 (raw file): Previously, sgmonroy (Sergio Gonzalez Monroy) wrote…
There's a timeout set on the connection, see line 84 |
go/tools/showpaths/paths.go, line 115 at r1 (raw file): Previously, sgmonroy (Sergio Gonzalez Monroy) wrote…
I wasn't sure what the limit is. Shrinking it to 1500. |
go/tools/showpaths/paths.go, line 115 at r1 (raw file): Previously, sustrik (Martin Sustrik) wrote…
Done. |
go/tools/showpaths/paths.go, line 116 at r1 (raw file): Previously, sustrik (Martin Sustrik) wrote…
Done. |
go/tools/showpaths/paths.go, line 117 at r1 (raw file): Previously, sgmonroy (Sergio Gonzalez Monroy) wrote…
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @sgmonroy and @sustrik)
go/tools/showpaths/paths.go, line 77 at r2 (raw file):
pathStatuses := make(map[string]string) if *status {
the code for this functionality is quite large compare to the main body itself, could you take it out of main and brake it up a bit into smaller function/functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @sustrik)
go/tools/showpaths/paths.go, line 77 at r2 (raw file): Previously, sgmonroy (Sergio Gonzalez Monroy) wrote…
I've split the path testing into a separate function. However, splitting it further doesn't make much sense. Sending the packets alone isn't good for anything. Neither is receiving the replies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @scrye)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @scrye)
a discussion (no related file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @sustrik)
go/tools/showpaths/paths.go, line 81 at r3 (raw file):
} i := 0 for _, path := range reply.Entries {
It's not related to this PR specifically, but we can simplify two lines by doing:
for i, path := range reply.Entries {
// ....
}
go/tools/showpaths/paths.go, line 91 at r3 (raw file):
} fmt.Printf("\n") i++
This must be removed for the previous comment to work.
go/tools/showpaths/paths.go, line 148 at r3 (raw file):
pathStatuses := make(map[string]string) for _, path := range paths { sPath := spath.New(path.Path.FwdPath)
It would be a bit easier to read this if the inside of the loop were split into a different function:
for _, path := range paths {
sendTestPacket(scionConn, path)
pathStatuses[string(path.Path.FwdPath)] = "Timeout"
}
go/tools/showpaths/paths.go, line 173 at r3 (raw file):
} for i := len(pathStatuses); i > 0; i-- { b := make([]byte, 1500, 1500)
Same suggestion as above:
for i := len(pathStatuses); i > 0; i-- {
path, status := receiveNextTestReply(scionConn)
pathStatuses[path] = status // and other global logic, like double replies
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @sgmonroy from a discussion.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @sustrik)
go/tools/showpaths/paths.go, line 81 at r3 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. |
go/tools/showpaths/paths.go, line 91 at r3 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. |
go/tools/showpaths/paths.go, line 148 at r3 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. |
go/tools/showpaths/paths.go, line 173 at r3 (raw file): Previously, scrye (Sergiu Costea) wrote…
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r4.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @sustrik)
go/tools/showpaths/paths.go, line 96 at r4 (raw file):
var err error flag.Parse()
I just did some manual testing and realized logging is not correctly initialized. The following needs to be added after this line:
log.SetupFromFlags("")
go/tools/showpaths/paths.go, line 182 at r4 (raw file):
Path: sPath, } fmt.Println("Sending test packet to: ", addr)
This isn't very informative to the user, because it only prints something like the below on start:
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
It can probably be dropped altogether, or changed to log.Debug
and having it also log the path:
log.Debug("Sending test packet on: ", "path", addr.Path)
go/tools/showpaths/paths.go, line 210 at r4 (raw file):
} if opErr, ok := err.(*snet.OpError); ok { fmt.Println(opErr)
This also can probably be dropped/changed to debug/info logging, because it is very advanced information for users:
Class=ROUTING(1) Type=BAD_HOST(6) TotalLen=64B Checksum=1fff Timestamp=2018-11-09 16:13:23.624934 +0100 CET
If it might be important information, it should be translated to something more human readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @scrye)
go/tools/showpaths/paths.go, line 96 at r4 (raw file):
Previously, scrye (Sergiu Costea) wrote…
I just did some manual testing and realized logging is not correctly initialized. The following needs to be added after this line:
log.SetupFromFlags("")
Done.
go/tools/showpaths/paths.go, line 182 at r4 (raw file):
Previously, scrye (Sergiu Costea) wrote…
This isn't very informative to the user, because it only prints something like the below on start:
Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP) Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP) Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP) Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP) Sending test packet to: 1-ff00:0:111,[UNKNOWN M (0xffff)]:0 (UDP)
It can probably be dropped altogether, or changed to
log.Debug
and having it also log the path:log.Debug("Sending test packet on: ", "path", addr.Path)
Done. Also, let's print an entire path, just in case.
go/tools/showpaths/paths.go, line 210 at r4 (raw file):
Previously, scrye (Sergiu Costea) wrote…
This also can probably be dropped/changed to debug/info logging, because it is very advanced information for users:
Class=ROUTING(1) Type=BAD_HOST(6) TotalLen=64B Checksum=1fff Timestamp=2018-11-09 16:13:23.624934 +0100 CET
If it might be important information, it should be translated to something more human readable.
This was just a debugging message I forgot to remove. The human-readable error message is printed alongside the path in the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5.
Reviewable status:complete! all files reviewed, all discussions resolved
Fixes #2039
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)