How to execute multiple socat?



  • I am trying to convert my pfsense to use socat instead of inetd. I think i've almost got it but when I try to execute socat from where filter.in generates the inetd entries, it seems to be blocking on the execution of the first socat. How do I send the application to the background like &

    Code:

    mwexec("/usr/local/bin/socat {$socat_socketType}:{$inetdport},fork {$socat_socketTypeDest}:{$targip}:{$tda}");

    When I check ps, only one socat entry is listed and the filter status is stuck at generating reflection rule…

    root      38356  0.0  0.3  5540  2652  ??  IN    9:49PM  0:00.01 /usr/local/bin/socat TCP-LISTEN:19000,fork TCP4:192.168.10.2:3389

    How do I get around this?



  • I figured out I need mwexec_bg and I was killing the processes killbyname("socat"); in the wrong location so it was also not showing up.

    
    root     socat      45837 3  stream /var/run/check_reload_status
    root     socat      45837 9  tcp4   *:19006               *:*
    root     socat      45529 3  stream /var/run/check_reload_status
    root     socat      45529 9  udp4   *:19005               *:*
    root     socat      45424 3  stream /var/run/check_reload_status
    root     socat      45424 9  tcp4   *:19005               *:*
    root     socat      45258 3  stream /var/run/check_reload_status
    root     socat      45258 9  udp4   *:19004               *:*
    root     socat      44829 3  stream /var/run/check_reload_status
    root     socat      44829 9  tcp4   *:19004               *:*
    root     socat      44561 3  stream /var/run/check_reload_status
    root     socat      44561 9  udp4   *:19003               *:*
    root     socat      44058 3  stream /var/run/check_reload_status
    root     socat      44058 9  tcp4   *:19003               *:*
    root     socat      43605 3  stream /var/run/check_reload_status
    root     socat      43605 9  udp4   *:19002               *:*
    root     socat      43237 3  stream /var/run/check_reload_status
    root     socat      43237 9  tcp4   *:19002               *:*
    root     socat      42753 3  stream /var/run/check_reload_status
    root     socat      42753 9  tcp4   *:19001               *:*
    root     socat      42315 3  stream /var/run/check_reload_status
    root     socat      42315 9  tcp4   *:19000               *:*