Hi Bazi, it seems I've found a bug in the unix_stream/unix_dgram destination drivers. The problem is, that running sysng with something like destination d_stream { unix-stream("/tmp/stream_sock"); }; or destination d_dgram { unix-dgram("/tmp/dgram_sock"); }; it doesn't create the socket in the file system, so the connect() fails. Seems that bind_unix_socket() is never called. The appended trace shows, that there isn't a bind() between so_socket() = 4 and connect(4) As far as I know, bind() must be called before connect() to create the socket in the local filesys. It should be removed via unlink() after all work is done. Feedback or a hot-fix is very wellcome. Thanks a lot --Andreas Debug message:
syslog-ng -d -v io.c: connecting using fd 4 connecting fd 4, unixaddr: /tmp/dgram_sock Error connecting to AF_UNIX(/tmp/dgram_sock): Bad file number Error initializing configuration, exiting.
Strace:
18128: so_socket(1, 1, 0, "", 1) = 4 18128: fcntl(4, F_GETFL, 0x00000000) = 2 18128: fstat64(4, 0xFFBEF348) = 0 18128: getsockopt(4, 65535, 8192, 0xFFBEF448, 0xFFBEF440, 0) = 0 18128: fstat64(4, 0xFFBEF348) = 0 18128: getsockopt(4, 65535, 8192, 0xFFBEF448, 0xFFBEF444, 0) = 0 18128: setsockopt(4, 65535, 8192, 0xFFBEF448, 4, 0) = 0 18128: fcntl(4, F_SETFL, 0x00000082) = 0 18128: fcntl(4, F_SETFD, 0x00000001) = 0 io.c: connecting using fd 4 18128: write(2, " i o . c : c o n n e c".., 28) = 28 connecting fd 4, unixaddr: /tmp/dgram_sock 18128: write(2, " c o n n e c t i n g f".., 47) = 47 18128: connect(4, 0xFFBEF4A8, 110, 1) Err#2 ENOENT 18128: close(4) = 0 18128: close(4) Err#9 EBADF Error connecting to AF_UNIX(/tmp/dgram_sock): Bad file number 18128: write(2, " E r r o r c o n n e c".., 66) = 66 Error initializing configuration, exiting. 18128: write(2, " E r r o r i n i t i a".., 43) = 43 18128: llseek(0, 0, SEEK_CUR) = 41406 18128: lwp_mutex_wakeup(0xFF3E7CB0) = 0 18128: lwp_mutex_lock(0xFF3E7CB0) = 0 18128: lwp_sigredirect(0, SIGWAITING, 0x00000000) Err#22 EINVAL 18128: _exit(2)
-- Best regards --Andreas Schulze [phone: +49.5246.80.1275, fax: +49.5246.80.2275] | I believe, it was Dennis Ritchie who said something like: | "C is rarely the best language for a given task, | but it's often the second-best". | The implication being that: "[...]" | http://www.ioccc.org/1990/dds.c