Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4c8d0ec authored by San Mehat's avatar San Mehat Committed by The Android Open Source Project
Browse files

am 21e90f0e: nexus: Validate that priority and KeyManagement are set before enabling a network

Merge commit '21e90f0e'

* commit '21e90f0e':
  nexus: Validate that priority and KeyManagement are set before enabling a network
parents e0853557 21e90f0e
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -551,6 +551,20 @@ int WifiNetwork::setAllowedGroupCiphers(uint32_t mask) {
}
}


int WifiNetwork::setEnabled(bool enabled) {
int WifiNetwork::setEnabled(bool enabled) {

    if (enabled) {
        if (getPriority() == -1) {
            LOGE("Cannot enable network when priority is not set");
            errno = EAGAIN;
            return -1;
        }
        if (getAllowedKeyManagement() == KeyManagementMask::UNKNOWN) {
            LOGE("Cannot enable network when KeyManagement is not set");
            errno = EAGAIN;
            return -1;
        }
    }

    if (mSuppl->enableNetwork(mNetid, enabled))
    if (mSuppl->enableNetwork(mNetid, enabled))
        return -1;
        return -1;


+5 −4
Original line number Original line Diff line number Diff line
@@ -23,10 +23,11 @@


class KeyManagementMask {
class KeyManagementMask {
public:
public:
    static const uint32_t NONE      = 0;
    static const uint32_t UNKNOWN   = 0;
    static const uint32_t WPA_PSK   = 0x01;
    static const uint32_t NONE      = 0x01;
    static const uint32_t WPA_EAP   = 0x02;
    static const uint32_t WPA_PSK   = 0x02;
    static const uint32_t IEEE8021X = 0x04;
    static const uint32_t WPA_EAP   = 0x04;
    static const uint32_t IEEE8021X = 0x08;
    static const uint32_t ALL       = WPA_PSK | WPA_EAP | IEEE8021X;
    static const uint32_t ALL       = WPA_PSK | WPA_EAP | IEEE8021X;
};
};