Skip to content

Instantly share code, notes, and snippets.

@khanzf
Created July 3, 2018 07:03
Show Gist options
  • Save khanzf/0fdd543d73fc8d87155ec51a7326e710 to your computer and use it in GitHub Desktop.
Save khanzf/0fdd543d73fc8d87155ec51a7326e710 to your computer and use it in GitHub Desktop.
dtrace to check wifi channel
#!/usr/sbin/dtrace -qs
/*
* Run with sudo ./tap_function.d -q
*/
struct ieee80211_channel {
uint32_t ic_flags; /* see below */
uint16_t ic_freq; /* primary centre frequency in MHz */
uint8_t ic_ieee; /* IEEE channel number */
int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */
int8_t ic_maxpower; /* maximum tx power in .5 dBm */
int8_t ic_minpower; /* minimum tx power in .5 dBm */
uint8_t ic_state; /* dynamic state */
uint8_t ic_extieee; /* HT40 extension channel number */
int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */
uint8_t ic_pad;
uint16_t ic_devdata; /* opaque device/driver data */
uint8_t ic_vht_ch_freq1; /* VHT primary freq1 IEEE value */
uint8_t ic_vht_ch_freq2; /* VHT secondary 80MHz freq2 IEEE value */
uint16_t ic_freq2; /* VHT secondary 80MHz freq2 MHz */
};
struct ieee80211_channel *c;
fbt:rtwn:r92c_set_chan:entry {
c = (struct ieee80211_channel *)arg1;
printf("Channel -> %d\n", c->ic_ieee);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment