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

Disable/fix ports with I2P #9138

Merged
merged 1 commit into from Feb 24, 2024
Merged

Conversation

vtnerd
Copy link
Contributor

@vtnerd vtnerd commented Jan 28, 2024

This should fix #8918 , but I am soliciting for tests before marking this as ready. Basically, I only know this passes the unit tests at this point.

The patch is pretty simple, I2P ports are now fixed at 0, so opening the new pearliest manager should collapse the overloads on port once it goes into the internal map.

@vtnerd
Copy link
Contributor Author

vtnerd commented Jan 30, 2024

I just marked this as ready for review, and force pushed one last fix.

I confirmed that: (1) i2p has no field for port when configuring a tunnel, (2) that multiple instances of an address appear with different port numbers, (3) that this patch "collapses" on address where port 1 is used as a placeholder.

Unfortunately both the p2p protocol and storage mechanism will continue to read/write port for backwards compatibility. This is trivial as its only a 16-bit integer.

@vtnerd
Copy link
Contributor Author

vtnerd commented Jan 30, 2024

Force pushed a change to improve backwards compatibility.

@vtnerd
Copy link
Contributor Author

vtnerd commented Jan 30, 2024

Updated the comment about returning 1 for port number. The other option would be to change src/net/socks.cpp to always use port 1, where i2p_address still returns 0. I decided to instead return 1 in i2p_address because port 0` is considered invalid..

@plowsof
Copy link
Contributor

plowsof commented Feb 19, 2024

built master with this yesterday, everything seems ok. just have a question, does this have any effect or change the docs for i2p https://github.com/monero-project/monero/blob/master/docs/ANONYMITY_NETWORKS.md ?

anonymous-inbound=ugnlcdciyhghh2zert7c3kl4biwkirc43ke33jiy5slnd3mv2trq.b32.i2p:8061,127.0.0.1:8061

stats/info:

Remote Host                                                                 Type    SSL   Peer id             Support Flags       Recv/Sent (inactive,sec)      State                    Livetime(sec)       Down (kB/s) Down(now)     Up (kB/s) Up(now)      
OUT xmr4u2kugmcwhaw5bvutiqozcx6dohtxz2wh37glgs47s73cgydq.b32.i2p            I2P     no    0000000000000001    0                   25872(31)/4632(31)            normal                   86                  0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   35894(30)/11270(31)           normal                   1587                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   276184(0)/30130(0)            normal                   6466                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   179706(0)/9220(31)            normal                   1103                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   532284(28)/91304(31)          normal                   20808               0           0             0         0            
OUT sel36x6fibfzujwvt4hf5gxolz6kd3jpvbjqg6o3ud2xtionyl2q.b32.i2p            I2P     no    0000000000000001    0                   143533(11)/160589(11)         normal                   23403               0           0             0         0            
OUT x3wuvir7uv37k4scw2pcjymajbcwcungc5zo5x6yicwaqr4pnizq.b32.i2p            I2P     no    0000000000000001    0                   173382(15)/202198(15)         normal                   24879               0           0             0         0            
OUT vdmnehdjkpkg57nthgnjfuaqgku673r5bpbqg56ix6fyqoywgqrq.b32.i2p            I2P     no    0000000000000001    0                   48227(30)/28707(31)           normal                   4843                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   977485(49)/102374(31)         normal                   19465               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   1926175(30)/148541(31)        normal                   27782               0           0             0         0            
OUT r4s6xrdypmkjoeb4vv3ss2vy7n5bzu4dc3hip7gweoob73jdoota.b32.i2p            I2P     no    0000000000000001    0                   108348(30)/143195(31)         normal                   33695               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   1998382(27)/100797(31)        normal                   35252               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   1915879(30)/191612(31)        normal                   36159               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   1458970(30)/194277(31)        normal                   36401               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   2096003(30)/153114(31)        normal                   40194               0           0             0         0            
OUT 7gdxuz4xeq4zzcmvrjxccid56no5rvavavg4sjcfa6oqr7tryqia.b32.i2p            I2P     no    0000000000000001    0                   229773(15)/315636(15)         normal                   39794               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   1628218(10)/213999(10)        normal                   44758               0           0             0         0            
OUT 4s4iqcxpm566ppehycz5nqg23r6etkginfumph54ygctfet4dkbq.b32.i2p            I2P     no    0000000000000001    0                   35922(30)/15270(31)           normal                   4139                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   2245671(29)/222877(31)        normal                   46897               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   3194790(8)/284666(31)         normal                   53572               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   2426823(5)/257422(31)         normal                   54083               0           0             0         0            
OUT uqj3aphckqtjsitz7kxx5flqpwjlq5ppr3chazfued7xucv3nheq.b32.i2p            I2P     no    0000000000000001    0                   277916(25)/365060(29)         normal                   63405               0           0             0         0            
OUT bgyo6m4d3y5pocp5rimll7lxpd2qlu53ehvqx4gmlluo5qkmomoa.b32.i2p            I2P     no    0000000000000001    0                   174157(30)/209945(31)         normal                   63522               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   357033(29)/211707(31)         normal                   56907               0           0             0         0            
OUT wxpymgbovamvpymrelw7bqocjgib6n6otxzn6fuy3nt5rn64de2q.b32.i2p            I2P     no    0000000000000001    0                   317492(30)/359970(31)         normal                   63653               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   28483(10)/4505(10)            normal                   99                  0           2             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   342840(30)/197993(31)         normal                   64118               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   2080939(9)/349346(9)          normal                   64519               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   3670023(30)/275588(31)        normal                   65481               0           0             0         0            
OUT s3l6ke4ed3df466khuebb4poienoingwof7oxtbo6j4n56sghe3a.b32.i2p            I2P     no    0000000000000001    0                   52133(14)/37350(14)           normal                   5564                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   3627578(30)/248796(31)        normal                   69356               0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   414565(21)/16600(31)          normal                   6039                0           0             0         0            
INC <unknown i2p host>                                                      I2P     no    0000000000000001    0                   2868947(29)/269911(31)        normal                   66976               0           0             0         0            
OUT twv4hhsrm5joycfyiey4s6rpe2gvw3wcklzj73aryp6gvkp5eegq.b32.i2p            I2P     no    0000000000000001    0                   251226(29)/321846(31)         normal                   63612               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   76508(30)/11721(31)           normal                   987                 0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   55730(24)/12746(24)           normal                   1423                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   184672(10)/15206(10)          normal                   2024                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   97024(29)/10286(31)           normal                   456                 0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   254707(30)/16436(31)          normal                   2072                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   253281(0)/15206(31)           normal                   2087                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   187264(26)/22833(31)          normal                   4252                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   366078(22)/26996(31)          normal                   5577                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   373743(30)/24515(31)          normal                   5879                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   547583(30)/30912(31)          normal                   6204                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   599486(28)/36878(28)          normal                   7970                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   484892(28)/51559(31)          normal                   11981               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   347568(14)/54654(14)          normal                   13345               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1062807(26)/42927(31)         normal                   13690               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   254973(30)/52809(31)          normal                   13968               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1281522(30)/49960(31)         normal                   15405               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   660844(30)/52194(31)          normal                   15832               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1078117(29)/69272(31)         normal                   16867               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   688758(31)/72347(31)          normal                   18083               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1375216(16)/64599(31)         normal                   20855               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   920347(23)/90308(23)          normal                   21868               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1118494(29)/36920(31)         normal                   9744                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1187596(29)/46659(31)         normal                   13872               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1254593(30)/89283(31)         normal                   21873               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3473466(2)/74418(31)          normal                   28884               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   482170(27)/50124(31)          normal                   12283               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1612164(30)/78970(31)         normal                   20275               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   214078(12)/100090(12)         normal                   31196               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   196630(31)/13771(31)          normal                   1638                0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1080513(30)/43706(31)         normal                   10206               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   315246(30)/15821(31)          normal                   2140                0           0             0         0            
OUT ulaontvuf4bjfa5tilxeufrwj6kl6wjv7xor7kandycnzmcfgig5aiqd.onion:18083    Tor     no    0000000000000001    0                   156423(28)/170104(31)         normal                   33091               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1688569(5)/131581(31)         normal                   35755               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   825242(31)/53587(31)          normal                   14133               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2522230(30)/124443(31)        normal                   28876               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1464460(27)/105688(31)        normal                   36105               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3131614(30)/110671(31)        normal                   38960               0           0             0         0            
OUT y5g6sknl66zjghukxk3fva7naujzevfa35rdu2hfhgziycgkiycjovad.onion:18083    Tor     no    0000000000000001    0                   213159(30)/210069(31)         normal                   40298               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2089850(13)/128038(13)        normal                   44962               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1988477(6)/179598(31)         normal                   44989               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2464649(30)/139828(31)        normal                   46447               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3271687(0)/192944(31)         normal                   46495               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   395908(13)/120569(13)         normal                   28465               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   1671591(30)/187225(31)        normal                   47007               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2524385(25)/214306(25)        normal                   48126               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   482177(1)/34213(31)           normal                   6872                0           0             0         0            
OUT 2aeogxoe4od77buinl2tvmbr3krt3jfiead7nyzvc5d2zsg7kevg6pad.onion:18083    Tor     no    0000000000000001    0                   68955(27)/49765(31)           normal                   14848               0           0             0         0            
OUT 2pytxpv2v5nskz6vlo33qahflm5alqspp4amfzrwipe6uu3p3usc64yd.onion:18083    Tor     no    0000000000000001    0                   279129(8)/219669(8)           normal                   48143               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2544241(23)/187451(23)        normal                   48995               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2242455(30)/218201(31)        normal                   49101               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2448310(30)/185937(31)        normal                   50170               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2280635(4)/170294(31)         normal                   52655               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2648794(30)/198358(31)        normal                   59672               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3326142(30)/240199(31)        normal                   60218               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   700706(29)/43952(31)          normal                   13809               0           0             0         0            
OUT fgsptmnfaq35mfgn2sngu6gid6fw46x2uctpcru3fw3lpeyzytphqdad.onion:18083    Tor     no    0000000000000001    0                   72575(28)/29570(31)           normal                   7113                0           0             0         0            
OUT xyju4rpqqimgzjxf7buzhic7usdp7iy2iihgc2byuniq4etvm5qokbqd.onion:18083    Tor     no    0000000000000001    0                   201480(30)/200399(31)         normal                   61866               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3952993(29)/182347(31)        normal                   66414               0           0             0         0            
OUT heniylun3x5p47ddktjvtjxw7hcaj6a5g6bcp7nkc4brzooniscku4id.onion:18083    Tor     no    0000000000000001    0                   125922(30)/126984(31)         normal                   25380               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   319002(28)/272163(31)         normal                   67345               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2118754(9)/144496(28)         normal                   36074               0           0             0         0            
OUT monerocatsm63sqvldao4fj3c5qx4kmxdzac3d5nzlgcwmospa2vkgad.onion:18083    Tor     no    0000000000000001    0                   267807(30)/289694(31)         normal                   67651               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2716098(3)/274523(3)          normal                   68883               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2221155(31)/148249(31)        normal                   40000               0           0             0         0            
OUT xbdyd6bwgwlmxjpch57aj7z4pqq5yfanfxcozo36itqk7jmd5fqudaqd.onion:18083    Tor     no    0000000000000001    0                   271252(30)/231829(31)         normal                   67521               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   4075078(30)/268289(31)        normal                   68508               0           0             0         0            
OUT igs6cyfaxlvf6ybqg4w43g5xenqizssoczn3k6yif3pdtwpkien2pxid.onion:18083    Tor     no    0000000000000001    0                   161761(30)/146209(31)         normal                   39706               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   514958(29)/165915(31)         normal                   67647               0           0             0         0            
OUT cdhqitbjesid4vft2otnt6utqrdvaemlr2ebmzayajnfhxgwuvbgtcqd.onion:18085    Tor     no    0000000000000001    0                   308767(24)/350399(24)         normal                   67663               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3533192(28)/227347(28)        normal                   63467               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   203628(10)/13566(10)          normal                   1426                0           0             0         0            
OUT ov7xnvldthuey63eu7sn33dpucbigbsbrhs5u4tc5agq5gxtipjw3oyd.onion:18083    Tor     no    0000000000000001    0                   214030(28)/213694(31)         normal                   66198               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   3719573(29)/232866(31)        normal                   69979               0           0             0         0            
INC <unknown tor host>                                                      Tor     no    0000000000000001    0                   2938670(30)/206784(31)        normal                   60304               0           0             0         0            
root ~ # monerod status
2024-02-19 18:27:36.623	I Monero 'Fluorine Fermi' (v0.18.1.0-cd7ccfbda)
Height: 3087826/3087826 (100.0%) on mainnet, not mining, net hash 2.28 GH/s, v16, 12(out)+95(in) connections, uptime 0d 19h 28m 8s
root ~ # monerod print_net_stats
2024-02-19 18:27:46.765	I Monero 'Fluorine Fermi' (v0.18.1.0-cd7ccfbda)
Received 4774180513 bytes (4.45 GB) in 2419257 packets in 19.5 hours, average 66.51 kB/s = 0.33% of the limit of 19.53 MB/s
Sent 61568793481 bytes (57.34 GB) in 2688178 packets in 19.5 hours, average 857.74 kB/s = 4.29% of the limit of 19.53 MB/s 


@vtnerd
Copy link
Contributor Author

vtnerd commented Feb 19, 2024

Yes, looks like the documentation needs to be updated to omit the port number with I2P. Will do that (hopefully today).

@luigi1111 luigi1111 merged commit 486ae9f into monero-project:master Feb 24, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It is possible to open >1 connections to the same I2P node
6 participants