Bug #3404
lookip in --listen-{up,down} mode not streaming to pipe
Description
Firstly, thanks for the fantastic project. Love it.
I've encountered an interesting issue while trying to read output from lookip out to a pipe or file, whereby the output of the command when in "--listen-up" or "--listen-down" mode is not visible anywhere.
Even more strangely, the --dump output is also missing from all outputs when piping the result when used with the --listen-* options.
This works
$ ipsec lookip --dump lookup: 10.0.0.1 12.34.56.78 default-conn[23] myusername
This works
$ ipsec lookip --dump > foo && cat foo lookup: 10.0.0.1 12.34.56.78 default-conn[23] myusername
This works
$ ipsec lookip --listen-up --listen-down --dump lookup: 10.0.0.1 12.34.56.78 default-conn[23] myusername
This does not work as expected.
$ ipsec lookip --listen-up --listen-down --dump > foo (foo is always empty, STDOUT is always empty)
Using 5.8.4, compiled from source on Ubuntu
./configure --prefix=/usr --sysconfdir=/etc \ --enable-farp --enable-openssl --enable-eap-mschapv2 --enable-eap-identity --enable-eap-tls --enable-ext-auth --enable-lookip --with-routing-table
Any suggestions on workarounds or fixes much appreciated!
History
#1 Updated by Tim Stamp over 5 years ago
I've engineered a fix, seems to work.
diff lookip.c lookip_orig.c 187d186 < fflush(stdout);
#2 Updated by Tobias Brunner over 5 years ago
- Description updated (diff)
- Status changed from New to Feedback
First, the lookip
utility is just an example on how the socket created by the lookip plugin can be used. Depending on what you want to do, writing your own client application might work better.
I've engineered a fix, seems to work.
Yeah, but I think it's easier to just switch stdout
to line buffering. I pushed a commit that does so to the 3404-lookip-linebuf branch.
#3 Updated by Tobias Brunner over 5 years ago
- Tracker changed from Issue to Bug
- Category changed from charon to libcharon
- Status changed from Feedback to Closed
- Assignee set to Tobias Brunner
- Target version set to 5.9.0
- Resolution set to Fixed