hostAPd with Openflow
Fri Dec 12 12:49:19 PST 2014
I am attempting to modify hostAPd to work with Openflow switches. So I decided to use the WIRED DRIVER implementation as a starting point and modify it. Instead of receiving eapol (user) frames from the interface socket, I would be receiving encapsulated frames from Openflow packets (from a remote switch).
During initialisation phase of the wired driver, a handler function is registered with eloop (where is goes into eloop readers table) with the eloop_register_read_sock(drv->sock, handle_read, drv->ctx, NULL).
When eloop_run() goes into the loop, the socket is listened on and once data is received on the socket, the eloop_sock_table_dispatch() function calls back the handler function, which then reads the data from the socket. The handler function (handle_read() / handle_dhcp()) then calls the wpa_supplicant_event(eloop_ctx, EVENT_NEW_STA, &event).
Now, because I am planning on receiving data from an openflow switch, I have a challenge with how the data is relayed to the handler function. These are 2 options I am considering:
1. When I receive data from the openflow switch (and decapsulate it) - I then pass it directly to the handler function (handle_openflow_data for example) which then passes it on to the wpa_supplicant_event(). But my challenge here is how do I include the eloop_ctx and sock_ctx information? Since I am by-passing eloop altogether to send the data to the driver function that handles the data. I have attempted to not include these pieces of information and the program crashes (expected)!
2. The second option I am considering is to register the callback handler function with eloop_register_read_sock (as normally would be done). When data is received from my openflow switch, I then find a way to make eloop callback the handler function (with eloop_ctx and user_data), just as is the case for normal socket reading. But the challenge here is that the socket table, for readers/writers/exception requires an open socket context information passed across, which i dont have because I am not receiving my data from a socket!
I think the fundamental piece I am missing that the actual use of eloop_data and user_data! These seem to be used for calling back handler functions (for reading sockets).
Any help with this would be appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Hostap