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

Function set80211macmac

tools/ifconfig/ifieee80211.c:1301–1318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1299}
1300
1301static void
1302set80211macmac(int s, int op, const char *val)
1303{
1304 char *temp;
1305 struct sockaddr_dl sdl;
1306
1307 temp = malloc(strlen(val) + 2); /* ':' and '\0' */
1308 if (temp == NULL)
1309 errx(1, "malloc failed");
1310 temp[0] = ':';
1311 strcpy(temp + 1, val);
1312 sdl.sdl_len = sizeof(sdl);
1313 link_addr(temp, &sdl);
1314 free(temp);
1315 if (sdl.sdl_alen != IEEE80211_ADDR_LEN)
1316 errx(1, "malformed link-level address");
1317 set80211(s, op, 0, IEEE80211_ADDR_LEN, LLADDR(&sdl));
1318}
1319
1320static
1321DECL_CMD_FUNC(set80211addmac, val, d)

Callers 1

ifieee80211.cFile · 0.85

Calls 4

mallocFunction · 0.85
link_addrFunction · 0.85
set80211Function · 0.85
freeFunction · 0.50

Tested by

no test coverage detected