OT: how to change eapol_test.c to use same udp source port?

Jouni Malinen j
Sun Dec 18 10:55:52 PST 2011

On Sun, Dec 18, 2011 at 10:10:39AM -0800, Vincent Li wrote:
> this topic might be off, I have a situation that I need to modify
> eapol_test.c or some part of wpa_supplicant to let eapol_test.c use
> same udp source port to test my radius server to reproduce a problem,
> I looked an eapol_test.c code, it is not obvious to me where I can
> change it to use same source port. could somepone shed a light on
> this?

eapol_test uses the RADIUS client implementation in
src/radius/radius_client.c. You can modify radius_change_server() there
to bind the socket to a specific local socket. The easiest way of doing
this would be modify the force_client_addr case that is already calling
bind(). Just change the htons(0) to a specific port instead of
auto-selection. You'll need to pass -A<local IP addr> to eapol_test to
get that force_client_addr case getting called.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list