~ubuntu-branches/ubuntu/lucid/wpasupplicant/lucid-updates

« back to all changes in this revision

Viewing changes to eapol_sm.c

  • Committer: Bazaar Package Importer
  • Author(s): Kel Modderman
  • Date: 2006-10-05 08:04:01 UTC
  • mfrom: (1.1.5 upstream) (3 etch)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061005080401-r8lqlix4390yos7b
Tags: 0.5.5-2
* Update madwifi headers to latest SVN. (Closes: #388316)
* Remove failed attempt at action locking. [debian/functions.sh,
  debian/wpa_action.sh]
* Add hysteresis checking functions, to avoid "event loops" while
  using wpa-roam. [debian/functions.sh, debian/wpa_action.sh]
* Change of co-maintainer email address.
* Add ishex() function to functions.sh to determine wpa-psk value type in
  plaintext or hex. This effectively eliminates the need for the bogus and
  somewhat confusing wpa-passphrase contruct specific to our scripts and
  allows wpa-psk to work with either a 8 to 63 character long plaintext
  string or 64 character long hex string.
* Adjust README.modes to not refer to the redundant wpa-passphrase stuff.
* Add big fat NOTE about acceptable wpa-psk's to top of example gallery.
* Strip surrounding quotes from wpa-ssid if present, instead of just whining
  about them.
* Update email address in copyright blurb of functions.sh, ifupdown.sh and
  wpa_action.sh.  

Show diffs side-by-side

added added

removed removed

Lines of Context:
997
997
int eapol_sm_get_status(struct eapol_sm *sm, char *buf, size_t buflen,
998
998
                        int verbose)
999
999
{
1000
 
        int len;
 
1000
        int len, ret;
1001
1001
        if (sm == NULL)
1002
1002
                return 0;
1003
1003
 
1006
1006
                       "suppPortStatus=%s\n",
1007
1007
                       eapol_supp_pae_state(sm->SUPP_PAE_state),
1008
1008
                       eapol_port_status(sm->suppPortStatus));
 
1009
        if (len < 0 || (size_t) len >= buflen)
 
1010
                return 0;
1009
1011
 
1010
1012
        if (verbose) {
1011
 
                len += snprintf(buf + len, buflen - len,
1012
 
                                "heldPeriod=%u\n"
1013
 
                                "authPeriod=%u\n"
1014
 
                                "startPeriod=%u\n"
1015
 
                                "maxStart=%u\n"
1016
 
                                "portControl=%s\n"
1017
 
                                "Supplicant Backend state=%s\n",
1018
 
                                sm->heldPeriod,
1019
 
                                sm->authPeriod,
1020
 
                                sm->startPeriod,
1021
 
                                sm->maxStart,
1022
 
                                eapol_port_control(sm->portControl),
1023
 
                                eapol_supp_be_state(sm->SUPP_BE_state));
 
1013
                ret = snprintf(buf + len, buflen - len,
 
1014
                               "heldPeriod=%u\n"
 
1015
                               "authPeriod=%u\n"
 
1016
                               "startPeriod=%u\n"
 
1017
                               "maxStart=%u\n"
 
1018
                               "portControl=%s\n"
 
1019
                               "Supplicant Backend state=%s\n",
 
1020
                               sm->heldPeriod,
 
1021
                               sm->authPeriod,
 
1022
                               sm->startPeriod,
 
1023
                               sm->maxStart,
 
1024
                               eapol_port_control(sm->portControl),
 
1025
                               eapol_supp_be_state(sm->SUPP_BE_state));
 
1026
                if (ret < 0 || (size_t) ret >= buflen - len)
 
1027
                        return len;
 
1028
                len += ret;
1024
1029
        }
1025
1030
 
1026
1031
        len += eap_sm_get_status(sm->eap, buf + len, buflen - len, verbose);
1044
1049
int eapol_sm_get_mib(struct eapol_sm *sm, char *buf, size_t buflen)
1045
1050
{
1046
1051
        size_t len;
 
1052
        int ret;
1047
1053
 
1048
1054
        if (sm == NULL)
1049
1055
                return 0;
1050
 
        len = snprintf(buf, buflen,
 
1056
        ret = snprintf(buf, buflen,
1051
1057
                       "dot1xSuppPaeState=%d\n"
1052
1058
                       "dot1xSuppHeldPeriod=%u\n"
1053
1059
                       "dot1xSuppAuthPeriod=%u\n"
1064
1070
                       "Authorized" : "Unauthorized",
1065
1071
                       sm->SUPP_BE_state);
1066
1072
 
1067
 
        if (len >= buflen)
1068
 
                return len;
 
1073
        if (ret < 0 || (size_t) ret >= buflen)
 
1074
                return 0;
 
1075
        len = ret;
1069
1076
 
1070
 
        len += snprintf(buf + len, buflen - len,
 
1077
        ret = snprintf(buf + len, buflen - len,
1071
1078
                       "dot1xSuppEapolFramesRx=%u\n"
1072
1079
                       "dot1xSuppEapolFramesTx=%u\n"
1073
1080
                       "dot1xSuppEapolStartFramesTx=%u\n"
1091
1098
                       sm->dot1xSuppLastEapolFrameVersion,
1092
1099
                       MAC2STR(sm->dot1xSuppLastEapolFrameSource));
1093
1100
 
 
1101
        if (ret < 0 || (size_t) ret >= buflen - len)
 
1102
                return len;
 
1103
        len += ret;
 
1104
 
1094
1105
        return len;
1095
1106
}
1096
1107
#endif /* CONFIG_CTRL_IFACE */
1663
1674
}
1664
1675
 
1665
1676
 
 
1677
static void eapol_sm_notify_pending(void *ctx)
 
1678
{
 
1679
        struct eapol_sm *sm = ctx;
 
1680
        if (sm == NULL)
 
1681
                return;
 
1682
        if (sm->eapReqData && !sm->eapReq) {
 
1683
                wpa_printf(MSG_DEBUG, "EAPOL: received notification from EAP "
 
1684
                           "state machine - retrying pending EAP Request");
 
1685
                sm->eapolEap = TRUE;
 
1686
                sm->eapReq = TRUE;
 
1687
                eapol_sm_step(sm);
 
1688
        }
 
1689
}
 
1690
 
 
1691
 
1666
1692
static struct eapol_callbacks eapol_cb =
1667
1693
{
1668
1694
        eapol_sm_get_config,
1672
1698
        eapol_sm_set_int,
1673
1699
        eapol_sm_get_eapReqData,
1674
1700
        eapol_sm_set_config_blob,
1675
 
        eapol_sm_get_config_blob
 
1701
        eapol_sm_get_config_blob,
 
1702
        eapol_sm_notify_pending
1676
1703
};
1677
1704
 
1678
1705