[Click] ARP problem
Eddie Kohler
kohler at cs.ucla.edu
Fri Apr 7 11:17:46 EDT 2006
Koen, Koen,
Why, why use Click 1.4.3? Current CVS is so much better! It includes many
fixes to ARPQuerier, for example!
2005-05-18 Wednesday 11:10 Eddie Kohler <kohler at cs.ucla.edu>
* elements/ethernet/arpquerier.cc (1.53),
elements/ethernet/arpquerier.hh (1.38),
test/ethernet/ARPQuerier-01.testie (1.1): more ARPQuerier fixes,
this time due to a regression test
2005-05-18 Wednesday 10:13 Eddie Kohler <kohler at cs.ucla.edu>
* elements/ethernet/: arpquerier.cc (1.52), arpquerier.hh (1.37):
attempt to fix crash seen by Adam Greenhalgh at UCL, using his
debugging: bad idea to expire parts of the ARP request cache when
youre holding on to a random pointer into that cache!!
Eddie
Koen Segers wrote:
> I was looking totally wrong. ddd told me the segmentation fault happend
> somewhere else. I find it very strange that valgrind gives an incorrect
> message, but I'm happy I found it, eventually :)
>
> On Wednesday 05 April 2006 16:02, Koen Segers wrote:
>> I have changed the arp elements from click-1.4.3 a bit, so that they work
>> with my dynamicly generated ip. All that was needed was to change the
>> static IPAddress to a pointer to the dynamic IPAddress.
>>
>> Recently I added merging of manet's to my DDHCP protocol. This implies that
>> some nodes reconfigure and get a new ip address.
>> The ARP elements become freaky now...
>>
>> ARPQuerier crashes with a segmentation fault on the following rules of
>> insert_entry (function is added as appendix):
>> if (_age_tail)
>> ae->age_pprev = &_age_tail->age_next;
>> else
>> ae->age_pprev = &_age_head;
>> _age_tail = *ae->age_pprev = ae;
>>
>> I tried to clear the arp table by calling clear_map but it gave the same
>> problem.
>>
>> Can somebody explain me what's going on? And how I can overcome this
>> problem? I understand the meaning of ARP, but I can't figure out how this
>> code works.
>>
>>
>> greetz
>>
>>
>>
>>
>> Appendix:
>> This is what I get from valgrind:
>> <snip>
>> 00:03:47:70:89:05: OLSRARPQuerier::there was no entry for 192.168.0.2
>> 00:03:47:70:89:05: OLSRARPQuerier::possible error
>> ==32368==
>> ==32368== Conditional jump or move depends on uninitialised value(s)
>> ==32368== at 0x8258A94:
>> Click::OLSRARPQuerier::insert_entry(Click::IPAddress const&,
>> Click::EtherAddress const&) (olsr_arpquerier.cc:303)
>> ==32368== by 0x8257A9A:
>> Click::AddARPEntry::simple_action(Click::Packet*) (packet.hh:655)
>> ==32368== by 0x81E6CFA: Click::Element::push(int, Click::Packet*)
>> (element.cc:848)
>> ==32368== by 0x825CAF9: Click::OLSRClassifier::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x825C22B: Click::OLSRCheckPacketHeader::push(int,
>> Click::Packet*) (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x8241C01: Click::IPFilter::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> 00:03:47:70:89:05: OLSRARPQuerier::no error occured
>> link 192.168.0.1 <--> 192.168.0.2 insert | 31 161050
>> 192.168.0.1 adding link to 192.168.0.2
>> Adding new neighbor: 192.168.0.2
>> No click upcall set!
>> 00:03:47:70:89:04: OLSRARPQuerier::there was no entry for 192.168.0.1
>> 00:03:47:70:89:04: OLSRARPQuerier::possible error
>> ==32368==
>> ==32368== Use of uninitialised value of size 4
>> ==32368== at 0x8258AA5:
>> Click::OLSRARPQuerier::insert_entry(Click::IPAddress const&,
>> Click::EtherAddress const&) (olsr_arpquerier.cc:307)
>> ==32368== by 0x8257A9A:
>> Click::AddARPEntry::simple_action(Click::Packet*) (packet.hh:655)
>> ==32368== by 0x81E6CFA: Click::Element::push(int, Click::Packet*)
>> (element.cc:848)
>> ==32368== by 0x825CAF9: Click::OLSRClassifier::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x825C22B: Click::OLSRCheckPacketHeader::push(int,
>> Click::Packet*) (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x8241C01: Click::IPFilter::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368==
>> ==32368== Invalid write of size 4
>> ==32368== at 0x8258AA5:
>> Click::OLSRARPQuerier::insert_entry(Click::IPAddress const&,
>> Click::EtherAddress const&) (olsr_arpquerier.cc:307)
>> ==32368== by 0x8257A9A:
>> Click::AddARPEntry::simple_action(Click::Packet*) (packet.hh:655)
>> ==32368== by 0x81E6CFA: Click::Element::push(int, Click::Packet*)
>> (element.cc:848)
>> ==32368== by 0x825CAF9: Click::OLSRClassifier::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x825C22B: Click::OLSRCheckPacketHeader::push(int,
>> Click::Packet*) (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x8241C01: Click::IPFilter::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== Address 0x59 is not stack'd, malloc'd or (recently) free'd
>> ==32368==
>> ==32368== Process terminating with default action of signal 11 (SIGSEGV)
>> ==32368== Access not within mapped region at address 0x59
>> ==32368== at 0x8258AA5:
>> Click::OLSRARPQuerier::insert_entry(Click::IPAddress const&,
>> Click::EtherAddress const&) (olsr_arpquerier.cc:307)
>> ==32368== by 0x8257A9A:
>> Click::AddARPEntry::simple_action(Click::Packet*) (packet.hh:655)
>> ==32368== by 0x81E6CFA: Click::Element::push(int, Click::Packet*)
>> (element.cc:848)
>> ==32368== by 0x825CAF9: Click::OLSRClassifier::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x825C22B: Click::OLSRCheckPacketHeader::push(int,
>> Click::Packet*) (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x8241C01: Click::IPFilter::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>> ==32368== by 0x81E6D25: Click::Element::push(int, Click::Packet*)
>> (element.hh:314)
>>
>>
>>
>> void OLSRARPQuerier::insert_entry(const IPAddress &ip, const EtherAddress
>> ðer)
>> {
>> int bucket = ip_bucket(ip);
>> //click_chatter("OLSRARPQuerier::insert_entry met ip %s en ethernet %s",
>> ip.s().cc(), ether.s().cc());
>>
>> _lock.acquire_read();
>>
>> ARPEntry *ae = _map[bucket];
>>
>> while (ae && ae->ip != ip)
>> ae = ae->next;
>>
>> if (ae)
>> {
>> //click_chatter("%s:\t:OLSRARPQuerier::there was allready an entry for
>> %s", _info->get_hw_addr().s().cc(), ip.s().cc());
>> if (ae->ok && ae->en != ether)
>> click_chatter("OLSRARPQuerier overwriting an entry");
>> ae->en = ether;
>> ae->last_response_jiffies = click_jiffies();
>> _lock.release_read();
>> }
>> else
>> {
>> click_chatter("%s:\tOLSRARPQuerier::there was no entry for %s",
>> _info->get_hw_addr().s().cc(), ip.s().cc());
>> _lock.release_read();
>> _lock.acquire_write();
>> if (_cache_size >= _capacity)
>> expire_hook(0, this);
>> if (ARPEntry *ae = new ARPEntry)
>> {
>> ae->ip = ip;
>> ae->en = ether;
>> ae->ok = 1; // the entry is automatically ok, since we are setting
>> the mac address
>> ae->polling = 0; // don't know what polling does ..
>> ae->head = ae->tail = 0; // no buffered packets
>> ae->last_response_jiffies = click_jiffies();
>> ae->pprev = &_map[bucket];
>> if ((ae->next = _map[bucket]))
>> ae->next->pprev = &ae->next;
>> _map[bucket] = ae;
>>
>> click_chatter("%s:\tOLSRARPQuerier::possible error",
>> _info->get_hw_addr().s().cc());
>> if (_age_tail)
>> ae->age_pprev = &_age_tail->age_next;
>> else
>> ae->age_pprev = &_age_head;
>> _age_tail = *ae->age_pprev = ae;
>> click_chatter("%s:\tOLSRARPQuerier::no error occured",
>> _info->get_hw_addr().s().cc());
>> ae->age_next = 0;
>> }
>> _lock.release_write();
>> }
>> }
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list