lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1279616099.2498.9.camel@edumazet-laptop>
Date:	Tue, 20 Jul 2010 10:54:59 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Roy Marples <roy@...ples.name>
Cc:	netdev@...r.kernel.org
Subject: Re: recv(2), MSG_TRUNK and kernels older than 2.6.22

Le mardi 20 juillet 2010 à 09:26 +0100, Roy Marples a écrit :
> Hi
> 
> I would like to support all possible kernels I can and previously used a 
> fixed buffer of size 256 to read from netlink sockets. This is now 
> proving too small for some 64-bit kernels so I would like to use recv(2) 
> with MSG_TRUNK to wor out the size. However, the man page says that this 
> only works for 2.6.22 kernels or newer.
> 
> My question is, what is the behaviour of recv on older kernels where 
> MSG_TRUNC is not supported? I would rather not use some arbitary size if 
> at all possible.
> 

Is it for the dhcpcd problem we talk about few week ago, disturbed by
new 64bit stats ?

Why do you want to have a fixed size of 256 bytes ?

Using 8192 bytes on stack would avoid MSG_TRUNK mess.

static int
get_netlink(int fd, int flags,
    int (*callback)(struct nlmsghdr *))
{
        char buffer[8192];
        ssize_t bytes;
        struct nlmsghdr *nlm;
        int r = -1;

        for (;;) {
                bytes = recv(fd, buffer, sizeof(buffer), flags);
                if (bytes == -1) {
                        if (errno == EAGAIN) {
                                r = 0;
                                goto eexit;
                        }
                        if (errno == EINTR)
                                continue;
                        goto eexit;
                }




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ