cybersecurity · intermediate · ~15 min · safe pentest lab
Extract the upper nibble.
Extract the 4-bit frame SUBTYPE (the upper nibble) from an 802.11 Frame Control byte.
Implement int frame_subtype(unsigned char fc0) that returns bits 4-7 of fc0, i.e. (fc0 >> 4) & 0xF.
fc0: the first byte of the Frame Control field. The grader passes fixed bytes.Returns int: the 4-bit subtype (0..15). For example, within a management frame, 8 is a beacon and 12 is a deauth.
frame_subtype(0x80) -> 8 (beacon)
frame_subtype(0xC0) -> 12 (deauth)
The Frame Control first byte fc0.
An int: the 4-bit subtype (fc0 >> 4) & 0xF.
Shift right 4, mask 0xF.
int frame_subtype(unsigned char fc0) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.