Skip to content

Initial attempt to bring networking to macOS#850

Open
baka0taku2022 wants to merge 5 commits into
SDL-Hercules-390:developfrom
baka0taku2022:develop
Open

Initial attempt to bring networking to macOS#850
baka0taku2022 wants to merge 5 commits into
SDL-Hercules-390:developfrom
baka0taku2022:develop

Conversation

@baka0taku2022

Copy link
Copy Markdown

@Fish-Git , @wrljet

What I have done here is to take the code supplied from Enrico and make it able to compile via autotools if it finds macOS 11 (Big Sur) or higher. This was the point where macOS stopped allowing 3rd party kernel extensions. That move effectively killed tun/tap support for macOS. I have tested that it builds on macOS 25 (Tahoe) with an Apple M3 Max (arm64) processor. I also attempted to add more comments and documentation. Please let me know what else I can do to get this up to snuff.

Simon

Also reconfigured aututools to make hercutun and hercifc setuid when utun is needed.
@Peter-J-Jansen

Copy link
Copy Markdown
Collaborator

Hi Simon @baka0taku2022 ,

I've successfully pulled your PR based on Enrico's work into a branch and built Hercules SDL-Hyperion from it. I'm now trying to test an x3270 session via the an utun CTCI. But I can't find the correct syntax documented as to how the utun CTCI must be configured in the .cnf file. Can you help please ?

Thanks,

Peter

@baka0taku2022

Copy link
Copy Markdown
Author

Peter,

NETDEV utunXX <- XX is the utun number that you want created
0500.2 CTCI

Both hercutun and hercifc need to be setuid for this to work. Please let me know if you have any issues.

Simon

@Peter-J-Jansen

Copy link
Copy Markdown
Collaborator

Hi Simon,

Has this NETDEV utunXX followed by 0500.2 CTCI worked for you? If it did, could you please show the Hercules log entries resulting from it? For me it doesn't, as even prior to trying to IPL a system it already gives errors.

NETDEV utun4  
0E24-0E25 CTCI

which results in

13:57:14 HHC02204I NETDEV         set to utun4
13:57:14 HHC01603I **0E24-0E25 CTCI
13:57:14 HHC00915E 0:0E25 CTCI: Incorrect number of parameters
13:57:14 HHC00007I Previous message from function 'ParseArgs' at ctc_ctci.c(1305)
13:57:14 HHC01463E 0:0E25 device initialization failed
13:57:14 HHC00007I Previous message from function 'attach_device' at config.c(1366)

Actually, if prefer not to use NETDEV as they are merely an alternative for the device coding in the CTCI (or other) network configuration statements. So I tried 0E24-0E25 CTCI utun4 which also didn't work :

14:02:27 HHC01603I **0E24-0E25 CTCI utun4
14:02:27 HHCXU901II About to fork()/exec(): hercutun -1   255.255.255.255
14:02:27 
14:02:27 HHCXU006EE Broken connection to hercutun process
14:02:27 
14:02:27 HHC00007I Previous message from function 'UTUN_Initialize' at utun.c(133)
14:02:27 HHCXU021EE hercutun argument error
14:02:27 
14:02:27 HHC00007I Previous message from function 'UTUN_Initialize' at utun.c(157)
14:02:27 HHC01463E 0:0E25 device initialization failed
14:02:27 HHC00007I Previous message from function 'attach_device' at config.c(1366)

I also tried adding the IP addresses, both for an IPv4 CTCI as well as for an IPv6 one :

14:07:32 HHC01603I **0E24-0E25 CTCI      utun4 172.29.6.241 172.29.3.24 255.255.255.0
14:07:32 HHC00915E 0:0E25 CTCI: Incorrect number of parameters
14:07:32 HHC00007I Previous message from function 'ParseArgs' at ctc_ctci.c(1627)
14:07:32 HHC01463E 0:0E25 device initialization failed
14:07:32 HHC00007I Previous message from function 'attach_device' at config.c(1366)
14:07:32 HHC01603I **0E26-0E27 CTCI      utun6 2a05:41c0:14:e261:1072:29:6:231 2a05:41c0:14:e201:1072:29:3:24
14:07:32 HHC00915E 0:0E27 CTCI: Incorrect number of parameters
14:07:32 HHC00007I Previous message from function 'ParseArgs' at ctc_ctci.c(1627)
14:07:32 HHC01463E 0:0E27 device initialization failed
14:07:32 HHC00007I Previous message from function 'attach_device' at config.c(1366)

In short, no success whatsoever with my attempts. Comments welcome!

Cheers,

Peter

@baka0taku2022

baka0taku2022 commented Jul 18, 2026

Copy link
Copy Markdown
Author

Peter,

I am so sorry about that. I forgot to add the source and destination IP addresses. Also the NETDEV statement is unnecessary.

Here is what works for me:

500.2 CTCI 192.168.1.98 192.168.1.99

The biggest caveat to this working is that both hercutun and hercifc need to be setuid.

this can be accomplished via the chmod command:
sudo chmod +s hercutun
sudo chmod +s hercifc

here are some excerpts from my hercules log (I have debugging turned on):

Device initialization:

09:44:23 config.c(1431)    HHC02198I Device 0500 type 3088 subchannel 0:0029 attached
09:44:23 utun.c(85)        HHCXU901II About to fork()/exec(): hercutun -1 192.168.1.99 192.168.1.98 255.255.255.255
09:44:23 utun.c(85)
09:44:23 ctc_ctci.c(296)   HHC00901I 0:0500 CTCI: Interface utun4, type TUN opened
09:44:23 HHC00149I IFC_IOCtl called for SIOCSIFADDR on FDs 20 21
09:44:23 HHC00149I IFC_IOCtl called for SIOCSIFDSTADDR on FDs 20 21
09:44:23 HHC00149I IFC_IOCtl called for SIOCSIFMTU on FDs 20 21
09:44:23 HHC00149I IFC_IOCtl called for SIOCSIFFLAGS on FDs 20 21
09:44:23 config.c(1431)    HHC02198I Device 0501 type 3088 subchannel 0:002A attached

hercifc setting the source address, destination address, MTU, and flags for the utun device.

09:44:23 HHC02499I Hercules utility hercifc - Hercules Network Interface Configuration Program - version 4.10.0.11729-SDL-DEV-gc7c0c789-modified
09:44:23 HHC01414I (C) Copyright 1999-2025 by Roger Bowler, Jan Jaeger, and others
09:44:23 HHC01417I Built for you with Hercules-Helper (version: v0.9.14-146-g68c426a-dirty)
09:44:23 HHC01415I Build date: Jul 18 2026 at 09:28:59
09:44:23 hercifc.c(252)    HHC00167D hercifc: Doing SIOCSIFADDR on utun4 ...
09:44:23 hercifc.c(252)    HHC00167D hercifc: Doing SIOCSIFDSTADDR on utun4 ...
09:44:23 hercifc.c(252)    HHC00167D hercifc: Doing SIOCSIFMTU on utun4 ...
09:44:23 hercifc.c(252)    HHC00167D hercifc: Doing SIOCSIFFLAGS on utun4 ...

Known bug: sometimes you will have to force quit hercules due to the interface not closing properly.

Hope this helps,
Simon

@Peter-J-Jansen

Copy link
Copy Markdown
Collaborator

Hi Simon,

It certainly did help. I got the same messages in the Hercules log, except for the HHC00149I ones, which I think were created tracing things. How did you create these please?

The CTCI device I defined in z/VM 7.3 however does not work for me, the device doesn't even initialize correctly. The error message in the z/VM TCPIP log is:

DTCCTC080I CTCA initializing:                                                        
DTCPRI385I  Device DEV@0E24:                                                         
DTCPRI386I     Type: CTC, Status: Not started                                        
DTCPRI387I     Envelope queue size: 0                                                
DTCPRI388I     Address: 0E24                                                         
DTCCTC045E CTCA device DEV@0E24: Error getting XA subchan id for 00000E24 or 00000E25
DTCCTC082E CTCA shutting down:                                                       
DTCPRI385I    Device DEV@0E24:                                                       
DTCPRI386I       Type: CTC, Status: No status available                              
DTCPRI387I       Envelope queue size: 0                                              
DTCPRI388I       Address: 0E24  

Before I start trying to debug things, I'd like to know if perhaps I'm still doing something wrong with my setup. Does your CTCI device work correctly? And if so, under which OS and version?

Thanks,

Peter

@baka0taku2022

Copy link
Copy Markdown
Author

From what I have researched on the errors you are getting this may related to your issue.

https://web.archive.org/web/20170914131356/http://hercules390.996247.n3.nabble.com/Issues-with-Windows-IP-LCS-Hercules-3-312-z-VM-5-3-TCPIP-td53970.html

Just running Hercules with no OS loaded produces the folowing:

The device does show up in the ifconfig output

utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
	inet 192.168.1.99 --> 192.168.1.98 netmask 0xffffffff
	nd6 options=201<PERFORMNUD,DAD>

and the route shows up in the output for netstat -rn output

Internet:
Destination        Gateway            Flags               Netif Expire
...
192.168.1.98       192.168.1.99       UH                  utun4
...

My host OS is macOS 26.5.2 (25F84)
I can test on what I have available at the moment for guests and see if I can figure things out.

@Peter-J-Jansen

Copy link
Copy Markdown
Collaborator

Hi Simon,

I thought to let you know I have some progress, after I realized that the CTCI addresses (0E24-0E25 in my case) need to be attached to TCPIP of course, which in my case I do using the :ATTACH. record in the z/VM TCPIP filetype DTCPARMS. As a result, the Hercules CTCI -d debug option now shows TCPIP packets being sent (on utun4 in my case), and received (accept from guest). But PING commands do not work in either direction. The only PING command that does work is for the TCPIP address of z/VM inside a CMS session. The regular CMS commands, like NETSTAT HOME, NETSTAT GATE, IFCONFIG -SHOW all appear normal, like when running Hercules on an Ubuntu host. In case you wonder, yes, I have IP forwarding enabled in macOS (Tahoe 26.5.2 like yours). But no, I don't have connectivity yet. I'll continue with trying to figure out what's wrong with this CTCI link. The very same setup on an Ubuntu host does work, using a regular Linux /dev/net/tun style tun interface.

From your earlier response I presume that you too do not have a CTCI link working for an OS like VM or MVS or z/OS. Is that correct please?

Cheers,

Peter

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

Successfully merging this pull request may close these issues.

2 participants