cozybit / wmediumd

mac80211_hwsim modifications and related stuff
13 stars 11 forks source link

ouput the dropped packets. #8

Open iamxg opened 6 years ago

iamxg commented 6 years ago

Dear bob copeland, I am learning to use wmediumd. I hope that I can add codes in the following codes and output the detail information of the dropped packets in log file. But I don't know how to modified codes in program wmediumd.c . Can you tell me how to implement it. Thanks a lot! if (drand48() <= error_prob) { w_logf(ctx, LOG_INFO, "Dropped mcast from " MAC_FMT " to " MAC_FMT " at receiver\n", MAC_ARGS(src), MAC_ARGS(station->addr)); continue; } Best Regards, Xian Guo

bcopeland commented 6 years ago

On Thu, Apr 26, 2018 at 09:14:56AM -0700, Xian Guo wrote:

Dear bob copeland, I am learning to use wmediumd. I hope that I can add codes in the following codes and output the detail information of the dropped packets in log file. But I don't know how to modified codes in program wmediumd.c . Can you tell me how to implement it. Thanks a lot! if (drand48() <= error_prob) { w_logf(ctx, LOG_INFO, "Dropped mcast from " MAC_FMT " to " MAC_FMT " at receiver\n", MAC_ARGS(src), MAC_ARGS(station->addr)); continue; }

If you just want to see what's in there, dump the buffer starting at frame->data which is frame->data_len bytes long.

If you find you have to do this a lot or have a lot of packets to go through, then I would suggest writing out a pcap file that you could later investigate with wireshark. It has a fairly simple structure:

https://wiki.wireshark.org/Development/LibpcapFileFormat

iamxg commented 6 years ago

Dear bob copeland, Thanks for your replying. I will try it according to your suggestion. Happy weekend! Xian Guo.