Hi Harshit,
On 19.04.21, 10:48, "Harshit Jain" <hjain(a)arista.com> wrote:
I see that we set SO_REUSEADDR to false while binding to a datagram socket whereas we
set it to true for stream sockets. Is there a particular reason for this?
Not sure about alle the implications, and if it would event work. But basically if you set
SO_REUSEADDR on a DGRAM socket, every socket bound to that port/address will receive a
copy of the packet. In your case, using the same port to listen and as a source for the
outgoing packets, both threads (serving radsrv() and replyh() ) would get all requests and
responses.
In my setup, I have radsecproxy listening on *:2083 for UDP requests and I have a
local radius server listening on localhost:3799 (among other external servers). I was
looking to set a fixed source port from which radsecproxy sends out requests to the
local radius server, so I added a source block to the server config like so
server localServer {
...
source 127.0.0.2:2083
}
but I got an error saying "address already in use". I dug around and found
that its because SO_REUSEADDR is not set for datagram sockets.
Is there a reason for this and if so, is there any other way to add a fixed source
port to a local radius server config block?
Telling by your config snippet, you are already using the master branch, which basically
allows to specify a source port/address per server (this will be included in the next 1.9
release). However, because auf the reasoning above, you cannot use the same port you are
already listening on; at least for UDP.
Please note that while having a second look at the code, I got the feeling that there
might still be some bugs in there.
Regards,
Fabian
--
SWITCH
Fabian Mauchle, Network Engineer
Werdstrasse 2, P.O. Box, 8021 Zurich, Switzerland
Phone +41 44 268 15 30, direct +41 44 268 15 39