uweseimet/scsi2pi

s2p: Add a boolean parameter to disable the creation of the piscsi bridge

Closed this issue · 5 comments

An new boolean parameter "bridge" shall be added to the list of the supported parameters for the DaynaPort emulation. This parameter shall control whether for physical network interfaces ("eth*") the piscsi bridge shall be created or not. The default of this parameter shall be "true". Any other value shall mean "false".

@fdanapfel There does not seem to be much progress with PiSCSI/piscsi#1387. What I wonder is: What is still missing or would have to be changed in the s2p core in order to provide good support for parprouted? Note that I am not talking about documentation or external setups (scripts, parprouted itself etc.), but just about the s2p binary, i.e. the C++ code.

@uweseimet First of all, a big thanks for all the work you have done so far with scsi2pi! And thanks for incorporating some of the suggestions I made.

As far as I can see the only thing thats missing in the s2p binary for supporting parprouted would be to make sure IPv4 forwarding is enabled in the kernel (sudo sysctl -w net.ipv4.ip_forward=1 in shell code, but there is probably also a way to do this in C++) and to put the real interface (wlan0 or eth0) that will be used by the emulated daynaport in promiscuous mode (sudo /sbin/ip link set wlan0 promisc on in shell code, but there is probably also a way to do this in C++) when the daynaport is enabled (and disable promiscuous mode when the daynaport is disabled).

With that after parprouted is started afterwards connecting the piscsi0 interface to the real network interface everything should be there that is required for an Atari or Mac to connect to the network.

@fdanapfel Which shell commands can I use to verify the results when I try to implement the equivalent of the shell commands you mentioned in C++? Should any of these operations be optional? I am asking this because I would like to also keep the current behavior. At least for the time being, the best solution would probably be if I could add an option that switches between the current (i.e. without parprouted) s2p behavior, and the behavior needed with parprouted.

@uweseimet To verify that the IPv4 forwarding is enabled you can run the command sysctl net.ipv4.ip_forward which will return net.ipv4.ip_forward = 1 when IPv4 forwarding is enabled.
To check if the interface is in promiscuous mode run ip a and then check if PROMISC is listed in the flags for that interface, e. g. <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP>

Both settings are required, otherwise the Atari or Mac connected to the Daynaport will only be able to communicate with the Raspberry Pi, but not with the rest of the network even when parprouted is running.

Since as you can see at https://github.com/PiSCSI/piscsi/wiki/Dayna-Port-SCSI-Link#wireless-raspberry-pi-setup enabling the IPv4 forwarding in the kernel is required as well when using the NAT based network setup currently used by PiSCSI, I would suggest combining these options with the parameter discussed in this issue for enabling/disabling the bridge.
I. e. if parameter is set to enable bridge then don't set IPv4 forwarding and promiscuous mode, if parameter is set to disable bridge then set IPv4 forwarding and promiscuous mode.

@fdanapfel Coupling these changes with the new "bridge" parameter is what I have also been thinking of. I created #84 for this.