MCPcopy Create free account
hub / github.com/F-Stack/f-stack / set80211nwkey

Function set80211nwkey

tools/ifconfig/ifieee80211.c:979–1015  ·  view source on GitHub ↗

* This function is purely a NetBSD compatibility interface. The NetBSD * interface is too inflexible, but it's there so we'll support it since * it's not all that hard. */

Source from the content-addressed store, hash-verified

977 * it's not all that hard.
978 */
979static void
980set80211nwkey(const char *val, int d, int s, const struct afswtch *rafp)
981{
982 int txkey;
983 int i, len;
984 u_int8_t data[IEEE80211_KEYBUF_SIZE];
985
986 set80211(s, IEEE80211_IOC_WEP, IEEE80211_WEP_ON, 0, NULL);
987
988 if (isdigit((int)val[0]) && val[1] == ':') {
989 txkey = val[0]-'0'-1;
990 val += 2;
991
992 for (i = 0; i < 4; i++) {
993 bzero(data, sizeof(data));
994 len = sizeof(data);
995 val = get_string(val, ",", data, &len);
996 if (val == NULL)
997 exit(1);
998
999 set80211(s, IEEE80211_IOC_WEPKEY, i, len, data);
1000 }
1001 } else {
1002 bzero(data, sizeof(data));
1003 len = sizeof(data);
1004 get_string(val, NULL, data, &len);
1005 txkey = 0;
1006
1007 set80211(s, IEEE80211_IOC_WEPKEY, 0, len, data);
1008
1009 bzero(data, sizeof(data));
1010 for (i = 1; i < 4; i++)
1011 set80211(s, IEEE80211_IOC_WEPKEY, i, 0, data);
1012 }
1013
1014 set80211(s, IEEE80211_IOC_WEPTXKEY, txkey, 0, NULL);
1015}
1016
1017static void
1018set80211rtsthreshold(const char *val, int d, int s, const struct afswtch *rafp)

Callers

nothing calls this directly

Calls 4

set80211Function · 0.85
isdigitFunction · 0.85
bzeroFunction · 0.85
get_stringFunction · 0.70

Tested by

no test coverage detected