Apologies for cross-posting. Just wondering if anyone else was able to run radsqlrelay successfully on FBSD 6.3. I've ran into file lock issue right after I've tried running the pl script: # ls -al total 8 drwxr-xr-x 3 root wheel 512 Jan 14 13:39 . drwxr-xr-x 5 root wheel 512 Jan 14 11:42 .. drwxr-xr-x 2 root wheel 512 Jan 14 11:49 127.0.0.1 -rw-r--r-- 1 root wheel 51 Jan 14 11:49 sql-relay # radsqlrelay -b radius -d pg -h 172.16.10.100 -u postgres /home/radius/sql-relay error: Couldn't lock /home/radius/sql-relay.work: Invalid argument # ls -al total 8 drwxr-xr-x 3 root wheel 512 Jan 14 13:39 . drwxr-xr-x 5 root wheel 512 Jan 14 11:42 .. drwxr-xr-x 2 root wheel 512 Jan 14 11:49 127.0.0.1 -rw-r--r-- 1 root wheel 51 Jan 14 11:49 sql-relay.work Inspecting radsqlrelay shows the following lines: # /!\ OS-dependent structure # Linux struct flock # short l_type; # short l_whence; # off_t l_start; # off_t l_len; # pid_t l_pid; # c2ph says: typedef='s2 l2 i', sizeof=16 my $FLOCK_STRUCT = 's2l2i'; Application versions that are being used: FreeBSD 6.3-PRERELEASE p5-DBD-Pg-1.49 p5-DBI-1.60.1 postgresql-client-8.1.11 freeradius-devel-2.0.0.p2 radsqlrelay v1.7 I'm no real coder myself, hence, the need to seek direction. Any necessary change on the script that I need to make? Thanks again, roy
Hi Roy and everyone, In message <1200289588.14269.19.camel@localhost>, roy <bandwidth.user@gmail.com> writes
Application versions that are being used: FreeBSD 6.3-PRERELEASE p5-DBD-Pg-1.49 p5-DBI-1.60.1 postgresql-client-8.1.11 freeradius-devel-2.0.0.p2 radsqlrelay v1.7
FreeRADIUS 2.0.0-pre2 is some way behind the released FreeRADIUS 2.0.0. By the time 2.0.0-pre2 got committed to the FreeBSD ports tree, we were very close to the 2.0.0 release. FreeBSD PR ports/119582 contains what should become the net/freeradius2 port for the 2.0.0 release version. http://www.freebsd.org/cgi/query-pr.cgi?pr=119582 However, radsqlrelay is version 1.7 in the released 2.0.0 as well.
I'm no real coder myself, hence, the need to seek direction. Any necessary change on the script that I need to make?
struct flock has different parameters in FreeBSD's C library - or, more accurately, the same parameters in a different order - see man 2 fcntl In /usr/local/bin/radsqlrelay read down a few lines further than you were looking into sub setlock. Back up the file, then change the my $packed line to: my $packed = pack($FLOCK_STRUCT, $start, $len, 0, F_WRLCK, SEEK_SET); That should be all on one line; it's the same parameters in a different order. Then go up to the my $FLOCK_STRUCT line and make the corresponding change: my $FLOCK_STRUCT = 'l2is2'; This is *completely* untested - but looks to be more in line with the FreeBSD man page. If it works, I'll add a rather tidier patch to the port in due course - one that updates the comments as well. If this doesn't work, it needs further investigation. Best wishes, David -- David Wood david@wood2.org.uk
Hi David, On Mon, 2008-01-14 at 09:28 +0000, David Wood wrote:
FreeRADIUS 2.0.0-pre2 is some way behind the released FreeRADIUS 2.0.0. By the time 2.0.0-pre2 got committed to the FreeBSD ports tree, we were very close to the 2.0.0 release.
FreeBSD PR ports/119582 contains what should become the net/freeradius2 port for the 2.0.0 release version.
http://www.freebsd.org/cgi/query-pr.cgi?pr=119582
However, radsqlrelay is version 1.7 in the released 2.0.0 as well.
I'm no real coder myself, hence, the need to seek direction. Any necessary change on the script that I need to make?
struct flock has different parameters in FreeBSD's C library - or, more accurately, the same parameters in a different order - see man 2 fcntl
In /usr/local/bin/radsqlrelay read down a few lines further than you were looking into sub setlock. Back up the file, then change the my $packed line to:
my $packed = pack($FLOCK_STRUCT, $start, $len, 0, F_WRLCK, SEEK_SET);
That should be all on one line; it's the same parameters in a different order.
Then go up to the my $FLOCK_STRUCT line and make the corresponding change:
my $FLOCK_STRUCT = 'l2is2';
This is *completely* untested - but looks to be more in line with the FreeBSD man page. If it works, I'll add a rather tidier patch to the port in due course - one that updates the comments as well.
If this doesn't work, it needs further investigation.
Thanks for the quick reply. Made these changes: line 53 my $FLOCK_STRUCT = 'l2is2'; line 62 my $packed = pack($FLOCK_STRUCT, $start, $len, 0, F_WRLCK, SEEK_SET); Still returns: error: Couldn't lock /home/radius/sql-relay.work: Invalid argument BR, roy
Hi Roy and everyone, In message <1200308266.14269.49.camel@localhost>, roy <bandwidth.user@gmail.com> writes
Made these changes: line 53 my $FLOCK_STRUCT = 'l2is2'; line 62 my $packed = pack($FLOCK_STRUCT, $start, $len, 0, F_WRLCK, SEEK_SET);
Still returns: error: Couldn't lock /home/radius/sql-relay.work: Invalid argument
<sigh> Sometimes blind code changes don't work out. Unfortunately I am flying blind, as I don't use radsqlrelay and I can't quickly concoct an environment for it. I think line 53 should actually be my $FLOCK_STRUCT = 'q2is2' as off_t is 64 bit in FreeBSD. Sorry for missing that earlier. The lang/perl5.8 port is set to build perl with 64 bit integer support unless you deliberately set the WITHOUT_PERL_64BITINT knob. That's just as well, as this needs 64 bit integers. Please feed back whether or not that works. If that's not it, I'm a bit stuck - and short of time to work on FreeRADIUS related stuff at the moment. Still, I'll do my best. Best wishes, David -- David Wood david@wood2.org.uk
Hi David/List, On Tue, 2008-01-15 at 17:19 +0000, David Wood wrote:
<sigh> Sometimes blind code changes don't work out. Unfortunately I am flying blind, as I don't use radsqlrelay and I can't quickly concoct an environment for it.
I think line 53 should actually be
my $FLOCK_STRUCT = 'q2is2'
as off_t is 64 bit in FreeBSD. Sorry for missing that earlier.
The lang/perl5.8 port is set to build perl with 64 bit integer support unless you deliberately set the WITHOUT_PERL_64BITINT knob. That's just as well, as this needs 64 bit integers.
Please feed back whether or not that works. If that's not it, I'm a bit stuck - and short of time to work on FreeRADIUS related stuff at the moment. Still, I'll do my best.
Worked like a charm. Cheers! roy
participants (2)
-
David Wood -
roy