partially parse radiotap header to get proper offset for contents

This commit is contained in:
Morgan 'ARR\!' Allen 2024-01-06 13:08:19 -08:00
parent d38946fcc7
commit a0e790ff76

View file

@ -43,12 +43,22 @@ int ifnow_now_receive_callback(void *cfg, uint8_t *buf, ssize_t len) {
} }
printf("\n"); printf("\n");
struct IEEE80211_radiotap radiotap;
struct IEEE80211_wlan wlan;
memcpy(&radiotap, buf, sizeof(struct IEEE80211_radiotap));
memcpy(&wlan, buf + radiotap.length, len - radiotap.length);
// TODO apply buf to actual structs of headers // TODO apply buf to actual structs of headers
uint8_t bp = 57; uint8_t bp = radiotap.length + 24 + 7 + 8;
int err = ifnow_tun_send(&tun_cfg, buf + bp, len - bp);
int err = ifnow_tun_send(&tun_cfg, buf + bp, len - bp - 4);
if(err < 0) { if(err < 0) {
perror("Failed to send over tunnel"); perror("Failed to send over tunnel");
} }
return err;
} }
int ifnow_tun_receive_callback(void *cfg, uint8_t *buf, uint32_t len) { int ifnow_tun_receive_callback(void *cfg, uint8_t *buf, uint32_t len) {