Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEEE802.11 packet use after move RTS/CTS mode logic error #21

Closed
sgalgano opened this issue Jun 16, 2015 · 0 comments
Closed

IEEE802.11 packet use after move RTS/CTS mode logic error #21

sgalgano opened this issue Jun 16, 2015 · 0 comments
Assignees
Labels

Comments

@sgalgano
Copy link
Member

Reported via email by David Ward:

Fixed a bug in the 802.11 model which prevented RTS/CTS from ever being used. The old version tried to access a variable which had been moved, causing it to always return 0.

Developed by: Chris Pollard

diff --git a/src/models/mac/ieee80211abg/maclayer.cc b/src/models/mac/ieee80211abg/maclayer.cc
index bf5a18f..d743a29 100644
--- a/src/models/mac/ieee80211abg/maclayer.cc
+++ b/src/models/mac/ieee80211abg/maclayer.cc
@@ -1161,6 +1161,7 @@ EMANE::Models::IEEE80211ABG::MACLayer::processDownstreamPacket(DownstreamPacket
   std::uint8_t u8Retries{isBroadcast(pktInfo.getDestination()) ?
       std::uint8_t{} : macConfig_.getRetryLimit(u8Category)};

+  // this moves pkt, making it invalid, use entry.pkt_ from now on
   DownstreamQueueEntry entry{pkt, 
       timeNow, 
       macConfig_.getTxOpMicroseconds(u8Category), 
@@ -1168,7 +1169,7 @@ EMANE::Models::IEEE80211ABG::MACLayer::processDownstreamPacket(DownstreamPacket
       u8Retries};

   // check rts cts enable
-  if((macConfig_.getRtsThreshold() != 0) &&(macConfig_.getRtsThreshold() <= pkt.length()))
+  if((macConfig_.getRtsThreshold() != 0) &&(macConfig_.getRtsThreshold() <= entry.pkt_.length()))
     {
       // set rts cts flag
       entry.bRtsCtsEnable_ = true;
@sgalgano sgalgano self-assigned this Jun 16, 2015
@sgalgano sgalgano added the bug label Jun 16, 2015
sgalgano added a commit that referenced this issue Jul 17, 2015
being used. The old version tried to access a variable which had been
moved, causing it to always return 0.

Submitted-by: David Ward <david.ward@ll.mit.edu>
Developed-by: Christopher Pollard <Christopher.Pollard@ll.mit.edu>
See #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant