| | 580 | cipher = s:taboption("encryption", ListValue, "cipher", translate("Cipher")) |
| | 581 | cipher.rmempty = false |
| | 582 | cipher:depends({encryption="wpa"}) |
| | 583 | cipher:depends({encryption="wpa2"}) |
| | 584 | cipher:depends({encryption="psk"}) |
| | 585 | cipher:depends({encryption="psk2"}) |
| | 586 | cipher:depends({encryption="wpa-mixed"}) |
| | 587 | cipher:depends({encryption="psk-mixed"}) |
| | 588 | cipher:value("auto", translate("auto")) |
| | 589 | cipher:value("ccmp", translate("Force CCMP (AES)")) |
| | 590 | cipher:value("tkip", translate("Force TKIP")) |
| | 591 | cipher:value("tkip+ccmp", translate("Force TKIP and CCMP (AES)")) |
| | 592 | |
| | 593 | function encr.cfgvalue(self, section) |
| | 594 | local v = tostring(ListValue.cfgvalue(self, section)) |
| | 595 | if v == "wep" then |
| | 596 | return "wep-open" |
| | 597 | elseif v and v:match("%+") then |
| | 598 | return (v:gsub("%+.+$", "")) |
| | 599 | end |
| | 600 | return v |
| | 601 | end |
| | 602 | |
| 584 | | self.map.uci:set("wireless", section, "encryption", value) |
| | 609 | if e and (c == "tkip" or c == "ccmp" or c == "tkip+ccmp") then |
| | 610 | e = e .. "+" .. c |
| | 611 | end |
| | 612 | self.map:set(section, "encryption", e) |
| | 613 | end |
| | 614 | |
| | 615 | function cipher.cfgvalue(self, section) |
| | 616 | local v = tostring(ListValue.cfgvalue(encr, section)) |
| | 617 | if v and v:match("%+") then |
| | 618 | v = v:gsub("^[^%+]+%+", "") |
| | 619 | if v == "aes" then v = "ccmp" |
| | 620 | elseif v == "tkip+aes" then v = "tkip+ccmp" |
| | 621 | elseif v == "aes+tkip" then v = "tkip+ccmp" |
| | 622 | elseif v == "ccmp+tkip" then v = "tkip+ccmp" |
| | 623 | end |
| | 624 | end |
| | 625 | return v |
| | 626 | end |
| | 627 | |
| | 628 | function cipher.write(self, section) |
| | 629 | return encr:write(section) |