troglobit / smcroute

Static multicast routing for UNIX
https://troglobit.com/projects/smcroute/
GNU General Public License v2.0
244 stars 64 forks source link

Add batch mode to smcroutectl #189

Closed troglobit closed 1 year ago

troglobit commented 2 years ago

In #185 daemon support for batching multiple transactions was added to the IPC code. For the next release it would be great if we could have this support natively in smcroutectl. E.g.,

$ sudo smcroutectl -f - << EOF
join eth0 225.1.2.3
add eth0 192.168.1.42 225.1.2.3 eth1 eth2
rem eth1 225.3.4.5 eth3
leave eth1 225.3.4.5
EOF

I guess we could use isatty(STDIN_FILENO) go into batch mode automatically:

$ cat << EOF | sudo smcroutectl
join eth0 225.1.2.3
add eth0 192.168.1.42 225.1.2.3 eth1 eth2
rem eth1 225.3.4.5 eth3
leave eth1 225.3.4.5
EOF