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

used wireguard port are not properly reported on testnet #556

Closed
zaibon opened this issue Mar 2, 2020 · 2 comments · Fixed by #568 or #570
Closed

used wireguard port are not properly reported on testnet #556

zaibon opened this issue Mar 2, 2020 · 2 comments · Fixed by #568 or #570
Assignees
Labels
priority_major type_bug Something isn't working

Comments

@zaibon
Copy link
Contributor

zaibon commented Mar 2, 2020

for n in nodes: 
   2     print(n.node_id, n.wg_ports)                                                                                                                                                                     
2fi9ZZiBGW4G9pnrN656bMfW6x55RSoHDeMrd9pgSA8T []
72CP8QPhMSpF7MbSvNR1TYZFbTnbRiuyvq5xwcoRNAib []
D1sY7tgHX6fVvjrpCotr4SmezVyRShLTufqhEpBQxK1v []
6m9gFPTYLRiCH7FD8yU5VWwXZdfegKUvXZgrJoS1EJfQ []
2m3nHPSAMyZFSeg5HPozic2NGBMtrXrBkhtNcVmd5Ss6 []
3dAnxcykEDgKVQdTRKmktggL2MZbm3CPSdS9Tdoy4HAF []
3BwDVNRigau8Zk6BQkJt5PLxrHQnJ5NTfNvAtuubC1eS []
A7FmQZ72h7FzjkJMGXmzLDFyfyxzitDZYuernGG97nv7 []
7fHSAHEvUGtUcYSqLtpGq8ANssPikTyyHC52FddDYF4Y []
FjwyHVvfATkVb4Puh4x6jCMS79TVVgSYagAuZTxWrsbj []
HT9yNvHRQs65dyRJeztAdEnXKweCX2bhgvD9i1WFPUNs - 1,000

9211BFV7MFwktD2b8jHE9Ub3fHRtaYQyBBfwT9kEKA7q []
HugtVL51BFNLbZbbxnWu2GEe8hV97YVPac19zy5wwNpT []
9KAbX21NGbZYupBJ6EeeWx3ZTKDx7ADevr8qtmEa5WkC []
9kcLeTuseybGHGWw2YXvdu4kk2jZzyZCaCHV9t6Axqqx []
3h4TKp11bNWjb2UemgrVwayuPnYcs2M1bccXvi3jPR2Y []
FUq4Sz7CdafZYV2qJmTe3Rs4U4fxtJFcnV6mPNgGbmRg []
5Pb5NMBQWLTWhXK2cCM8nS6JZrnP2HaTP452TfMMYT9p []
DUF2knurdMuX2eJVp9o7tXq4eNBy2fbxBoWhrMXWPEtF []
8zdqjFD7GLsSSfsTgFYcGusw91gQ3tdx7jbUhJep2a5X []
6chi1iSczxfF4U2iyCcJwkwWnwzcDgQHzCRExK9r4V1j []
AT4hKXnFWPNsnE38sUoERDVzxL9mNysqDWQSdHkum7YD - 8,192

J1Xb2piba1vZM2pSmWP24CPgREnoTce7EuUJysttCyz6 - 8,193
- 8,194
- 1,000

9161hj9VnM41HVvTr7nHQKcgFBx8Yf6AjWduMCrBXQip - 8,193
- 8,194
- 1,000

33zKcb6YBSuYDVrTsm6AjBuTpujP4na7kL6ZrShcVKbF - 8,194
- 1,000
- 8,193

FLeByELHK22evRYqJokHsCMCF9wQpLtuyehUp1LgR5eM []
49RnnxyRJ7r2So6UMBV2UDyLtoyRjmAf8NEnDnzpMtmY []
ByTfXHH7RogHNLpTpBWbn34ofC2tfCBVhFKJxYnMBoNi []
A34YUGenHKyhjDMAUKZe4cVDtJM2wQ4n4XRkfGUUEYdy - 1,000
- 8,192

HYwvrxCy5z1QPALC5gTAiAMYWLH7orQ8xWEDbEyLiJV7 - 8,192
- 1,000

CBDY1Fu4CuxGpdU3zLL9QT5DGaRkxjpuJmzV6V5CBWg4 - 8,192
- 1,000

Hb6oVe2B5v9UBzDcDeQfZGn5bwFeM2R3rJh6U93AWfiN - 8,192
- 1,000

54S1qFXxWgnjmvEFVvqUbR7dHhvCshLbQrp2UpmE7GhZ - 8,192
- 1,000

9WhwSbM2xBNb9E3ws3PNJfyeajnKXWDZAMBLZMXCA9jf - 8,192
- 1,000

2hgRioV9ZKe8Apnm84TZn8Bn5XczyPU2nkPmozUY4rYw - 8,192
- 1,000

6gBWuYT8MTCJiRJp3mLiPLSXDJpDCGrLyi4HpVissb5j - 8,192
- 1,000

59R1GU6qh4RiWQRvUFm4GzwBbTM2JStyTFmgpzruq9Gt []
292NEoCJ98FfhB62qZXXKqBQyLUij54roeH5VwBuXsSp []
HARGRBPyxF315bXDBCdaTnAD9cqMpwxvQnnzkZjhpVCA []
Ddstj2hPbGip8Ci26TUaEzY52DHZs3JphLFXy9UgWSRS []
FZZxePXsMfWpoepiPtdmc7EjRs3i8cmFF8xXJsFHKFB4 []
Aiux6s3V8wg398FHzWWy3LC81C8vuP4JLkck7uR9T3pD []
D9pVi21QMozECuZ6inVKQZP5UFrtusKUhW5mfW5fRxbK []
35A85gq6FRBFjMfdHDE6d7j5BYr786h4afy1wNcmdzre []
4TksThCbMYo8THcsADEckaCwurHSbn6EvDapfXvga97r []
JE3GQ7LhStnoTR5mSfJZE1gcLhTr2oMiURVH1C1ipsgo []
7Qa7fxRPtMc5R72cnNms4XWD9PJkeQJ6iD8iTU9T8p2o []
9if6GSLuz1awA9EAywgYWDdgyH7Aq79X68kv9adJNAFL []

This is an output of all the wireguard port marked as used for all the nodes from testnet.
While when I check the amount of network resource deployed on some nodes there should be more wireguard port marked as used.

This also make new provision of network fails cause user doesn't know which port is used or not. Which make there reservation failed with

[+] provisiond: 2020-03-02T14:10:15Z error failed to apply provision error="failed to create network resource for network U7Xfof9T9CHuL: failed to configure network resource: failed to configure wireguard interface: failed to bring wireguard interface w-U7Xfof9T9CHuL up: address already in use" id=1159-1```
cause the port picked but the user is actually already used
@zaibon zaibon added type_bug Something isn't working priority_major labels Mar 2, 2020
@zaibon zaibon added this to the 0.2.1 milestone Mar 2, 2020
@zaibon
Copy link
Contributor Author

zaibon commented Mar 2, 2020

I think one of the problem is here:

cleanup := func() {
log.Error().Msg("clean up network resource")
if err := n.releasePort(netNR.WGListenPort); err != nil {
log.Error().Err(err).Msg("release wireguard port failed")
}
if err := netr.Delete(); err != nil {
log.Error().Err(err).Msg("error during deletion of network resource after failed deployment")
}
}

If something goes wrong when we try to delete the network resource, the port is already been marked as free while it might be not.

@zaibon zaibon modified the milestones: 0.2.1, 0.2.2 Mar 6, 2020
@zaibon zaibon self-assigned this Mar 11, 2020
zaibon added a commit that referenced this issue Mar 11, 2020
zaibon added a commit that referenced this issue Mar 11, 2020
zaibon added a commit that referenced this issue Mar 11, 2020
@zaibon zaibon reopened this Mar 11, 2020
@zaibon
Copy link
Contributor Author

zaibon commented Mar 11, 2020

The way we keep track of the reserved port on the node is still not correct.
At the moment we just keep a list of used port in memory, but this is lost during an restart of networkd.
We need to make this persistent between restart of networkd

zaibon added a commit that referenced this issue Mar 12, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 12, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 12, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 12, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 15, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 15, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 16, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 17, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 17, 2020
fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch
zaibon added a commit that referenced this issue Mar 18, 2020
…tart (#570)

* networkd: make reserved wireguard port persistant on disk

fixes #556

Before this commit networkd would loose all the reserved port after
a restart and thus publish a wrong list of reserved ports on BCDB.

We now keep this list of reserved port on cache disk so it survive
a restart.

We still do clean up after a reboot since all the network resources are
also going to be re-created so the list of reserved port will be rebuild
from scratch

* add cache package

it allow to create a directory that is persistant or temporary in memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority_major type_bug Something isn't working
Projects
None yet
1 participant