[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] MAC_BROADCAST



Hi Sagnik,
  I tried a similar thing, though at the IP level. If you see the DSDV
architecture, if it gets a packet not addressed to it(for ex: a broadcast
packet) it will forward it to the routing agent. Actually the address demux
should forward it to the agent on the higher layer. So what i ended up doing
was changed 2 lines in ll.cc . Iam copying the entire recv() function of ll.cc
with this. Hope this helps.

void LL::recv(Packet* p, Handler* /*h*/)
{
        hdr_cmn *ch = HDR_CMN(p);
        //char *mh = (char*) HDR_MAC(p);
        //struct hdr_sr *hsr = HDR_SR(p);

        /*
         * Sanity Check
         */
        assert(initialized());

        if(p->incoming) {
                p->incoming = 0;
        }

        // If direction = UP, then pass it up the stack
        // Otherwise, set direction to DOWN and pass it down the stack
        if(ch->direction() == hdr_cmn::UP) {
                //if(mac_->hdr_type(mh) == ETHERTYPE_ARP)
                if(ch->ptype_ == PT_ARP)
                        arptable_->arpinput(p, this);
                else {
                       // Change begins here
                        hdr_ip *iph = HDR_IP(p);
                        if(iph->daddr() == IP_BROADCAST) {
                          iph->daddr() = mac_->addr();
                          ch->next_hop() = mac_->addr();
                        }
                       // Change ends here.
                        uptarget_ ? sendUp(p) : drop(p);
                }
                return;
        }

        ch->direction() = hdr_cmn::DOWN;
        sendDown(p);
}