SDL-Hercules-390 / hyperion

The SDL Hercules 4.x Hyperion version of the System/370, ESA/390, and z/Architecture Emulator
Other
240 stars 90 forks source link

Hercules won't set MAC address for LCS SNA device #607

Closed blackbit42 closed 1 month ago

blackbit42 commented 10 months ago

I want to use a LCS device for SNA communication and set a particular MAC address.

0E42    LCS     -e SNA -m 02:00:00:23:43:01 tap2

Unfortunately, that leads to:

HHC00901I 0:0E42 LCS: Interface tap2, type TAP opened
HHC00942I CTC: lcs interface tap2 using mac 82:73:1C:3A:C9:BB
HHC00943W CTC: lcs interface tap2 not using mac 02:00:00:23:43:01

Even though the message ID is different, I think the following is the relevant documentation:

HHCLC056W tapn NOT using MAC hh:hh:hh:hh:hh:hh

    Meaning
        MAC address hh:hh:hh:hh:hh:hh was requested in the configuration statement or in the OAT file for an LCS device but the operating system did not accept the request to change the MAC address for TUN/TAP device tapn. 

By the way, I start hercules as root.

Manually, i can set a MAC address for a tap interface just fine though:

$ sudo ip link tuntap add mode tap dev tap2
Command "tuntap" is unknown, try "ip link help".
$ sudo ip tuntap add mode tap dev tap2
$ sudo ip link set dev tap2 address 06:77:61:08:F1:97
$ sudo ip link show dev tap2
15: tap2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 06:77:61:08:f1:97 brd ff:ff:ff:ff:ff:ff
$ sudo ip link set dev tap2 address 02:00:00:23:43:01
$ sudo ip link show dev tap2
15: tap2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 02:00:00:23:43:01 brd ff:ff:ff:ff:ff:ff
$

What am I doing wrong here?

mcisho commented 10 months ago

The configuration statement:-

0E42 LCS -e SNA -m 02:00:00:23:43:01 tap2

says that the LCS should use a preconfigured interface named tap2, in which case the -m option is ignored. Ideally, the configuration statement should have been rejected, and in a future it will be.

Use the ip link and ip tuntap commands you illustrated above to preconfigure the tap interface (with another ip link command to bring the tap up) before starting Hercules. To use SNA the tap interface will almost certainly have to be bridged, which generally mandates the use of a preconfigured tap interface. And preconfiguring the interface(s) means you don't have to start Hercules as root.

mcisho commented 10 months ago

Changing the configuration statement to:-

0E42 LCS -e SNA -m 02:00:00:23:43:01 -x tap2

and doing nothing else may also work. LCS should create a tap interface named tap2, and use the -m option to set the MAC address.

blackbit42 commented 10 months ago

Thanks for the response.

0E42    LCS     -e SNA -m 02:00:00:23:43:01 -x tap2

leads to:

HHC00916E 0:0E42 LCS: Option TAP device name value tap2 invalid
HHC00007I Previous message from function 'ParseArgs' at ctc_lcs.c(3512)
HHC01463E 0:0E42 device initialization failed
HHC00007I Previous message from function 'attach_device' at config.c(1354)