unbound DGRAM socket unreadable

Issue #467 resolved
Former user created an issue

I experienced that dgram unix sockets are mishandled by SEND/EXPECT testing mechanism (likely by all other that reads dgram socket) under my Linux 3.2.0-4-686-pae system. The root of it is that socket is not bound to local AF_UNIX socket. It could be solved by creating a tmp unix socket (either a named one or an abstract), or exploit Linux' autobind feature. Autobind feature is described in unix(7).

I patched the source with autobinding code:

file: src/socket.c

static T _createUnixSocket(...) {
  ...
  if (s >= 0) {
    int sockopt1 = 1;
    setsockopt(s, SOL_SOCKET, SO_PASSCRED, &sockopt1, sizeof(sockopt1));
  ...
}

Comments (3)

  1. Tildeslash repo owner

    Please can you send monit configuration, provide more details about the tested unix socket and the error returned by monit?

    I tried to replicate the problem on CentOS 7 (Linux 3.10.0-327.28.3.el7.x86_64) by testing mysql unix socket:

    set daemon 5
    
    check process mariadb matching "/usr/libexec/mysqld"
        if failed unixsocket /var/lib/mysql/mysql.sock protocol mysql then alert
    

    works normally:

    'mariadb' succeeded testing protocol [MYSQL] at /var/lib/mysql/mysql.sock [response time 1.992 ms]
    'mariadb' connection succeeded to /var/lib/mysql/mysql.sock
    
  2. Log in to comment