Adding UDP/TCP/Unix socket support to rlm_linelog

Arran Cudbard-Bell a.cudbardb at
Mon Mar 23 16:26:45 CET 2015

> On 23 Mar 2015, at 10:47, Phil Mayers <p.mayers at IMPERIAL.AC.UK> wrote:
> On 20/03/2015 18:31, Arran Cudbard-Bell wrote:
>> I'd appreciate comments and feedback on the socket code. It was
>> written the code editor open in one window, and in
>> the other, but that doesn't mean it will actually work the way it was
>> intended across multiple platforms.
> Very likely not, in all cases :o(
>> Doing write(fd, NULL, 0); to check for socket connectedness seems
>> like it's going to blow up somewhere at some point, so suggestions
>> for what to do to get pending errors would be very helpful.
> I'd advise looking at the libevent code to see what they do. There should probably be some version of that lisp quote, but for libevent ;o)

I think we're closer to 2/3rds now.

> TBH it seems crazy-broken that OS X isn't returning pending errors but does then return an error on write(). Maybe that's an OS X bug? What type of sockets was this with?

Just a TCP socket with O_NONBLOCK set.

Libevent uses SO_ERROR, which is helpfully documented on the Linux man page for connect, but not on the OSX man page or the page.

The description here says:

	SO_ERROR - Requests and clears pending error information on the socket (getsockopt() only).

So I guess that's it...


Arran Cudbard-Bell <a.cudbardb at>
FreeRADIUS development team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <>

More information about the Freeradius-Devel mailing list