2.4.2 issue still (ctlinnd and "message too long")

Russ Allbery rra at stanford.edu
Sun Jul 3 02:25:25 UTC 2005


To recap, this is the problem where ctlinnd name and some similar commands
fail because the data that innd is sending back to ctlinnd is too long and
it gets EMSGSIZE.  I'm sorry for how long it too me to take a closer look
at this; I've been really distracted by other things.

I'm afraid I don't have good news, though.

Tuc <tuc at ttsg.com> writes:

> news.err:Jan  1 03:38:26 hermod innd: SERVER cant sendto CCreader bytes 2676 Message too long
> news.err:Jan  1 13:32:56 hermod innd: SERVER cant sendto CCreader bytes 7 Connection refused
> news.err:Jan  1 13:50:38 hermod innd: SERVER cant sendto CCreader bytes 2552 Message too long
> news.err:Jan  1 15:10:32 hermod innd: SERVER cant sendto CCreader bytes 2749 Message too long
> news.notice:Jan  1 03:38:26 hermod innd: SERVER cant sendto CCreader bytes 2676 Message too long
> news.notice:Jan  1 13:32:56 hermod innd: SERVER cant sendto CCreader bytes 7 Connection refused
> news.notice:Jan  1 13:50:38 hermod innd: SERVER cant sendto CCreader bytes 2552 Message too long
> news.notice:Jan  1 15:10:32 hermod innd: SERVER cant sendto CCreader bytes 2749 Message too long

I wrote a little test program to try sending a packet over a Unix datagram
socket.  The test program is included below.  I ran it on:

    Debian GNU/Linux (2.4 kernel)
    Solaris 8
    IRIX 6.5
    Tru64 4.0F
    AIX 5.2
    FreeBSD 5.4

All of them handled 8KB packet sizes without any trouble except for Tru64
and FreeBSD, which can't handle a byte over 2KB.  So I'm afraid that INN
is running into (stupidly low) OS-imposed limits that there's no way
around without major surgery in how ctlinnd talks to innd, and doing the
latter isn't something on my list to work on.

2KB is ridiculously small.  I would complain to your OS supplier.  Linux
has no problems with 32KB packets.

I will see if I can fix the error message that ctlinnd returns; that
should be doable.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>

#define SIZE (8 * 1024)

static void
server(void)
{
    int in;
    struct sockaddr_un server;
    char buffer[SIZE];
    size_t i;
    ssize_t result;
    fd_set readfds;

    in = socket(AF_UNIX, SOCK_DGRAM, 0);
    if (in < 0) {
        perror("socket");
        exit(1);
    }
    memset(&server, 0, sizeof(server));
    server.sun_family = AF_UNIX;
    strcpy(server.sun_path, "sock-s");
    if (bind(in, (struct sockaddr *) &server, sizeof(server)) < 0) {
        perror("bind");
        exit(1);
    }

    FD_ZERO(&readfds);
    FD_SET(in, &readfds);
    if (select(in + 1, &readfds, NULL, NULL, NULL) <= 0) {
        perror("select");
        exit(1);
    }
    result = recv(in, buffer, sizeof(buffer), 0);
    if (result < (ssize_t) sizeof(buffer)) {
        fprintf(stderr, "Only got %ld bytes\n", (long) result);
        exit(1);
    }
    for (i = 0; i < SIZE - 1; i++)
        if (buffer[i] != 1) {
            fprintf(stderr, "Bad data at %lu", (unsigned long) i);
            exit(1);
        }
    if (buffer[i] != 2) {
        fprintf(stderr, "Bad data at %lu", (unsigned long) i);
        exit(1);
    }
    exit(0);
}

static void
client(void)
{
    int out;
    struct sockaddr_un server;
    char buffer[SIZE];
    ssize_t result;

    memset(buffer, 1, sizeof(buffer));
    buffer[sizeof(buffer) - 1] = 2;
    out = socket(AF_UNIX, SOCK_DGRAM, 0);
    memset(&server, 0, sizeof(server));
    server.sun_family = AF_UNIX;
    strcpy(server.sun_path, "sock-s");
    if (sendto(out, buffer, sizeof(buffer), 0, (struct sockaddr *) &server,
               sizeof(server)) < 0) {
        perror("sendto");
        exit(1);
    }
    exit(0);
}

int
main(void)
{
    pid_t child;

    child = fork();
    if (child < 0) {
        perror("fork");
        exit(1);
    } else if (child == 0) {
        sleep(1);
        client();
    } else {
        server();
    }
    return 0;
}

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list