1

I'm trying to run socat forward ttyACM0 into UDP. It works with command.

socat UDP-LISTEN:14550,fork,reuseaddr FILE:/dev/ttyACM0,b57600,raw

Problem is, I need to access socat via ip address, which is inside netns. I tried to enter this command:

ip netns exec int socat UDP-LISTEN:14550,fork,reuseaddr FILE:/dev/ttyACM0,b57600,raw

, which displays error:

2024/10/10 14:14:37 socat[6255] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:38 socat[6259] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:39 socat[6263] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:40 socat[6267] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:41 socat[6268] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:42 socat[6272] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:43 socat[6276] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:44 socat[6280] E write(5, 0x1d54000, 44): Connection refused
2024/10/10 14:14:45 socat[6284] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:46 socat[6288] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:47 socat[6292] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:48 socat[6296] E write(5, 0x1d54000, 40): Connection refused
2024/10/10 14:14:49 socat[6300] E read(5, 0x1d54000, 8192): Connection refused
2024/10/10 14:14:50 socat[6304] E read(5, 0x1d54000, 8192): Connection refused

How to properly run socat inside netns?

2
  • Are those errors displayed when UDP packets are received? Or when something is coming from /dev/ttyACM0? What's open of fd 5 (lsof should tell you)? Have you tried passing a few -d options to socat to have more information on how the plumbing is done? Commented Oct 10, 2024 at 19:17
  • My guess is that /dev/ttyACM0 is replying (or it's just the local echo as you didn't add a echo=0 on the second address) to whatever message is received over UDP, but that response is rejected because the sender's socket has already been torn down. Commented Oct 10, 2024 at 19:25

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.