Hello Ns-users!

I am altering the mac layer by adding a special mac packet subtype packet.
I create a MAC packet with this subtype and make it a broadcast packet with
Packet* p = allocpkt();
Mac802_11* mac = new Mac802_11();
struct hdr_mac802_11* dh = HDR_MAC802_11(p);
dh->dh_fc.fc_subtype     = MAC_Subtype_NewType;
//make it broadcast
        u_int32_t dst=MAC_BROADCAST;
      STORE4BYTE(&dst, (dh->dh_ra));
struct hdr_cmn *hdr = HDR_CMN(p);
hdr->direction() = hdr_cmn::DOWN;
printf("calling send\n");
mac->send(p,(Handler*) 0);

but I must be missing something, because I get segmentation faults at the
EnergyModel call in mac-802_11.cc, in the Mac802_11::send(Packet *p, Handler
*h)function:

EnergyModel *em = netif_->node()->energy_model();
        if (em && em->sleep()) {
                em->set_node_sleep(0);
                em->set_node_state(EnergyModel::INROUTE);
        }
and if comment that out, the fault happens in the Mac802_11::transmit(Packet
*p, double timeout)
function: 
downtarget_->recv(p->copy(), this); 

Am I missing something vital in my packet creation?  Should I be setting
some other things before sending my packet to send?

Thank you!

Kathy


Reply via email to