-
Notifications
You must be signed in to change notification settings - Fork 162
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
pkg/snet: change snet.Topology to a struct #4673
pkg/snet: change snet.Topology to a struct #4673
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 2 files reviewed, 1 unresolved discussion (waiting on @JordiSubira)
a discussion (no related file):
This is more of a proposal of how we could deal with changing topologies for processes that have long standing connections. We could probably introduce some caching layer on top of snet.Topology. What do you think @JordiSubira ?
This way we can resolve interfaces even if they are dynamically changing. OS-PR: scionproto#4673
bf0807a
to
09c8a0f
Compare
This way we can resolve interfaces even if they are dynamically changing. OS-PR: scionproto#4673
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 2 files reviewed, 1 unresolved discussion (waiting on @lukedirtwalker)
a discussion (no related file):
Previously, lukedirtwalker (Lukas Vogel) wrote…
This is more of a proposal of how we could deal with changing topologies for processes that have long standing connections. We could probably introduce some caching layer on top of snet.Topology. What do you think @JordiSubira ?
Indeed, back on the dispatcherless PR we discussed about adding some wrapper around the snet.Daemon
API for the caching topology related requests.
We decided to put on snet.SCIONPacketConn
the interfaceMap
as a "once"-cache when opening a connection, which is not ideal because as you said the interface<->ID mapping can dynamically change. We sacrificed this to avoid having to call the daemon API on each packet (because more of the applications use the daemon to implement n.Topology
right now).
Do you think we can add the caching layer into this PR? We can have for the moment a simple one, even one shot and allow the application either to instantiate the wrapper or directly the snet.Daemon
one.
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 2 files reviewed, 1 unresolved discussion (waiting on @JordiSubira)
a discussion (no related file):
Previously, JordiSubira wrote…
Indeed, back on the dispatcherless PR we discussed about adding some wrapper around the
snet.Daemon
API for the caching topology related requests.We decided to put on
snet.SCIONPacketConn
theinterfaceMap
as a "once"-cache when opening a connection, which is not ideal because as you said the interface<->ID mapping can dynamically change. We sacrificed this to avoid having to call the daemon API on each packet (because more of the applications use the daemon to implementn.Topology
right now).Do you think we can add the caching layer into this PR? We can have for the moment a simple one, even one shot and allow the application either to instantiate the wrapper or directly the
snet.Daemon
one.
Sure, I can add a caching layer here.
09c8a0f
to
e00a82a
Compare
e00a82a
to
cd48ed8
Compare
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 10 of 13 files at r3.
Reviewable status: 10 of 13 files reviewed, 3 unresolved discussions (waiting on @JordiSubira and @lukedirtwalker)
pkg/daemon/topology.go
line 94 at r3 (raw file):
} func (t *ReloadingTopology) Run(ctx context.Context, period time.Duration) {
We never clean up the entries that are no longer present.
Is that an issue, or do we assume interfaces are not removed?
If we assume that, I think we should add a corresponding comment
control/cmd/control/main.go
line 957 at r3 (raw file):
}, Interface: func(ifID uint16) (netip.AddrPort, bool) { // XXX(lukedirtwalker): The amount of conversiones between
nit: Given we know when the data changes, I think it would be easy to convert it only once and store it.
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: 9 of 14 files reviewed, 3 unresolved discussions (waiting on @JordiSubira and @oncilla)
control/cmd/control/main.go
line 957 at r3 (raw file):
Previously, oncilla (Dominik Roos) wrote…
nit: Given we know when the data changes, I think it would be easy to convert it only once and store it.
yeah my issue is more that the topology loads as netip.AddrPort but then the API UnderlayNextHop
exposes it as *net.UDPAddr, the snet API actually converts the netip.AddrPort back to *net.UDPAddr internally
pkg/daemon/topology.go
line 94 at r3 (raw file):
Previously, oncilla (Dominik Roos) wrote…
We never clean up the entries that are no longer present.
Is that an issue, or do we assume interfaces are not removed?
If we assume that, I think we should add a corresponding comment
Good catch
The only issue I could think of is memory leak. For now I added a comment, but for good measure I'll fix the actual implementation tomorrow.
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 3 of 13 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @JordiSubira)
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, 1 unresolved discussion (waiting on @JordiSubira)
de53436
to
be3e3da
Compare
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 12 of 13 files at r3, 3 of 3 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @lukedirtwalker)
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 @lukedirtwalker)
Instead of having the snet.Topology as an interface, change it to a struct. This makes the contract clearer, LocalIA and PortRange are only considered when creating a connection. The Interface information however can dynamically change. The daemon API now exposes an adapter to load the topology information once or to load the information periodically.
be3e3da
to
111ef42
Compare
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 r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @lukedirtwalker)
Instead of having the snet.Topology as an interface, change it to a struct.
This makes the contract clearer, LocalIA and PortRange are only considered when
creating a connection. The Interface information however can dynamically change.
The daemon API now exposes an adapter to load the topology information once
or to load the information periodically.