OpenWrt Forum Archive

Topic: [solved] luci always adds "s:" before wep key

The content of this topic has been archived on 1 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I found that luci always added "s:" prefix to the wep key provided by the user.
if I set the wep key as 12345, after submitting,  /etc/config/wireless will show that the key is "s:12345"

in the source code from model/cbi/admin_network/wifi.lua , i found the code which did that:

function wepkey.write(self, section, value)
                if value and (#value == 5 or #value == 13) then
                        value = "s:" .. value
                end
                return Value.write(self, section, value)
        end

Why add "s:"? Why WEP only? (I didn't observe the same issue in WPA).
the actual key used by wep enc is still "12345"?

(Last edited by nossiac on 16 Dec 2013, 03:45)

This is so the key is treated as an ASCII string instead of hex.

Look in /sbin/wifi:prepare_key_wep() for more info.

@aport

Thanks! that 's exactly what I am looking for!

The discussion might have continued from here.