FreeRADIUS 2 not listening on right port

Phil Mayers p.mayers at imperial.ac.uk
Thu May 29 01:54:41 CEST 2008


A.L.M.Buxey at lboro.ac.uk wrote:
> Hi,
> 
>> Please note, this bug only seems to be present in the F-9 (recently 
>> released version 9 of Fedora).
>>
>> For the time being I will build the F-9 FreeRADIUS packages without 
>> optimization until this is resolved.
> 
> is it a case of this bug doing OTHER things to the codebase etc
> or is it worth ONLY turning off optimization for the single
> bit of affected code. turning off optimization for the routines
> that deal with encryptions etc could be painful.

All,

For those not following the Fedora bug, it (or rather, it's dependency) 
has been closed by Ulrich Drepper. He seems to be saying that the 
FreeRadius code is incorrect and specifically that an invalid typecast 
is triggering the compiler to generate bad code:

https://bugzilla.redhat.com/show_bug.cgi?id=448743#c6

Summary (as far as I can make out): Because the code looks like this:

struct addr

if v==4:
  i = (ip4*)&addr
  i->port = xx

elif v==6:
  i = (ip6*)&addr
  i->port = xx

bind(&addr)

...the compiler can't detect that the "i" value is "used", and optimises 
the code touching it away. The "right" way to do it is:

union {
   ip4 i4;
   ip6 i6;
} addr;
if v==4:
   addr.i4.port = xx
elif v==6:
   addr.i6.port = xx
bind(&addr)

I believe the Python guys have had similar issues in the past; 
-fno-strict-aliasing might be required under gcc.

I'm not expert enough in the C99 standard to judge whether the comments 
at the above URL are correct or not; I suspect it's a matter of some 
controversy, and will back slowly away now... ;o)



More information about the Freeradius-Users mailing list