diff --git a/src/main.c b/src/main.c index dbd8cc6..051a70c 100644 --- a/src/main.c +++ b/src/main.c @@ -43,12 +43,22 @@ int ifnow_now_receive_callback(void *cfg, uint8_t *buf, ssize_t len) { } 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 - uint8_t bp = 57; - int err = ifnow_tun_send(&tun_cfg, buf + bp, len - bp); + uint8_t bp = radiotap.length + 24 + 7 + 8; + + int err = ifnow_tun_send(&tun_cfg, buf + bp, len - bp - 4); + if(err < 0) { perror("Failed to send over tunnel"); } + + return err; } int ifnow_tun_receive_callback(void *cfg, uint8_t *buf, uint32_t len) {