Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPC: daemon: add batch-mode support #185

Merged
merged 1 commit into from
Oct 4, 2022
Merged

Conversation

alexeys85
Copy link
Contributor

Add support to read multiple commands from client and invoke them. Example of possible (but not yet implemented) usage of smcroutectl:

smcroutectl --batch - << 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

Signed-off-by: Alexey Smirnov s.alexey@gmail.com

@alexeys85 alexeys85 force-pushed the master branch 3 times, most recently from 625a0d7 to 20e7562 Compare October 2, 2022 14:55
@troglobit
Copy link
Owner

Before you force-pushed the follow-up changes, the tests passed. Now they no longer pass, you'll have to look into why your PR introduces a regression.

Other than that it looks good in general. Some minor coding style issues, but those I can fix up myself later. Only caveat I have is that I'd like ipc_receive() to return -1 instead of 0 on error, as we talked about earlier, i.e., change to ssize_t return type and fix the behavior of the callee. Returning zero is fine on timeout when the client disconnects.

@alexeys85 alexeys85 force-pushed the master branch 2 times, most recently from 5c51eb7 to 3ffc919 Compare October 3, 2022 04:38
@alexeys85
Copy link
Contributor Author

Before force-push PR wasn't quite complete and didn't support receiving arbitrary number of commands.
ipc_receive() should fixed now!
Failed CI tests run fine locally, weird...

@alexeys85
Copy link
Contributor Author

alexeys85 commented Oct 3, 2022

By the way, locally test gre.sh was skipped:

�[7m>> Checking dependencies ...                                                       �[0m
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
Linux scuderia-pc 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
�[7m>> TEST: SKIP                                                                      �[0m
grep -q ip_gre /proc/modules is not supported on this system.

SKIP gre.sh (exit status: 77)

However, after modprobe ip_gre:

enzo@scuderia-pc:~$ grep ip_gre /proc/modules
ip_gre 28672 0 - Live 0x0000000000000000
ip_tunnel 32768 1 ip_gre, Live 0x0000000000000000
gre 16384 1 ip_gre, Live 0x0000000000000000

enzo@scuderia-pc:~$ lsmod | grep gre
ip_gre                 28672  0
ip_tunnel              32768  1 ip_gre
gre                    16384  1 ip_gre

@troglobit
Copy link
Owner

There's some memory corruption being introduced. See near the end of the last run:

 >> Phase 3: Join group from multiple sources (IPC)                                 
malloc(): unsorted double linked list corrupted

Re: GRE. Yeah, I've set up my tests using unshare so it's possible to do networking ops unprivileged. The gre.sh test however cannot load a module, that has to be done by the real root of the system, hence it's set to go to SKIP (not FAIL) if the kernel doesn't support IP-GRE.

@alexeys85
Copy link
Contributor Author

In last force-push I got rid of malloc usage but seems still no go, same as broken pipe errors :(

However locally I have:
enzo@scuderia-pc:/media/enzo/Data/work/workspace/smcroute$ make check
Making check in man
make[1]: Entering directory '/media/enzo/Data/work/workspace/smcroute/man'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/media/enzo/Data/work/workspace/smcroute/man'
Making check in src
make[1]: Entering directory '/media/enzo/Data/work/workspace/smcroute/src'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/media/enzo/Data/work/workspace/smcroute/src'
Making check in test
make[1]: Entering directory '/media/enzo/Data/work/workspace/smcroute/test'
make  check-TESTS
make[2]: Entering directory '/media/enzo/Data/work/workspace/smcroute/test'
make[3]: Entering directory '/media/enzo/Data/work/workspace/smcroute/test'
PASS: expire.sh
PASS: adv.sh
PASS: basic.sh
PASS: bridge.sh
PASS: dyn.sh
PASS: gre.sh
PASS: include.sh
PASS: ipv6.sh
PASS: isolated.sh
PASS: join.sh
PASS: joinlen.sh
PASS: lost.sh
PASS: mem.sh
PASS: mrcache.sh
PASS: mrcache6.sh
PASS: mrdisc.sh
PASS: multi.sh
PASS: poison.sh
PASS: reload.sh
PASS: reload6.sh
PASS: vlan.sh
PASS: vrfy.sh
============================================================================
Testsuite summary for SMCRoute 2.5.5
============================================================================
# TOTAL: 22
# PASS:  22
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/media/enzo/Data/work/workspace/smcroute/test'
make[2]: Leaving directory '/media/enzo/Data/work/workspace/smcroute/test'
make[1]: Leaving directory '/media/enzo/Data/work/workspace/smcroute/test'
make[1]: Entering directory '/media/enzo/Data/work/workspace/smcroute'
make[1]: Leaving directory '/media/enzo/Data/work/workspace/smcroute'

Add support to read multiple commands from client and invoke them.
Example of possible (but not yet implemented) usage of smcroutectl:

smcroutectl --batch - << 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

Signed-off-by: Alexey Smirnov <s.alexey@gmail.com>
@alexeys85
Copy link
Contributor Author

Should be good now!

@troglobit
Copy link
Owner

Looks much better, thank you for hanging in there! 😃👍

I'll do a deep review of the changes probably sometime tomorrow morning (CET). But I don't expect anything major to pop up at this stage.

@troglobit troglobit merged commit 74ee953 into troglobit:master Oct 4, 2022
@troglobit
Copy link
Owner

Merged this morning. Now, before the next release it'd be great to have support for

$ smcroutectl --batch - << EOF
...
EOF

And a tiny little test to verify the same.

@troglobit troglobit mentioned this pull request Oct 4, 2022
1 task
@alexeys85
Copy link
Contributor Author

Hop to get to it soon!

@troglobit
Copy link
Owner

Cool thanks! I created a couple of issues to track it so we don't forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants