uweseimet / scsi2pi

Advanced performant SCSI/SASI emulation and tools for the PiSCSI/RaSCSI board
https://www.scsi2pi.net
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

Can't set IP address when attaching DaynaPort device #75

Closed fdanapfel closed 6 months ago

fdanapfel commented 6 months ago

When creating a new ticket please provide information on your environment.

Describe the issue

When attaching the DaynaPort and trying to set the IP address the IP address is ignored and 10.10.20.1/24 is always used instead:

$ s2pctl -l
No devices currently attached.
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e4:5f:01:78:10:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global dynamic noprefixroute wlan0
       valid_lft 846068sec preferred_lft 846068sec
    inet6 2003:c9:d701:1200:470a:d09a:e629:147e/64 scope global dynamic noprefixroute 
       valid_lft 6991sec preferred_lft 3391sec
    inet6 fe80::8d9b:2326:42e9:e441/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
$ s2pctl -i 6 -c a -t scdp inet=192.168.178.23:interface=wlan0
$ s2pctl -l
+----+-----+------+-------------------------------------
| ID | LUN | TYPE | IMAGE FILE
+----+-----+------+-------------------------------------
|  6 |   0 | SCDP | DaynaPort SCSI/Link
+----+-----+------+-------------------------------------
frank@bookworm:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e4:5f:01:78:10:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global dynamic noprefixroute wlan0
       valid_lft 846040sec preferred_lft 846040sec
    inet6 2003:c9:d701:1200:470a:d09a:e629:147e/64 scope global dynamic noprefixroute 
       valid_lft 6963sec preferred_lft 3363sec
    inet6 fe80::8d9b:2326:42e9:e441/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
15: piscsi0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 0e:83:50:de:cf:d4 brd ff:ff:ff:ff:ff:ff
    inet 10.10.20.1/24 brd 10.10.20.255 scope global piscsi0
       valid_lft forever preferred_lft forever
    inet6 fe80::c83:50ff:fede:cfd4/64 scope link 
       valid_lft forever preferred_lft forever
$ 
uweseimet commented 6 months ago

@fdanapfel This only happens when you attach the device with s2pctl, but not when launching s2p with the respective parameters?

uweseimet commented 6 months ago

@fdanapfel I see what's wrong. s2pctl works similar to scsictl (piscsi): Where in s2p/piscsi you pass a filename/parameters, in s2pctl you have to use the "-f" option. This means in your case the correct command is:

>s2pctl -i 6 -c a -t scdp -f inet=192.168.178.23:interface=wlan0
fdanapfel commented 6 months ago

@uweseimet Ah, OK. With -f it works:

$ s2pctl -i 6 -c a -t scdp -f inet=192.168.178.23:interface=wlan0
$ s2pctl -l
+----+-----+------+-------------------------------------
| ID | LUN | TYPE | IMAGE FILE
+----+-----+------+-------------------------------------
|  0 |   0 | SCHD | /home/frank/images/HD00_Atari_EasyMiNT.hda
|  6 |   0 | SCDP | DaynaPort SCSI/Link
+----+-----+------+-------------------------------------
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e4:5f:01:78:10:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global dynamic noprefixroute wlan0
       valid_lft 860856sec preferred_lft 860856sec
    inet6 2003:c9:d701:1200:470a:d09a:e629:147e/64 scope global dynamic noprefixroute 
       valid_lft 6773sec preferred_lft 3173sec
    inet6 fe80::8d9b:2326:42e9:e441/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
18: piscsi0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether de:4b:f2:db:17:27 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global piscsi0
       valid_lft forever preferred_lft forever
    inet6 fe80::dc4b:f2ff:fedb:1727/64 scope link 
       valid_lft forever preferred_lft forever

I tried to use your example from https://github.com/uweseimet/scsi2pi/issues/64#issuecomment-1934738178 where the -f was missing (because you used s2p there) as well and therefore assumed that it wasn't needed for s2pctl either.

Maybe you could add a message that notifies users in case they try to give extra parameters without putting -f in front.

uweseimet commented 6 months ago

@fdanapfel I think it's better that if there is a free parameter but no -f option, to use the free parameter as if it had been specified with -f. I will apply this change for the next builds. Note, though, that using s2pctl this way is incompatible with PiSCSI's scsictl. Regarding a message for the user, you should request this change for PiSCSI, because if scsictl stays like it is it has exactly the behavior you want to be changed.

uweseimet commented 6 months ago

@fdanapfel Development builds with the change mentioned above are now available. It's your turn to test whether it works and does not have any unwanted side-effects ;-). Like with s2p you can now also use shortcuts for the device type (as long as there are no other parameters) instead of specifying the device type with -t, e.g.

>s2pctl -i 6 -c a daynaport

or the filename for devices with image file, e.g.

>s2pctl -i 0 -c a image.hds
fdanapfel commented 6 months ago

@uweseimet Just tested with the latest development build, and as far as I can see it works as expected:

$ sudo apt install ./scsi2pi_3.1_devel_e8f8695_bookworm_arm64-1.deb 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'scsi2pi' instead of './scsi2pi_3.1_devel_e8f8695_bookworm_arm64-1.deb'
The following NEW packages will be installed:
  scsi2pi
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
...
$ sudo systemctl start s2p.service 
$ s2pctl -i 6 -c a -t scdp inet=192.168.178.23:interface=wlan0
$ s2pctl -l
+----+-----+------+-------------------------------------
| ID | LUN | TYPE | IMAGE FILE
+----+-----+------+-------------------------------------
|  6 |   0 | SCDP | DaynaPort SCSI/Link
+----+-----+------+-------------------------------------
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e4:5f:01:78:10:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global dynamic noprefixroute wlan0
       valid_lft 863753sec preferred_lft 863753sec
    inet6 2003:c9:d701:1200:470a:d09a:e629:147e/64 scope global dynamic noprefixroute 
       valid_lft 6955sec preferred_lft 3355sec
    inet6 fe80::8d9b:2326:42e9:e441/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: piscsi0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether fe:17:55:28:20:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global piscsi0
       valid_lft forever preferred_lft forever
    inet6 fe80::fc17:55ff:fe28:20ff/64 scope link 
       valid_lft forever preferred_lft forever
$ s2pctl -i 6 -c d
$ s2pctl -i 6 -c a scdp
Error: Device type required for unknown extension of file 'scdp'
$ s2pctl -i 6 -c a daynaport
$ s2pctl -l
+----+-----+------+-------------------------------------
| ID | LUN | TYPE | IMAGE FILE
+----+-----+------+-------------------------------------
|  6 |   0 | SCDP | DaynaPort SCSI/Link
+----+-----+------+-------------------------------------