[PATCH] Move client socket to server structure.

Alan DeKok aland
Tue Oct 22 06:54:16 PDT 2013


  This patch has no functional effect, but it makes the code a little
simpler.  It also prepares the way for doing RADIUS over TCP, or even
TLS if so desired.

  There is a new function radius_client_sock().  It takes care of
opening a socket from the client to the server.

  radius_change_server() has been modified to call this function.  It
also now adds the new socket to the event loop, and removes any old
socket from the event loop.

  The references to auth_serv_sock, acct_serv_sock, auth_serv_sock6, and
acct_serv_sock6 have been removed.

  It used to create these sockets pro-actively, and then not bind them
to anything until radius_change_server() was called.  It now creates
sockets only when necessary.

  The code has been tested with eapol_test, and it works.

  I should have patches shortly to do RADIUS over TCP.  Now that the
socket code is abstracted in one function, that should be easy:

1) update the server structure to add "protocol", with a default of UDP.

2) update radius_client_socket() to create SOCK_STREAM if
protocol==IPPROTO_TCP

3) update radius_client_data to have a dynamically allocated buffer and
size, to allow partial reads from a TCP socket.

3) update radius_client_receive() to do partial reads on TCP sockets.


  The main reason for the current patch is to replace multiple instances
of socket(.. SOCK_DGRAM ... ) with only one in radius_client_socket().
That makes it much easier to add TCP functionality, as there's now only
one place to change the code.

  Alan DeKok.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Move-client-socket-to-server-structure.patch
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20131022/240d66ae/attachment-0001.asc>



More information about the Hostap mailing list