Changing nwid on a wifi network means it is a new network. By definition the WPA crypto keys use the nwid as part of the crypto hash. And it is super unlikely that a differently named network will have the same WEP key. In that case, you can enter it again.
With this, when you change wifi networks, you don't have to remember what else you have to remove. OK? Index: sys/net80211/ieee80211_ioctl.c =================================================================== RCS file: /cvs/openbsd/src/sys/net80211/ieee80211_ioctl.c,v retrieving revision 1.55 diff -u -p -u -p -r1.55 ieee80211_ioctl.c --- sys/net80211/ieee80211_ioctl.c 27 Oct 2017 12:22:40 -0000 1.55 +++ sys/net80211/ieee80211_ioctl.c 5 Nov 2017 16:49:55 -0000 @@ -439,6 +439,9 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon memset(ic->ic_des_essid, 0, IEEE80211_NWID_LEN); ic->ic_des_esslen = nwid.i_len; memcpy(ic->ic_des_essid, nwid.i_nwid, nwid.i_len); + /* disable WPA/WEP */ + ieee80211_disable_rsn(ic); + ieee80211_disable_wep(ic); error = ENETRESET; break; case SIOCG80211NWID: -- Larkinson's Law: All laws are basically false.