sending EAPOL Logoff on SIGTERM for wired ethernet connections

Simner, John john.simner
Fri May 11 01:51:59 PDT 2012


An embedded product with a wired ethernet connection to a switch port must send a EAPOL logoff to the switch port when the product is rebooted.
Prior to the reboot or shutdown, the embedded product sends a SIGTERM to all running processes.
So, the wpa_supplicant must send the EAPOL logoff on receipt of the SIGTERM.

The following patch achieves this... 

cat 0.7.3SendEapolLogoffOnSigTerm.patch
--- wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c        2010-09-07 17:43:39.000000000 +0200
+++ /tmp/src/wpa_supplicant/wpa_supplicant.c    2012-05-09 15:33:36.000000000 +0200
@@ -577,6 +577,7 @@ static void wpa_supplicant_terminate(int
        struct wpa_global *global = signal_ctx;
        struct wpa_supplicant *wpa_s;
        for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+               eapol_sm_notify_logoff(wpa_s->eapol, TRUE);
                wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING "- signal %d "
                        "received", sig);
        }

This is the simplest solution and relies upon the underlying drivers to know whether they should sent the EAPOL logoff or not.
This approach is based on what happens when wpa_cli logoff is sent to the wpa control interface.

The wpa control interface could not be used because when the embedded product is rebooted, SIGTERM would be sent to the two different processes; wpa_supplicant and the one sending the wpa_cli logoff.  There is a potential race condition as there is no guarantee which process would handle the SIGTERM first and whether the wpa_cli logoff is sent, handled, and the EAPOL logoff is actually sent.

Therefore, the simplest solution of wpa_supplicant handling the SIGTERM and sending the EAPOL logoff has been implemented.
If there is an alternative solution, please let us know.

Thanks..
John


John Simner BSc(Hons) MSc CEng. MIET
Software Engineer
Siemens Enterprise Communications Limited 

Tel: + 44 (0) 1908 817378
Please Note New Telephone number from 11/09/10: + 44 (0) 1908 817378
Email: John.Simner at siemens-enterprise.com

www.siemens.co.uk/enterprise

Communication for the open minded

Siemens Enterprise Communications Limited.

Registered office: Brickhill Street, Willen Lake, Milton Keynes, MK15 0DJ.

Registered No: 5903714, England.

Siemens Enterprise Communications Ltd is a Trademark Licensee of Siemens AG.

This communication contains information which is confidential and may also be privileged.  It is for the exclusive use of the addressee. If you are not the addressee please note that any distribution, reproduction, copying, publication or use of this communication or the information is prohibited. If you have received this communication in error, please contact us immediately and also delete the communication from your computer. We accept no liability for any loss or damage suffered by any person arising from use of this email.

Please consider the environment - do you really need to print this email?




More information about the Hostap mailing list