[Click] Handlers

Michael Neufeld neufeldm at cs.colorado.edu
Tue Feb 3 19:31:51 EST 2004


OK, I did a nsclick build today with grid, I think I've got the build 
problems sorted out -- the problems with the "grid" elements are due to 
some missing and misplaced CLICK_DECL/CLICK_ENDDECL pairs, and there's a 
minor change over in the fromdump element in userlevel. There also 
appears to have been a change in routerthread.cc with respect to 
accessing timer_list(). I haven't checked anything in, have attached 
diff files showing the changes. I haven't actually smoke tested things 
in nsclick, just fixed the compiler errors so the library would build.

By the way, if you're using the 2.26 "beta" nsclick patch let me know if 
you're getting really slow performance. Some changes were made to the 
ns-2 scheduler which make it slow to a crawl if you add a bunch of 
simultaneous events - I've got a workaround patch for the ns-2 side of 
nsclick which consolidates simultaneous events scheduled by Click to 
reduce that load. Hardly elegant, but it does seem to get the job done. 
Haven't had a chance to shove it into a new patchset yet, but if folks 
are having problems I can probably whip something up.

-Mike

Michael Neufeld wrote:
> I haven't been building grid in my nsclick environment, but am planning 
> on doing a full click CVS update at some point this week and give it a 
> whirl. Another thought on setting the next hop ethernet address would be 
> to use the packet annotation space to pass along the destination 
> ethernet address to a custom element which cooks up the full header. 
> I've done that a couple of times when I wanted to keep my ethernet 
> address lookup and encapsulation elements separate -
> worked just fine as long as I had enough unused annotation bytes to spare.
> 
> -Mike
> 
> Douglas S. J. De Couto wrote:
> 
>> Hi Michael,
>>
>> Sorry, I started looking at your grid/nsclick problem, but then got 
>> swamped.
>>
>> I use EtherAddress all the time, and haven't seen any problem with its 
>> s() method, perhaps you can send an example of the problem?
>>
>> Can you describe the seg fault with more detail -- where does it occur?
>>
>> The general approach you describe seems like it should work, although 
>> you might get better performance by writing the ethernet destination 
>> address in your own element (which is what Grid/DSDV does), or using a 
>> more ARP-like element (either the click IP ARP elements, or something 
>> like the Grid DSRArpTable).  The EtherEncap element isn't designed to 
>> be very dynamic, but you could write one like it with set_dest() and 
>> set_src() C++ methods that your element could call directly.
>>
>> On 3 Feb 2004, at 11:15, Michael Voorhaen wrote:
>>
>>> Hi,
>>>
>>> I sent an e-mail last week, stating that I had problems compiling 
>>> grid for
>>> nsclick and haven't seen an answer yet.
>>>
>>> I've skipped getting grid to work for a while and started 
>>> implementing the
>>> hierarchical protocol that I've been working on (based on 
>>> hierarchical state
>>> routing). Basically to concept is to implement the hierarchical 
>>> protocol on
>>> top of a (slightly modified) flat routing protocol. I've started
>>> implementing this top down, so I only needed some stubs where the flat
>>> protocol is required and I can debug that software as quick as 
>>> possible. Now
>>> somewhere in my click graph I have this situation:
>>>
>>>     [GetNextHop]     ----> 0: [EtherEncap]
>>>                  ---->    1: [Discard]
>>>
>>> The GetNextHop element is one that I implemented. It determines the 
>>> next hop
>>> for the packet (stub code for now). Now what I want to happen than is 
>>> that
>>> EtherEncap encapsulates the IP packet with the correct destination 
>>> Ethernet
>>> address in the Ethernet header. So for that I need to pass the next hop
>>> Ethernet address to EtherEncap. I want to do this with handlers, so I 
>>> gave
>>> EtherEncap a name and obtained a pointer to it in the GetNextHop 
>>> code. So
>>> far so good. I then get the handler object "dst":
>>>
>>> In GetNextHop.push();
>>>         This->router()->handler("dst", _etherEncap);
>>>
>>> _etherEncap points to the EtherEncap object.
>>>
>>> This gets me the handler, and then I call call_write( 
>>> next_hop_ether.s(),
>>> _etherEncap,_errh);
>>>
>>> This causes a segmentation fault.
>>>
>>> Now I've been trying to narrow down the problems and I found this:
>>>     * there is something wrong with how EtherAddress creates the string
>>> representation of the address (check it out, if you have the time).
>>>     * even when I replace next_hop_ether.s() (which is not computed
>>> correctly) with an actual ethernet address that works when manually
>>> configured in a click file, I still get the segmentation fault.
>>>
>>> I could really use some help here. By the way, I'm using the CVS 
>>> version of
>>> click.
>>>
>>> Regards,
>>> Michael Voorhaen
>>>
>>> ========================================================
>>> Michael Voorhaen
>>> ========================================================
>>> Phd Student
>>> Dept. of Mathematics and Computer Sciences
>>> PATS (Performance Analysis of Telecommunication Systems)
>>> University of Antwerp
>>> Middelheimlaan 1
>>> 2020 Antwerpen, Belgium
>>> G1.11
>>> Phone: 03/2653905
>>> Mail: michael.voorhaen at ua.ac.be
>>> ========================================================
>>>
>>>
>>>
>>> _______________________________________________
>>> click mailing list
>>> click at amsterdam.lcs.mit.edu
>>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>>>
>> -- 
>> Douglas S. J. De Couto    <decouto at csail.mit.edu>
>>
>> _______________________________________________
>> click mailing list
>> click at amsterdam.lcs.mit.edu
>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
-------------- next part --------------
Index: dsr.hh
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/dsr.hh,v
retrieving revision 1.1
diff -u -r1.1 dsr.hh
--- dsr.hh	20 Aug 2003 20:48:24 -0000	1.1
+++ dsr.hh	4 Feb 2004 02:12:54 -0000
@@ -2,6 +2,7 @@
 #define CLICK_DSR_H
 
 /* #include <netinet/in.h> */
+CLICK_DECLS
 
 struct click_dsr { // DSR options header -- exactly one per packet
   unsigned char dsr_next_header; // original IP protocol field
@@ -140,5 +141,6 @@
 #define SET_DSR_LAST_HOP_ETH_ANNO1(p, v)	((p)->set_user_anno_us( 9, (v)))
 #define SET_DSR_LAST_HOP_ETH_ANNO2(p, v)	((p)->set_user_anno_us(11, (v)))
 #define SET_DSR_LAST_HOP_ETH_ANNO3(p, v)	((p)->set_user_anno_us(13, (v)))
-
+CLICK_ENDDECLS
 #endif
+
Index: dsrarptable.cc
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/dsrarptable.cc,v
retrieving revision 1.6
diff -u -r1.6 dsrarptable.cc
--- dsrarptable.cc	28 Jan 2004 14:54:38 -0000	1.6
+++ dsrarptable.cc	4 Feb 2004 02:12:54 -0000
@@ -32,7 +32,7 @@
 
 #include "dsrarptable.hh"
 #include "dsr.hh"
-
+CLICK_DECLS
 #define DEBUG_CHATTER  if (_debug) click_chatter
 
 DSRArpTable::DSRArpTable()
Index: dsrarptable.hh
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/dsrarptable.hh,v
retrieving revision 1.5
diff -u -r1.5 dsrarptable.hh
--- dsrarptable.hh	28 Jan 2004 14:54:39 -0000	1.5
+++ dsrarptable.hh	4 Feb 2004 02:12:54 -0000
@@ -5,7 +5,7 @@
 #include "dsrroutetable.hh"
 
 #include <click/bighashmap.hh>
-
+CLICK_DECLS
 
 /*
  * =c
@@ -106,5 +106,6 @@
   EtherAddress lookup_ip(IPAddress);
   bool _debug;
 };
+CLICK_ENDDECLS
 #endif
 
Index: dsrroutetable.hh
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/dsrroutetable.hh,v
retrieving revision 1.4
diff -u -r1.4 dsrroutetable.hh
--- dsrroutetable.hh	15 Dec 2003 14:19:14 -0000	1.4
+++ dsrroutetable.hh	4 Feb 2004 02:12:54 -0000
@@ -446,5 +446,5 @@
 			 f._target.addr() ^
 			 f._id));
 }
-
+CLICK_ENDDECLS
 #endif
Index: gridproxy.hh
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/gridproxy.hh,v
retrieving revision 1.2
diff -u -r1.2 gridproxy.hh
--- gridproxy.hh	11 Jun 2003 06:20:46 -0000	1.2
+++ gridproxy.hh	4 Feb 2004 02:12:54 -0000
@@ -5,7 +5,7 @@
 #include <click/glue.hh>
 #include <click/atomic.hh>
 #include <click/hashmap.hh>
-#include <click/hashmap.cc>
+//#include <click/hashmap.cc>
 #include <clicknet/ip.h>
 CLICK_DECLS
 
@@ -74,6 +74,6 @@
     
 };
 
-
+#include <click/hashmap.cc>
 CLICK_ENDDECLS
 #endif
Index: sr/srpacket.hh
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/grid/sr/srpacket.hh,v
retrieving revision 1.9
diff -u -r1.9 srpacket.hh
--- sr/srpacket.hh	14 Jan 2004 05:19:30 -0000	1.9
+++ sr/srpacket.hh	4 Feb 2004 02:12:55 -0000
@@ -2,7 +2,7 @@
 #define CLICK_SRPAKCET_HH
 #include <click/ipaddress.hh>
 #include <elements/grid/sr/path.hh>
-
+CLICK_DECLS
 
 #define max(a, b) ((a) > (b) ? (a) : (b))
 #define min(a, b) ((a) < (b) ? (a) : (b))
@@ -273,5 +273,5 @@
 }
 
 
-
+CLICK_ENDDECLS
 #endif /* CLICK_SRPACKET_HH */
-------------- next part --------------
? patchuserlevel
Index: fromdump.cc
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/elements/userlevel/fromdump.cc,v
retrieving revision 1.84
diff -u -r1.84 fromdump.cc
--- fromdump.cc	28 Jan 2004 08:02:42 -0000	1.84
+++ fromdump.cc	4 Feb 2004 02:14:17 -0000
@@ -159,7 +159,7 @@
 	simclick_sim mysiminst = myrouter->get_siminst();
 	char tmp[255];
 	simclick_sim_get_node_name(mysiminst,tmp,255);
-	_filename = String(tmp) + String("_") +  _filename;
+	_ff.filename() = String(tmp) + String("_") +  _ff.filename();
     }
 #endif
 
-------------- next part --------------
? patchlib
? template_def.cc
? templatei_orig.cc
Index: routerthread.cc
===================================================================
RCS file: /home/am0/click/cvsroot/release/one/lib/routerthread.cc,v
retrieving revision 1.34
diff -u -r1.34 routerthread.cc
--- routerthread.cc	7 Jan 2004 06:13:28 -0000	1.34
+++ routerthread.cc	4 Feb 2004 02:28:59 -0000
@@ -376,7 +376,7 @@
 	// If there's another timer, tell the simulator to make us
 	// run when it's due to go off.
 	struct timeval now, nextdelay, nexttime;
-	if (router()->timer_list()->get_next_delay(&nextdelay)) {
+	if (router()->master()->timer_list()->get_next_delay(&nextdelay)) {
 	    click_gettimeofday(&now);
 	    timeradd(&now, &nextdelay, &nexttime);
 	    simclick_sim_schedule(router()->get_siminst(),


More information about the click mailing list