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

Raw UDP socket support in macos/ios #79

Open
Mrc527 opened this issue Aug 19, 2022 · 56 comments
Open

Raw UDP socket support in macos/ios #79

Mrc527 opened this issue Aug 19, 2022 · 56 comments

Comments

@Mrc527
Copy link

Mrc527 commented Aug 19, 2022

Hello,

am I the only one who cannot get raw mode working on macOS / iOS?

Same setup, a linux and even a windows box can connect to raw socket but macos says test failed and goes through DNS queries (with a huge performance penalty).
It's curious to see that a linux VM running on my macbook can make the socket connection, while once again the host cannot.

Is there any limitation in place by Apple or maybe it's just about setting up the socket in a different way?

I'm sorry I cannot help you with the code but I can be a tester here 😁

@Mrc527 Mrc527 changed the title RAW support in macos/ios raw socket support in macos/ios Aug 19, 2022
@Mrc527 Mrc527 changed the title raw socket support in macos/ios Raw UDP socket support in macos/ios Aug 19, 2022
@yarrick
Copy link
Owner

yarrick commented Aug 28, 2022

What version are you using? Can you post the part of the client log when it fails?

@Mrc527
Copy link
Author

Mrc527 commented Aug 28, 2022

Hi @yarrick,

I'm currently building my executables against the latest "master" branch commit here.
I also tried pre-compiled binaries but no luck.

I do not get any error message. I simply always get "....failed". Even when trying from a working internet connection, and also from the same LAN as the server. I'm pretty sure it's about macOS/iOS, somehow.

`bin % sudo ./iodine -4 -f -P pass dns_ip domain

No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
Opened utun4
Opened IPv4 UDP socket
Sending DNS queries for x.domain.com to xxx.xxx.xxx.xxx
Autodetecting DNS query type (use -T to override).
Using DNS type NULL queries
Version ok, both using protocol v 0x00000502. You are user #0
Setting IP of utun4 to 10.11.12.2
Adding route 10.11.12.0/24 to 10.11.12.2
add net 10.11.12.0: gateway 10.11.12.2
Setting MTU of utun4 to 1130
Server tunnel IP is 10.11.12.1
Requesting server address to attempt raw UDP mode (skip with -r)
Server is at xxx.xxx.xxx.xxx, trying raw login: (skip with -r) ....failed
Using EDNS0 extension
Switching upstream to codec Base128
Server switched upstream to codec Base128
No alternative downstream codec available, using default (Raw)
Switching to lazy mode for low-latency
Server switched to lazy mode
Autoprobing max downstream fragment size... (skip with -m fragsize)
...768 not ok.. .384 ok.. ...576 not ok.. ..480 ok.. 528 ok.. 552 ok.. 564 ok.. will use 564-2=562
Setting downstream fragment size to max 562...
Connection setup complete, transmitting data.
`

@yarrick
Copy link
Owner

yarrick commented Sep 5, 2022

I don't see any reason why this would be platform dependent. Was the shown server address the expected one?

Can you capture the traffic the server receives and see if it gets anything? If it doesn't, log the traffic from the client instead.

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

@yarrick I believe the server is not getting much

Here is a tcpdump from the server
`
20:50:42.488312 IP CLIENT_HOST.49404 > SERVER_HOST: 15559 [1au] NULL? yrb2g3.i.xxx.ch. (46)
20:50:42.488358 IP SERVER_HOST > CLIENT_HOST.49404: 15559*- 1/0/0 NULL (95)
20:50:42.541037 IP CLIENT_HOST.32893 > SERVER_HOST: 34115 [1au] NULL? vaaaakatq1y.i.xxx.ch. (51)
20:50:42.541087 IP SERVER_HOST > CLIENT_HOST.32893: 34115*- 1/0/0 NULL (61)
20:50:42.575760 IP CLIENT_HOST.43250 > SERVER_HOST: 33374 [1au] NULL? lafn21fagia4hei41nm3thkjw12fhbxy.i.xxx.ch. (72)
20:50:42.575812 IP SERVER_HOST > CLIENT_HOST.43250: 33374*- 1/0/0 NULL (102)
20:50:42.623234 IP CLIENT_HOST.43989 > SERVER_HOST: 37209 [1au] NULL? ib2ha.i.xxx.ch. (45)
20:50:42.623278 IP SERVER_HOST > CLIENT_HOST.43989: 37209*- 1/0/0 NULL (51)

Here is attempting a raw login. But no packets are received.

20:50:52.673019 IP CLIENT_HOST.16436 > SERVER_HOST: 3248 [1au] NULL? yrb2hb.i.xxx.ch. (46)
20:50:52.673060 IP SERVER_HOST > CLIENT_HOST.16436: 3248*- 1/0/0 NULL (95)
20:50:52.705864 IP CLIENT_HOST.10573 > SERVER_HOST: 62007 [1au] NULL? z2hcaA-Aaahhh-Drink-mal-ein-JM-dgermeister-.i.xxx.ch. (81)
20:50:52.705909 IP SERVER_HOST > CLIENT_HOST.10573: 62007*- 1/0/0 NULL (124)
20:50:52.743013 IP CLIENT_HOST.28193 > SERVER_HOST: 49625 [1au] NULL? z2hdaA-La-flM-{te-naM-ove-franM-gaise-est-retirM-i-M--CrM-hte.i.xxx.ch. (90) 20:50:52.743059 IP SERVER_HOST > CLIENT_HOST.28193: 49625*- 1/0/0 NULL (142) 20:50:52.773017 IP CLIENT_HOST.10179 > SERVER_HOST: 9784 [1au] NULL? z2heaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ.i.xxx.ch. (96) 20:50:52.773062 IP SERVER_HOST > CLIENT_HOST.10179: 9784*- 1/0/0 NULL (154) 20:50:52.812981 IP CLIENT_HOST.47421 > SERVER_HOST: 12576 [1au] NULL? z2hfaA0123456789M-<M-=M->[email protected]. (76) 20:50:52.813026 IP SERVER_HOST > CLIENT_HOST.47421: 12576*- 1/0/0 NULL (114) 20:50:52.856067 IP CLIENT_HOST.53903 > SERVER_HOST: 14932 [1au] NULL? z2hgaAM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[M-\M-]M-^M-_M-M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}.i.xxx.ch. (92)
20:50:52.856109 IP SERVER_HOST > CLIENT_HOST.53903: 14932*- 1/0/0 NULL (146)
20:50:52.903499 IP CLIENT_HOST.50250 > SERVER_HOST: 3459 [1au] NULL? sbh2hh.i.xxx.ch. (46)
20:50:52.903541 IP SERVER_HOST > CLIENT_HOST.50250: 3459*- 1/0/0 NULL (54)
20:50:52.933015 IP CLIENT_HOST.53838 > SERVER_HOST: 34733 [1au] NULL? obl2hi.i.xxx.ch. (46)
20:50:52.933055 IP SERVER_HOST > CLIENT_HOST.53838: 34733*- 1/0/0 NULL (51)
20:50:52.963017 IP CLIENT_HOST.33519 > SERVER_HOST: 23488 [1au] A? M-MNM-QM-g.i.xxx.ch. (44)
20:50:53.153716 IP CLIENT_HOST.33519 > SERVER_HOST: 23488 [1au] A? M-MNM-QM-g.i.xxx.ch. (44)
20:50:53.972942 IP CLIENT_HOST.11145 > SERVER_HOST: 23794 [1au] A? M-URM-SM-h.i.xxx.ch. (44)
20:50:54.172930 IP CLIENT_HOST.11145 > SERVER_HOST: 23794 [1au] A? M-URM-SM-h.i.xxx.ch. (44)
20:50:54.972971 IP CLIENT_HOST.51071 > SERVER_HOST: 21269 [1au] A? M-]VM-UM-i.i.xxx.ch. (44)
20:50:55.202964 IP CLIENT_HOST.51071 > SERVER_HOST: 21269 [1au] A? M-]VM-UM-i.i.xxx.ch. (44)
`

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

And here is the client side:

`20:56:52.712790 IP CLIENT_HOST.61189 > SERVER_HOST: 22800+ NULL? yrbhd4.i.xxx.ch. (35)
20:56:52.741116 IP SERVER_HOST > CLIENT_HOST.61189: 22800*- 1/0/0 NULL (95)
20:56:52.754140 IP CLIENT_HOST.61189 > SERVER_HOST: 30527+ NULL? vaaaakau2p2.i.xxx.ch. (40)
20:56:52.781092 IP SERVER_HOST > CLIENT_HOST.61189: 30527*- 1/0/0 NULL (61)
20:56:52.781336 IP CLIENT_HOST.61189 > SERVER_HOST: 38254+ NULL? laao3ymf4w1xnb5urkajqhygy24szzaa.i.xxx.ch. (61)
20:56:52.821065 IP SERVER_HOST > CLIENT_HOST.61189: 38254*- 1/0/0 NULL (102)
20:56:52.830407 IP CLIENT_HOST.61189 > SERVER_HOST: 45981+ NULL? iaheb.i.xxx.ch. (34)
20:56:52.861938 IP SERVER_HOST > CLIENT_HOST.61189: 45981*- 1/0/0 NULL (51)

Here the client tries to do raw login. Again, nothing is recorded.

20:57:02.873050 IP CLIENT_HOST.61189 > SERVER_HOST: 53708+ [1au] NULL? yrbhec.i.xxx.ch. (46)
20:57:02.877600 IP SERVER_HOST > CLIENT_HOST.61189: 53708*- 1/0/0 NULL (95)
20:57:02.877809 IP CLIENT_HOST.61189 > SERVER_HOST: 61435+ [1au] NULL? zhedaA-Aaahhh-Drink-mal-ein-JM-dgermeister-.i.xxx.ch. (81)
20:57:02.882235 IP SERVER_HOST > CLIENT_HOST.61189: 61435*- 1/0/0 NULL (124)
20:57:02.882471 IP CLIENT_HOST.61189 > SERVER_HOST: 3626+ [1au] NULL? zheeaA-La-flM-{te-naM-ove-franM-gaise-est-retirM-i-M--CrM-hte.i.xxx.ch. (90) 20:57:02.887607 IP SERVER_HOST > CLIENT_HOST.61189: 3626*- 1/0/0 NULL (142) 20:57:02.887699 IP CLIENT_HOST.61189 > SERVER_HOST: 11353+ [1au] NULL? zhefaAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ.i.xxx.ch. (96) 20:57:02.892194 IP SERVER_HOST > CLIENT_HOST.61189: 11353*- 1/0/0 NULL (154) 20:57:02.892295 IP CLIENT_HOST.61189 > SERVER_HOST: 19080+ [1au] NULL? zhegaA0123456789M-<M-=M->[email protected]. (76) 20:57:02.897687 IP SERVER_HOST > CLIENT_HOST.61189: 19080*- 1/0/0 NULL (114) 20:57:02.897975 IP CLIENT_HOST.61189 > SERVER_HOST: 26807+ [1au] NULL? zhehaAM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[M-\M-]M-^M-_M-M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}.i.xxx.ch. (92)
20:57:02.905203 IP SERVER_HOST > CLIENT_HOST.61189: 26807*- 1/0/0 NULL (146)
20:57:02.905483 IP CLIENT_HOST.61189 > SERVER_HOST: 34534+ [1au] NULL? sahhei.i.xxx.ch. (46)
20:57:02.910451 IP SERVER_HOST > CLIENT_HOST.61189: 34534*- 1/0/0 NULL (54)
20:57:02.910723 IP CLIENT_HOST.61189 > SERVER_HOST: 42261+ [1au] NULL? oalhej.i.xxx.ch. (46)
20:57:02.916391 IP SERVER_HOST > CLIENT_HOST.61189: 42261*- 1/0/0 NULL (51)
20:57:02.916673 IP CLIENT_HOST.61189 > SERVER_HOST: 49988+ [1au] NULL? rayadM-CNrOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-C.IM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CI.M-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-O.OM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OOM-RQvkM-CIM-OO.M-RQvk.i.xxx.ch. (281)
20:57:02.927603 IP SERVER_HOST > CLIENT_HOST.61189: 49988*- 1/0/0 NULL (1050)
20:57:02.927828 IP CLIENT_HOST.61189 > SERVER_HOST: 57715+ [1au] NULL? rbeadM-CM-er4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-C.M-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-.M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o.4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4M-ZUxlM-CM-M-o4.M-ZUxl.i.xxx.ch. (281)
20:57:02.936853 IP SERVER_HOST > CLIENT_HOST.61189: 57715*- 1/0/0 NULL (1434)
20:57:02.937274 IP CLIENT_HOST.61189 > SERVER_HOST: 65442+ [1au] NULL? rbkadM-DNrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-D.JrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJ.rM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJr.M-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-FM-bYzmM-DJrM-F.M-bYzm.i.xxx.ch. (281)
20:57:03.942096 IP CLIENT_HOST.61189 > SERVER_HOST: 7633+ [1au] NULL? rbkadM-DM-erM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-D.M-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-a.XM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aX.M-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-VM-j2BnM-DM-aXM-V.M-j2Bn.i.xxx.ch. (281)
`

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

Was the shown server address the expected one?

Oh sorry I forgot to answer this. --> Yes, the server address is the correct one.

@yarrick
Copy link
Owner

yarrick commented Sep 5, 2022

Is the SERVER_HOST the same as where the client is trying to log in with raw mode? From Server is at xxx.xxx.xxx.xxx, trying raw login

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

Is the SERVER_HOST the same as where the client is trying to log in with raw mode? From Server is at xxx.xxx.xxx.xxx, trying raw login

Yes

@yarrick
Copy link
Owner

yarrick commented Sep 5, 2022

The raw login is not a packet following the DNS format, but still using port 53. Could tcpdump possibly filter them out?

Can you post your current tcpdump command? Can you run it with -x so the packet contents are printed and just filter by udp port?

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

This is the tcpdump command I executed, I think it should be correct.
sudo tcpdump -i eth0 udp port 53

Do you want me to run it differently?

@yarrick
Copy link
Owner

yarrick commented Sep 5, 2022

That should be fine. This is how it looks for me:

21:16:51.274041 IP 10.4.4.232.51796 > a.b.c.d.domain: 4305 op3 FormErr*-| [19005q] [|domain]
21:16:51.274381 IP a.b.c.d.domain > 10.4.4.232.51796: 4305 op3 FormErr*-| [59537q] [|domain]

Is there any firewall thing that could block it?

@Mrc527
Copy link
Author

Mrc527 commented Sep 5, 2022

Nope, same network as the windows device, which works perfectly.

iOS (both iPad and iPhone) and macOS are not 😞

@Mrc527
Copy link
Author

Mrc527 commented Sep 6, 2022

I also tried with an older Mac, just to rule out the possibility it's a newer macOS security policy.

If that's the problem, it's there since Big Sur (11.6.2)

@yarrick
Copy link
Owner

yarrick commented Sep 6, 2022

I was just about to ask if this was iOS only. By firewall I meant some software running on the client device that could filter this traffic out

@Mrc527
Copy link
Author

Mrc527 commented Sep 6, 2022

There is just the standard macOS firewall active but that's only filtering incoming connection (and I allowed iodine).
On the second macOS test machine, there is no firewall. As well as on iOS (bot iPad and iPhone): no firewall of sort.

@Mrc527
Copy link
Author

Mrc527 commented Sep 14, 2022

Anything else we could try?

@yarrick
Copy link
Owner

yarrick commented Sep 19, 2022

I don't have any ideas. It would be interesting to know if other users are seeing this as well - the feature has existed a few years without earlier mentions of this.

@Mrc527
Copy link
Author

Mrc527 commented Sep 20, 2022

Can it be a server issue? I mean, I tried with multiple clients and all of the macOs-like behave the same.
I also tried with other laptops, borrowed from friends with the same result.

The only thing I did not change is the server, maybe you could setup a server and share the link with me to see if we can understand what happens. 🤷‍♂️

@Mrc527
Copy link
Author

Mrc527 commented Oct 25, 2022

FYI I tried on newest MacOS / iOS releases (Ventura and iOS/iPadOS 16.1) and the issue is still there 😞

@yarrick
Copy link
Owner

yarrick commented Oct 26, 2022

Since we didnt see the login packet leave the client I find it hard to blame the server.

@Tabiskabis
Copy link

I experience the same problem with a client on MacOS Mojave (10.14). The login packet(s) apparently is never sent, only standard dns is captured on tcpdump (on client), no "malformed" packets leave the interface. Built from tag v0.8.0.

@LenaWil
Copy link
Contributor

LenaWil commented Jun 19, 2023

How are you running it on iOS btw? Did you jailbreak your device?

@Mrc527
Copy link
Author

Mrc527 commented Jun 19, 2023

I'm using it via Purple Haze, no jeailbreak.

But it's affected by this issue, quite annoying as it limits the bandwidth on many networks

@yarrick
Copy link
Owner

yarrick commented Jun 28, 2023

Can someone record a log what strace says while the raw login is attempted? Would be interesting to know the sendto() return value

@Tabiskabis
Copy link

sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0

Does this help? I'm clueless of coding, let alone debugging, at this level.

full dtrace of "trying raw login" dtrace: system integrity protection is on, some features will not be available

...
Requesting server address to attempt raw UDP mode (skip with -r)
Server is at xxxxxxxx, trying raw login: (skip with -r) select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 185 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 132 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 132 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 142 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 181 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 207 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 207 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 142 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 142 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 207 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 207 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45660, 0x24) = 36 0
select(0x5, 0x7FFEEDB464E0, 0x0, 0x0, 0x7FFEEDB464D0) = 1 0
recvfrom(0x4, 0x7FFEEDB36410, 0x10000) = 207 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB447C0, 0x29) = 41 0
select(0x5, 0x7FFEEDB464F0, 0x0, 0x0, 0x7FFEEDB464E0) = 1 0
recvfrom(0x4, 0x7FFEEDB36420, 0x10000) = 74 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB446E0, 0x3E) = 62 0
select(0x5, 0x7FFEEDB46460, 0x0, 0x0, 0x7FFEEDB46450) = 1 0
recvfrom(0x4, 0x7FFEEDB36390, 0x10000) = 133 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sigaction(0x2, 0x7FFEEDB46428, 0x7FFEEDB46460) = 0 0
sigaction(0x3, 0x7FFEEDB46428, 0x7FFEEDB46470) = 0 0
sigprocmask(0x1, 0x7FFEEDB46480, 0x7FFEEDB46484) = 0x0 0
posix_spawn(0x7FFEEDB46494, 0x7FFF69687256, 0x7FFEEDB463A0) = 0 0
wait4_nocancel(0x2DB7, 0x7FFEEDB4649C, 0x0) = 11703 0
sigaction(0x2, 0x7FFEEDB46428, 0x0) = 0 0
sigaction(0x3, 0x7FFEEDB46428, 0x0) = 0 0
sigprocmask(0x3, 0x7FFEEDB46484, 0x0) = 0x0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sigaction(0x2, 0x7FFEEDB46428, 0x7FFEEDB46460) = 0 0
sigaction(0x3, 0x7FFEEDB46428, 0x7FFEEDB46470) = 0 0
sigprocmask(0x1, 0x7FFEEDB46480, 0x7FFEEDB46484) = 0x0 0
posix_spawn(0x7FFEEDB46494, 0x7FFF69687256, 0x7FFEEDB463A0) = 0 0
wait4_nocancel(0x2DB8, 0x7FFEEDB4649C, 0x0) = 11704 0
sigaction(0x2, 0x7FFEEDB46428, 0x0) = 0 0
sigaction(0x3, 0x7FFEEDB46428, 0x0) = 0 0
sigprocmask(0x3, 0x7FFEEDB46484, 0x0) = 0x0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sigaction(0x2, 0x7FFEEDB464B8, 0x7FFEEDB464F0) = 0 0
sigaction(0x3, 0x7FFEEDB464B8, 0x7FFEEDB46500) = 0 0
sigprocmask(0x1, 0x7FFEEDB46510, 0x7FFEEDB46514) = 0x0 0
posix_spawn(0x7FFEEDB46524, 0x7FFF69687256, 0x7FFEEDB46430) = 0 0
wait4_nocancel(0x2DB9, 0x7FFEEDB4652C, 0x0) = 11705 0
sigaction(0x2, 0x7FFEEDB464B8, 0x0) = 0 0
sigaction(0x3, 0x7FFEEDB464B8, 0x0) = 0 0
sigprocmask(0x3, 0x7FFEEDB46514, 0x0) = 0x0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB45590, 0x23) = 35 0
select(0x5, 0x7FFEEDB463F0, 0x0, 0x0, 0x7FFEEDB463E0) = 1 0
recvfrom(0x4, 0x7FFEEDB36320, 0x10000) = 61 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB456F0, 0x14) = -1 Err#22
.select(0x5, 0x7FFEEDB467F8, 0x0, 0x0, 0x7FFEEDB46880) = 0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB456F0, 0x14) = -1 Err#22
.select(0x5, 0x7FFEEDB467F8, 0x0, 0x0, 0x7FFEEDB46880) = 0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB456F0, 0x14) = -1 Err#22
.select(0x5, 0x7FFEEDB467F8, 0x0, 0x0, 0x7FFEEDB46880) = 0 0
dtrace: error on enabled probe ID 2173 (ID 949: syscall::write_nocancel:return): invalid kernel access in action #12 at DIF offset 68
sendto(0x4, 0x7FFEEDB456F0, 0x14) = -1 Err#22
.failed

@yarrick
Copy link
Owner

yarrick commented Jul 2, 2023

Thanks, it looks like the sendto() call doesn't immediately fail at least. I guess something else is filtering it out

edit: Unless the dtrace errors actually mean that something failed

@Tabiskabis
Copy link

edit: Unless the dtrace errors actually mean that something failed

The log is full of this specific error, that is apparently caused by System Integrity Protection.

@Mrc527
Copy link
Author

Mrc527 commented Jul 3, 2023

edit: Unless the dtrace errors actually mean that something failed

The log is full of this specific error, that is apparently caused by System Integrity Protection.

This makes a lot of sense, to me it's evident this is a (security) limitation imposed by Apple somehow.

@yarrick
Copy link
Owner

yarrick commented Jul 3, 2023

It would be interesting to see if this still happens with SIP off

@Tabiskabis
Copy link

Did csrutil clear; csrutil enable --without dtrace and now the output looks entirely different.
sendto fails with -1 Err#22 iodtruss.txt

@Bubba8291
Copy link

Any progress? I am having this issue as well.

@yarrick
Copy link
Owner

yarrick commented Aug 23, 2023

I don't have an apple machine so it is not easy for me to debug.

Can someone test with the mac running iodined and see if it can accept incoming raw login packets (with pcap)? Can be done inside a lan with a fake domain

@Bubba8291
Copy link

@yarrick From looking in wireshark, it seems to not be sending the raw login packet at all.

iodine1.txt
iodine2.txt

iodine1.txt was ran with iodine exiting from this cli output:

got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
..768 not ok.. got BADIP (Try iodined -c)..
..got BADIP (Try iodined -c)..
.384 not ok.. got BADIP (Try iodined -c)..
...192 not ok.. got BADIP (Try iodined -c)..
...96 not ok.. .got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.48 not ok.. got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.24 not ok.. got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.12 not ok.. got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.6 not ok.. got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.3 not ok.. got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.got BADIP (Try iodined -c)..
.2 not ok.. 
iodine: found no accepted fragment size.
iodine: try setting -M to 200 or lower, or try other -T or -O options.

iodine2.txt was ran and didn't error but gave this output before I stopped iodine:

Connection setup complete, transmitting data.
iodine: Got SERVFAIL as reply: server failed or recursion timeout
iodine: Hmm, that's 1. Your data should still go through...
iodine: Got SERVFAIL as reply: server failed or recursion timeout
iodine: Hmm, that's 2. Your data should still go through...

So there seems to be some inconsistency with the packets as well. Also, I was using Google's dns server (8.8.8.8) as the upstream.

@m0yellow
Copy link

m0yellow commented Aug 28, 2023

macOS ventura 13.5 (22G74) here, I'm not seeing this problem,

Requesting server address to attempt raw UDP mode (skip with -r) 
Server is at 192.0.2.76, trying raw login: (skip with -r) OK
Sending raw traffic directly to 192.0.2.76
Connection setup complete, transmitting data.
Detaching from terminal...

and my csr status seems to be intact:

System Integrity Protection status: enabled.

I'm starting it as root, as I assume this is needed for creation of the utun device.
I'm not using the current master from github, but the one via macports, version: 0.7.0 from 2014-06-16.
this is fairly old, but did transport data in my short test paired against a rpm Version of that same version.

@Bubba8291
Copy link

@m0yellow Are you specifying the tunneling device?

On 0.7.0, I get the error: iodine: open_tun: Failed to open tunneling device: No such file or directory

On 0.8.0, I get this output:

No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy

If I specify the tunnel utun on 0.7.0, I get this error: iodine: open_tun: /dev/utun: No such file or directory: No such file or directory

I am on macOS Ventura 13.5.1. SIP is enabled. One thing I did different is I built 0.7.0 from source by checking out the 0.7.0 branch instead of installing it via macports.

@Bubba8291
Copy link

Something else I noticed was that when I leave the ping command running, there are a few times where it gets a response. The rest say Request timeout.

PING 172.16.0.1 (172.16.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
...
Request timeout for icmp_seq 27
64 bytes from 172.16.0.1: icmp_seq=0 ttl=64 time=29041.657 ms
Request timeout for icmp_seq 29
...
Request timeout for icmp_seq 40
64 bytes from 172.16.0.1: icmp_seq=41 ttl=64 time=56.456 ms
64 bytes from 172.16.0.1: icmp_seq=42 ttl=64 time=55.863 ms
Request timeout for icmp_seq 43
..
Request timeout for icmp_seq 64
64 bytes from 172.16.0.1: icmp_seq=65 ttl=64 time=60.966 ms
Request timeout for icmp_seq 66
...
Request timeout for icmp_seq 69
64 bytes from 172.16.0.1: icmp_seq=70 ttl=64 time=55.671 ms
64 bytes from 172.16.0.1: icmp_seq=71 ttl=64 time=58.137 ms
Request timeout for icmp_seq 72
...

@Mrc527
Copy link
Author

Mrc527 commented Aug 29, 2023

@m0yellow Are you specifying the tunneling device?

On 0.7.0, I get the error: iodine: open_tun: Failed to open tunneling device: No such file or directory

On 0.8.0, I get this output:

No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy

If I specify the tunnel utun on 0.7.0, I get this error: iodine: open_tun: /dev/utun: No such file or directory: No such file or directory

I am on macOS Ventura 13.5.1. SIP is enabled. One thing I did different is I built 0.7.0 from source by checking out the 0.7.0 branch instead of installing it via macports.

I installed iodine (0.8) with brew. I get the following, in the beginning:
No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
Opened utun8
Opened IPv4 UDP socket

I think it is cycling through all the tun devices until one free is found. In fact, after this message, it works normally (except for the raw tunnel of course).

@m0yellow if you have brew, can you try installing it via brew and test if that version works for you with the raw tunnel?
You're the first one which does not have the issue, I also have it on iOS and iPadOS so hopefully it's just about the way the binary is compiled. Maybe the macports version is coming with a different signature which allows SIP not to block the raw tunnel packets. Finger Crossed 😄

@m0yellow
Copy link

Something else I noticed was that when I leave the ping command running, there are a few times where it gets a response. The rest say Request timeout.

PING 172.16.0.1 (172.16.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
...
Request timeout for icmp_seq 27
64 bytes from 172.16.0.1: icmp_seq=0 ttl=64 time=29041.657 ms
Request timeout for icmp_seq 29
...
Request timeout for icmp_seq 40
64 bytes from 172.16.0.1: icmp_seq=41 ttl=64 time=56.456 ms
64 bytes from 172.16.0.1: icmp_seq=42 ttl=64 time=55.863 ms
Request timeout for icmp_seq 43
..
Request timeout for icmp_seq 64
64 bytes from 172.16.0.1: icmp_seq=65 ttl=64 time=60.966 ms
Request timeout for icmp_seq 66
...
Request timeout for icmp_seq 69
64 bytes from 172.16.0.1: icmp_seq=70 ttl=64 time=55.671 ms
64 bytes from 172.16.0.1: icmp_seq=71 ttl=64 time=58.137 ms
Request timeout for icmp_seq 72
...

reads like a query limit on the DNS Server relaying the tunnel packets to me. Are you able to try raw mode?

@m0yellow
Copy link

@m0yellow if you have brew, can you try installing it via brew and test if that version works for you with the raw tunnel?
You're the first one which does not have the issue, I also have it on iOS and iPadOS so hopefully it's just about the way the binary is compiled. Maybe the macports version is coming with a different signature which allows SIP not to block the raw tunnel packets. Finger Crossed 😄

As I don't use brew, I reproduced the brew build by looking it up manually:
https://github.com/Homebrew/homebrew-core/blob/ee753ad6ce966ab68bd282f1242f14a63916867e/Formula/i/iodine.rb
shows there is no special formulae except setting the prefix.
I built as non root in a local directory, started it, and got "bad encoding" on raw mode. This can be caused in the non-updated server, or being the server on linux.

Does it help to produce a pcap of the raw exchange? I'll try now for curiosity, and upload if anybody is willing to look at it.

@Mrc527
Copy link
Author

Mrc527 commented Aug 29, 2023

@m0yellow if you have brew, can you try installing it via brew and test if that version works for you with the raw tunnel?
You're the first one which does not have the issue, I also have it on iOS and iPadOS so hopefully it's just about the way the binary is compiled. Maybe the macports version is coming with a different signature which allows SIP not to block the raw tunnel packets. Finger Crossed 😄

As I don't use brew, I reproduced the brew build by looking it up manually: https://github.com/Homebrew/homebrew-core/blob/ee753ad6ce966ab68bd282f1242f14a63916867e/Formula/i/iodine.rb shows there is no special formulae except setting the prefix. I built as non root in a local directory, started it, and got "bad encoding" on raw mode. This can be caused in the non-updated server, or being the server on linux.

Does it help to produce a pcap of the raw exchange? I'll try now for curiosity, and upload if anybody is willing to look at it.

Yeah, I also get some bad encoding but that's not a big deal.
I don't know, I'm on Ventura 13.5 (22G74), my SIP status is custom as I'm on an old machine which is technically unsupported but I tested the same behaviour on multiple genuine machines, starting from Big Sur (11.6.2) onwards.

And given I also get the same on iPad and iPhone, I guess it's somehow related to a security measure by Apple. But I cannot explain why it works for you.

Maybe it's because your server is on the same LAN as your machine? Maybe connecting to a local host is not triggering the Apple security.

Can you try setting up the server on a public IP and connecting to that via internet (like tethering from your mobile) please?
This is my best explanation.

@Tabiskabis
Copy link

MacOS and iOS Darwin are FreeBSD based. And there are stackoverflow questions that mention error22 EINVAL on BSD/Mac in context of raw UDP, when the same code works on Linux. The details are way beyond me, but maybe you can use FreeBSD to debug that Mac stuff? :)

@Bubba8291
Copy link

Something else I noticed was that when I leave the ping command running, there are a few times where it gets a response. The rest say Request timeout.

PING 172.16.0.1 (172.16.0.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
...
Request timeout for icmp_seq 27
64 bytes from 172.16.0.1: icmp_seq=0 ttl=64 time=29041.657 ms
Request timeout for icmp_seq 29
...
Request timeout for icmp_seq 40
64 bytes from 172.16.0.1: icmp_seq=41 ttl=64 time=56.456 ms
64 bytes from 172.16.0.1: icmp_seq=42 ttl=64 time=55.863 ms
Request timeout for icmp_seq 43
..
Request timeout for icmp_seq 64
64 bytes from 172.16.0.1: icmp_seq=65 ttl=64 time=60.966 ms
Request timeout for icmp_seq 66
...
Request timeout for icmp_seq 69
64 bytes from 172.16.0.1: icmp_seq=70 ttl=64 time=55.671 ms
64 bytes from 172.16.0.1: icmp_seq=71 ttl=64 time=58.137 ms
Request timeout for icmp_seq 72
...

reads like a query limit on the DNS Server relaying the tunnel packets to me. Are you able to try raw mode?

@m0yellow This output was with raw mode failing from the client when I ran this

@m0yellow
Copy link

This output was with raw mode failing from the client when I ran this

I missed that detail. Thanks for pointing it out.
The strange thing is, I can't reproduce the raw mode failing anymore.

To write things clear: I had 0.7.0 running fine, now I have 0.8.0 running fine on macOS, connecting to a linux VM remotely. Pinging in the tunnel works. As the VM is far away, I can't tell if Jitter is network jitter, or implementation wise.

Any ideas how I can reproduce the problems?
my setup is a macbook running ventura latest and hopefully greatest as of today, and a linux vm x86_64 running 6.4.11.

@Mrc527
Copy link
Author

Mrc527 commented Aug 30, 2023

@m0yellow So even connecting to a public IP (not in the reserved/private space) works for you?

This is really mysterious then, as I still have the same issues as always.

I’m currently updating to 13.5.1 but I do not think this will make any difference, unfortunately.

UPDATE: it does not work even with 13.5.1 😞

I repeated the test and I could not see any outgoing RAW UDP packet going out of my machine, tested with WireShark.

Would be nice if we could analyse the macOS logs to see what/why is blocking those packages…any clue?

P.S. @m0yellow I’m trying with both firewall on and off. I also manually disabled the Packet Filter with pfctl -e. What is your setup?

@m0yellow
Copy link

m0yellow commented Aug 30, 2023

to help you debug, I summarize my setup.
mac, macports, iodine installed from macports at first, then later switched to local directory for testing different versions.
firewall is off, as I use 3rd party tools.
I'm testing across the internet, so my iodined runs on a linux vm in another country (on a public IP).
The check tool https://code.kryo.se/iodine/check-it/ reports my server as working.

My tests are of mixed results. Sometimes it works fine, sometimes not. Currently ....

246 packets transmitted, 17 packets received, 93.1% packet loss
round-trip min/avg/max/stddev = 183.244/17482.470/31660.658/10157.610 ms

after restarting, I couldn't setup the tunnel:

No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
Opened utun5
Opened IPv4 UDP socket
Sending DNS queries for e.ge.tld to 9.9.9.9
Autodetecting DNS query type (use -T to override).......
Using DNS type NULL queries
iodine: Received unsupported encoding
Retrying version check...
iodine: Received unsupported encoding
Retrying version check...
Version ok, both using protocol v 0x00000502. You are user #3
Retrying login...
Setting IP of utun5 to 10.10.10.5
Adding route 10.10.0.0/2644 to 10.10.10.5
add net 10.10.0.0: gateway 10.10.10.5
Setting MTU of utun5 to 1130
Server tunnel IP is 10.10.10.1
Requesting server address to attempt raw UDP mode (skip with -r) iodine: Received unsupported encoding
.iodine: Received unsupported encoding
.iodine: Received unsupported encoding
.
Failed to get raw server IP, will use DNS mode.
iodine: Received unsupported encoding
Retrying EDNS0 support test...
Using EDNS0 extension
iodine: Received unsupported encoding
Retrying upstream codec test...
Retrying upstream codec test...
iodine: Received unsupported encoding
Retrying upstream codec test...
Switching upstream to codec Base128
iodine: Received unsupported encoding
Retrying codec switch...
iodine: Received unsupported encoding
Retrying codec switch...
Server switched upstream to codec Base128
No alternative downstream codec available, using default (Raw)
Switching to lazy mode for low-latency
iodine: Received unsupported encoding
Retrying lazy mode switch...
Retrying lazy mode switch...
iodine: Received unsupported encoding
Retrying lazy mode switch...
iodine: Received unsupported encoding
Retrying lazy mode switch...
iodine: Received unsupported encoding
Retrying lazy mode switch...
No reply from server on lazy switch. Falling back to legacy mode
Autoprobing max downstream fragment size... (skip with -m fragsize)
...768 not ok.. ...384 not ok.. ...192 not ok.. ...96 not ok.. ...48 not ok.. ...24 not ok.. ...12 not ok.. ...6 not ok.. ...3 not ok.. ...2 not ok.. 
iodine: found no accepted fragment size.
iodine: try setting -M to 200 or lower, or try other -T or -O options.

doing another try right after it:

./iodine -f -P HmluIC9qXkbpCjnm e.ge.tld
No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
Opened utun5
Opened IPv4 UDP socket
Sending DNS queries for e.ge.tld to 9.9.9.9
Autodetecting DNS query type (use -T to override).iodine: Received unsupported encoding
......iodine: Received unsupported encoding
...
Using DNS type NULL queries
iodine: Received unsupported encoding
Retrying version check...
Version ok, both using protocol v 0x00000502. You are user #1
Setting IP of utun5 to 10.10.10.3
Adding route 10.10.0.0/2644 to 10.10.10.3
add net 10.10.0.0: gateway 10.10.10.3
Setting MTU of utun5 to 1130
Server tunnel IP is 10.10.10.1
Requesting server address to attempt raw UDP mode (skip with -r) iodine: Received unsupported encoding
.iodine: Received unsupported encoding
.
Server is at 192.0.2.76, trying raw login: (skip with -r) OK
Sending raw traffic directly to 192.0.2.76
Connection setup complete, transmitting data.
iodine: No downstream data received in 60 seconds, shutting down.

this could be related to a bad and probably very cheap NAT implementation on the local DSL modem, but as I said, my results vary.

Edit: as I was so carelessly to post my full command line here, I had to change the secret ¯_(ツ)_/¯

@m0yellow
Copy link

Update:
Just by restarting it with the local resolver of the DSL modem configured, I got a working raw tunnel:

./iodine -P HmluIC9qXkbpCjnm 192.168.2.1 e.ge.tld
No tun devices found, trying utun
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
iodine: open_utun: connect: Resource busy
Opened utun5
Opened IPv4 UDP socket
Sending DNS queries for e.ge.tld to 192.168.2.1
Autodetecting DNS query type (use -T to override)......iodine: Got REFUSED as reply
...iodine: Got REFUSED as reply

Using DNS type TXT queries
Version ok, both using protocol v 0x00000502. You are user #0
Setting IP of utun5 to 10.10.10.2
Adding route 10.10.10.0/26 to 10.10.10.2
add net 10.10.10.0: gateway 10.10.10.2
Setting MTU of utun5 to 1130
Server tunnel IP is 10.10.10.1
Requesting server address to attempt raw UDP mode (skip with -r) 
Server is at 192.0.2.76, trying raw login: (skip with -r) ....failed
Using EDNS0 extension
Retrying upstream codec test...
Retrying upstream codec test...
iodine: Got REFUSED as reply
Retrying upstream codec test...
Retrying upstream codec test...
iodine: Got REFUSED as reply
Retrying upstream codec test...
Retrying upstream codec test...
iodine: Got REFUSED as reply
Keeping upstream codec Base32
Autodetecting downstream codec (use -O to override)
Switching downstream to codec Raw
Server switched downstream to codec Raw
Switching to lazy mode for low-latency
Server switched to lazy mode
Autoprobing max downstream fragment size... (skip with -m fragsize)
768 ok.. ...1152 not ok.. ...960 not ok.. 864 ok.. 912 ok.. ...936 not ok.. ...924 not ok.. will use 912-2=910
Setting downstream fragment size to max 910...
Connection setup complete, transmitting data.
Detaching from terminal...

@Mrc527
Copy link
Author

Mrc527 commented Aug 30, 2023

Ok, any chance you could share your server details with me maybe over a secure private chat. I try your server and we rule out the possibility that it’s due to my server setup.

Now I’m questioning each and every step I did… 🤦‍♂️

@Bubba8291
Copy link

@Mrc527 @m0yellow I just had a thought. I'm not sure if it makes much of a difference here, but I've noticed upstream providers can be a bit wonky with Iodine. Like Cloudflare doesn't work with Iodine at all. What upstream dns provider are you using?

@Mrc527
Copy link
Author

Mrc527 commented Aug 31, 2023

@Mrc527 @m0yellow I just had a thought. I'm not sure if it makes much of a difference here, but I've noticed upstream providers can be a bit wonky with Iodine. Like Cloudflare doesn't work with Iodine at all. What upstream dns provider are you using?

I’m hosting iodine at my place, on my nas. Just my ISP in between.

@Bubba8291
Copy link

@Mrc527 @m0yellow I just had a thought. I'm not sure if it makes much of a difference here, but I've noticed upstream providers can be a bit wonky with Iodine. Like Cloudflare doesn't work with Iodine at all. What upstream dns provider are you using?

I’m hosting iodine at my place, on my nas. Just my ISP in between.

I meant what upstream dns provider do you use on your client machine?

@Mrc527
Copy link
Author

Mrc527 commented Aug 31, 2023

Ah sorry. I’m using a variety but I feel like using iodine itself is preferable if it works.

Let’s say, my public IP address is 1.2.3.4, I try to use 1.2.3.4 as upstream DNS first. If the network does not allow it, then I move to the standard provided by DHCP, then I try the usual ones, 8.8.8.8 (google) or 1.1.1.1.

But the RAW tunnel should not care much about this, as only a few queries are done to authenticate and get the server IP (and those work).

@m0yellow
Copy link

I can agree, we should have raw mode working reliably first.
On the location I'm currently at, the NAT seems to be broken.
iodine in raw mode stops after setup. later TX packages, as seen by the output of

LC_ALL=C luit iodined \-DD -c -P <insertpasswordhere> 10.0.0.1/26 <insert.your.base.NS.RR.here>

I can recommend to anybody having problems getting iodine to run, please watch your debug output, you might notice your questions are received, but the answer never reaches your client because of NAT issues as in my case.

Having said raw mode first, I still tested without raw (-r) with the following public recursors:
1.1.1.1, 4.2.2.1, 8.8.8.8, 9.9.9.9, 209.244.0.3, and only the google one works reliably with iodine so far. The one from the local provider, as requested through the dsl modem IP, was working from time to time, but maybe also relies on different recursors in the background. In the debug output I saw variing ISP DNS servers sending packets. @Mrc527: I as soon as I'm confident my setup and version works stable, you can have a test drive. For now I'm running in the foreground, watching debug lines fly by.

@Mrc527
Copy link
Author

Mrc527 commented Oct 1, 2023

@m0yellow do you have any news?

@Bubba8291
Copy link

As we have not currently made any progress, I was wondering if there are any settings I can change to make non-raw connections more efficient? I am mainly using PurpleHaze for the client and a Digital Ocean VM for the server.

@Bubba8291
Copy link

I started looking around. In the MacOS console when running iodine, there are these two lines that frequently repeat when it is attempting to make any connection including raw and non-raw.

[Q33512] Sent 57-byte query #194 to <IPv4:BBCUcCGU> over UDP via en0/6 -- id: 0x4B8E (19342), flags: 0x0100 (Q/Query, RD, NoError), counts: 1/0/0/0, BBHUvDkn IN SOA?
[Q33512] Received unacceptable 12-byte response from <IPv4:BBCUcCGU> over UDP via en0/6 -- id: 0x4B8E (19342), flags: 0x8002 (R/Query, ServFail), counts: 0/0/0/0,

@m0yellow
Copy link

@Mrc527 I currently do not get raw mode to work with NAT.
I'm trying to find time to evaluate if this can be changed by settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants