[Click] [click]SetIPChecksum

Pradeep Pradeep pradeep_addada at yahoo.co.in
Mon Aug 11 09:41:08 EDT 2008


Hi,

Thanks for the reply.

I am using the IP header of the input packet,which a perfect UDP/IP packet as IP header to the packet I created. So is it necessary that I modify my IP protocol version again.

>>>click_ip *iph = (click_ip*) packet->data();
>>>memcpy(iph, p->ip_header(), sizeof(click_ip));


I am using the UDP header of the input packet also in a similar 
way as my new packet's UDP header.

 So Do you still think the IP protocol field is making the difference?

 
Thanks,
Pradeep.

--- On Mon, 11/8/08, click-request at pdos.csail.mit.edu <click-request at pdos.csail.mit.edu> wrote:
From: click-request at pdos.csail.mit.edu <click-request at pdos.csail.mit.edu>
Subject: click Digest, Vol 62, Issue 11
To: click at pdos.csail.mit.edu
Date: Monday, 11 August, 2008, 6:11 AM

Send click mailing list submissions to
	click at amsterdam.lcs.mit.edu

To subscribe or unsubscribe via the World Wide Web, visit
	https://amsterdam.lcs.mit.edu/mailman/listinfo/click
or, via email, send a message with subject or body 'help' to
	click-request at amsterdam.lcs.mit.edu

You can reach the person managing the list at
	click-owner at amsterdam.lcs.mit.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of click digest..."


Today's Topics:

   1. Re: [click]SetIPChecksum (Eddie Kohler)
   2. Re: scheduling at microsecond resolution (Eddie Kohler)
   3. Re: [click] problem with Forwarding (Eddie Kohler)
   4. Re: scheduling at microsecond resolution (Ashish Sharma)
   5. [PATCH] Roofnet (1/3) (roberto.riggio at create-net.org)
   6. [PATCH] Roofnet (2/3) (Roberto Riggio)


----------------------------------------------------------------------

Message: 1
Date: Sun, 10 Aug 2008 09:14:39 -0700
From: Eddie Kohler <kohler at cs.ucla.edu>
Subject: Re: [Click] [click]SetIPChecksum
To: pradeep_addada at yahoo.co.in
Cc: click at pdos.csail.mit.edu
Message-ID: <489F13EF.8040701 at cs.ucla.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Your packet format has no direct support from Click (or any other device that 
understands TCP/IP -- unless you've changed the IP protocol number). 
I'd 
recommend

(1) using IP options if possible
(2) changing the IP protocol number and setting the transport header to your 
QoS header
(3) using set_network_header() to encompass both IP and "QoS"
headers.  Some 
Click elements that expect a normal IP header may get confused, but there's

little you can do about that.

Eddie


Pradeep Pradeep wrote:
> Hello,
> 
>   
> Thanks for the clue.
> I have one more question. This is the explanation given for
> set_network_header function.
> _________________________________
> 
> void set_network_header (const unsigned char *header,
> Method on Packet
>           unsigned len)
> 
> Sets the network header annotation to header, which must lie between
> buffer_data()
>      and buffer_data() + buffer_length(). The network header is len bytes
> long, so
>      network_header_length() will equal len and transport_header() will
> equal header
>      + len.
> ______________________________________
> 
> Does this statement mean that transport header annotation's place is
taken
> immediately after network header annotation.? If this is the case I have a
> problem. My packet format is
> 
> ---------------------------------------
> 
> {IP
>  Header}
> {QoS Header}
> {UDP Header}
> 
> -----------------------------------------
> 
>  How should I use the set_ip_header()/set_network_header() for my case.?
> 
> One way I could think is to give the 'len' parameter as
> 'sizeof(click_ip)+sizeof(qos_header) '. Do I have to change
> iph->ip_hl in
> this case.(I mean to ask does this 'len' parameter indicates the
length
> of
> the IP header OR placement of transport header relative to iph)
> 
> The Other way is to  bring in only the IP and UDP headers first, after
> calling the Packe::make and then call 'set_ip_header to set both IP
and UDP
> header annotations and then insert QoS header between the headers so that
> annotations will not change.
> 
>  Can you suggest which is a better way among these two and if possible any
> other better way?
> 
> Regards,
> Pradeep.
> 
> _______________________
> Previous
> From: Beyers Cronje <bcronje at gmail.com>
> Subject: Re:
>  [Click] [click]SetIPChecksum
> To: pradeep_addada at yahoo.co.in
> Cc: click at pdos.csail.mit.edu
> Date: Friday, 8 August, 2008, 6:47 PM
> 
>  Hi Pradeep,
> 
> p->ip_header() returns a pointer to the ip header of a packet, which is
> stored in the ip header annotation of Packet. The ip header annotation is
> set by elements such as MarkIPHeader and CheckIPHeader.
> 
> Packet::make() does not set this annotatio by itself, so you either have
to
> set it yourself by calling 'packet->set_ip_header(iph,
iph->ip_hl
> << 2)' or
> let a downstream element such as MarkIPHeader set it for you.
> 
> Beyers
> 
> On Fri, Aug 8, 2008 at 11:05 PM, Pradeep Pradeep
<pradeep_addada at yahoo.co.in
>> wrote:
> 
>> Hello,
>>
>>   In the code for the element SetIPChecksum element  there is part
which
>> tests if a packet is IP packet or not.
>>
>> It uses
>> ---------------------
>>
>  ip=p->ip_header();
>> if(!ip)
>>
>>   When can a situation arise which satisfies   !ip?
>> -------------------------
>>
>>  I am genarating  packets which have the following format
>> {IP Header}
>>  {QoS Data}
>> {UDP Header}
>>
>>
>> The code I used is
>> _______________________________
>>
>> void push(Packet* p)
>> {
>>
>>
>> WritablePacket *packet = Packet::make(0, 0, data_len+header_room, 0);
>>
>>   if (packet == 0) {
>>       click_chatter( "cannot make packet!");
>>       packet = NULL;
>>       return;
>>     }
>>
>>     // fill IP header
>>
>>    click_ip *iph = (click_ip*) packet->data();
>>     memcpy(iph, p->ip_header(), sizeof(click_ip));
>>     iph->ip_tos |= 0x0c;  // 12 for QoS
>>     iph->ip_tos |= 0x01;  // Set ECN capability
>>
>>     // fill QoS
>  fields
>>     QoSSignalFormat* format =
>>       (QoSSignalFormat*)(packet->data()+sizeof(click_ip));
>>
>>
>>     // fill UDP header
>>     click_udp *udph =
>>       (click_udp*)(packet->data()+sizeof(click_ip)+sizeof(struct
>> QoSSignalFormat));
>>     memcpy(udph, p->udp_header(), sizeof(click_udp));
>>
>>        p->kill(); // destroy data packet
>>     output(0).push((Packet *)packet);
>>   }
>>   _______________________________
>>
>> As you can see I am making some changes to IP header. So I want to
> recompue
>> the checksum by passing the packets through SetIPChecksum element.
When I
>> forward the these packets SetIPChecksum (which is slightly modified
that
> it
>> detects the condtion !ip ) the packets are being struck at this !ip
>> condtion. Please help me with this.
>>
>> Regards,
>>
>  Pradeep.
> 
> 
> 
> 
> 
> 
>       Unlimited freedom, unlimited storage. Get it now, on
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



------------------------------

Message: 2
Date: Sun, 10 Aug 2008 09:19:20 -0700
From: Eddie Kohler <kohler at cs.ucla.edu>
Subject: Re: [Click] scheduling at microsecond resolution
To: Ankit Kapoor <mcs072903 at cse.iitd.ac.in>
Cc: click at pdos.csail.mit.edu
Message-ID: <489F1508.7040806 at cs.ucla.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Ankit,

Click Timers are nominally schedulable with microsecond granularity.  Tasks 
run as frequently as the machine supports.  If you have a problem be more 
specific.

Eddie


Ankit Kapoor wrote:
> Hello all,
> 
> Is there a way to schedule the task ot timer of click at some tens of
> microseconds resolution? If anyone has idea please help
> 
> regards


------------------------------

Message: 3
Date: Sun, 10 Aug 2008 09:20:37 -0700
From: Eddie Kohler <kohler at cs.ucla.edu>
Subject: Re: [Click] [click] problem with Forwarding
To: pradeep_addada at yahoo.co.in
Cc: click at pdos.csail.mit.edu
Message-ID: <489F1555.2080100 at cs.ucla.edu>
Content-Type: text/plain; charset=UTF-8; format=flowed

Impossible to tell without actual configurations.

Eddie


Pradeep Pradeep wrote:
> Hello,
>    I am trying to generate a traffic and send it over a linear topology of
4 nodes. I used
> 
>  UDPIPEncap-To specify the addresses of source and destination manually
> EtherEncap- To specify the next hop therner headers explicitly.
> 
>  When I print the packet just before it goes to ToDevice element this way,
> out0::Queue->Print(2,42)->ToDevice
> all the header fields are being displayed properly but the packets are not
being forwared from source node to relay node.
> 
> I tried to print the packets in a similar way by running Iperf application
and the packets are being printed exactly in tye same way and/but forwared. I
don't understand why the packets are not being forwarded in the earlier
case.
> 
> Any help is greatly appreciated.
> 
> Thanks,
> Pradeep.
> 
> 
> 
>       Did you know? You can CHAT without downloading messenger. Go to
http://in.webmessenger.yahoo.com/
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


------------------------------

Message: 4
Date: Sun, 10 Aug 2008 16:08:14 -0700
From: "Ashish Sharma" <ashishs.sharma at gmail.com>
Subject: Re: [Click] scheduling at microsecond resolution
To: "Eddie Kohler" <kohler at cs.ucla.edu>
Cc: "click at pdos.csail.mit.edu" <click at pdos.csail.mit.edu>
Message-ID:
	<1476eb2e0808101608n4e3955a1lb354cfe900952249 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Eddie,

I am curious to know how timers are implemented in Click.  I scanned through

the source code I found no references of kernel timers or hrtimers. Instead
I found that in lib/master.cc Click  maintains its own heap for timers and
runs
Master::run_timers in routerthread.cc

Correct me if I am wrong, but this is what my guess is regarding whats going
on.
Every time click thread gets scheduled in the kernel, all the timers in the
heap
are checked and the timers are woken up after they expire. Now this is
dependent
on how frequently Click gets scheduled, which should work better if it is
installed
as a kernel module.

Can you please elaborate on the timer implementation, and how Click's
approach
compare to using hrtimers or regular kernel timers? I am working on  a TDMA
MAC that sends out packets on the network with sub ms precision.

Thanks
Ashish

On Sun, Aug 10, 2008 at 9:19 AM, Eddie Kohler <kohler at cs.ucla.edu> wrote:

> Ankit,
>
> Click Timers are nominally schedulable with microsecond granularity. 
Tasks
> run as frequently as the machine supports.  If you have a problem be more
> specific.
>
> Eddie
>
>
> Ankit Kapoor wrote:
> > Hello all,
> >
> > Is there a way to schedule the task ot timer of click at some tens of
> > microseconds resolution? If anyone has idea please help
> >
> > regards
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>


------------------------------

Message: 5
Date: Mon, 11 Aug 2008 12:08:24 +0200 (CEST)
From: roberto.riggio at create-net.org
Subject: [Click] [PATCH] Roofnet (1/3)
To: click at pdos.csail.mit.edu
Message-ID: <7812969.509241218449304953.JavaMail.root at aurora>
Content-Type: text/plain; charset=utf-8

I'm submitting 3 set of patches for roofnet. This one contains minor
changes and
fixes (the LinkTable element was never used in this element)

Signed-off-by: Roberto Riggio <roberto.riggio at create-net.org>

-- 

diff --git a/roofnet/sr2/sr2forwarder.cc b/roofnet/sr2/sr2forwarder.cc
index 07a6800..ac43b77 100644
--- a/roofnet/sr2/sr2forwarder.cc
+++ b/roofnet/sr2/sr2forwarder.cc
@@ -29,13 +29,14 @@
 #include "elements/ethernet/arptable.hh"
 CLICK_DECLS
 
+enum { H_STATS };

+
 SR2Forwarder::SR2Forwarder()
   :  _ip(),
      _eth(),
      _et(0),
      _datas(0), 
      _databytes(0),
-     _link_table(0),
      _arp_table(0)
 {
 }
@@ -53,8 +54,6 @@ SR2Forwarder::configure (Vector<String> &conf,
ErrorHandler *errh)
 			   "IP", 0, cpIPAddress, &_ip,
 			   "ETH", 0, cpEtherAddress, &_eth,
 			   "ARP", 0, cpElement, &_arp_table,
-			   /* below not required */
-			   "LT", 0, cpElement, &_link_table,
 			   cpEnd);
 	
 	if (!_et) 
@@ -69,9 +68,6 @@ SR2Forwarder::configure (Vector<String> &conf,
ErrorHandler *errh)
 	if (_arp_table->cast("ARPTable") == 0) 
 		return errh->error("ARPTable element is not a ARPTable");
 	
-	if (_link_table && _link_table->cast("LinkTable") == 0) 
-		return errh->error("LinkTable element is not a LinkTable");
-	
 	if (res < 0) {
 		return res;
 	}
@@ -84,21 +80,6 @@ SR2Forwarder::initialize (ErrorHandler *)
 	return 0;
 }
 
-bool
-SR2Forwarder::update_link(IPAddress from, IPAddress to, 
-			 uint32_t seq, uint32_t age, uint32_t metric) 
-{
-	if (_link_table && !_link_table->update_link(from, to, seq, age,
metric)) {
-		click_chatter("%{element} couldn't update link %s > %d >
%s\n",
-			      this,
-			      from.unparse().c_str(),
-			      metric,
-			      to.unparse().c_str());
-		return false;
-	}
-	return true;
-}
-
 Packet *
 SR2Forwarder::encap(Packet *p_in, Vector<IPAddress> r, int flags)
 {
@@ -111,8 +92,8 @@ SR2Forwarder::encap(Packet *p_in, Vector<IPAddress> r,
int flags)
 	WritablePacket *p = p_in->push(extra);
 	
 	assert(extra + payload_len == p_in->length());
-	
-	
+
+
 	int next = index_of(r, _ip) + 1;
 	if (next < 0 || next >= r.size()) {
 		click_chatter("SR2Forwarder %s: encap couldn't find %s (%d) in path
%s",
@@ -223,12 +204,19 @@ SR2Forwarder::push(int port, Packet *p_in)
 	
 }
 
-String
-SR2Forwarder::static_print_stats(Element *f, void *)
-{
-	SR2Forwarder *d = (SR2Forwarder *) f;
-	return d->print_stats();
-}
+void SR2Forwarder::add_handlers(){

+	add_read_handler("stats", read_handler, (void*)H_STATS);

+}

+

+String SR2Forwarder::read_handler(Element *e, void *thunk){

+	SR2Forwarder *c = (SR2Forwarder *)e;

+	switch ((intptr_t)thunk) {

+		case H_STATS:

+		return(c->print_stats());

+	default:

+		return "<error>\n";

+	}

+}

 
 String
 SR2Forwarder::print_stats()
@@ -236,11 +224,5 @@ SR2Forwarder::print_stats()
 	return String(_datas) + " datas sent\n" + String(_databytes) +
" bytes of data sent\n";
 }
 
-void
-SR2Forwarder::add_handlers()
-{
-	add_read_handler("stats", static_print_stats, 0);
-}
-
 CLICK_ENDDECLS
 EXPORT_ELEMENT(SR2Forwarder)
diff --git a/roofnet/sr2/sr2forwarder.hh b/roofnet/sr2/sr2forwarder.hh
index be2f344..b87e2bc 100644
--- a/roofnet/sr2/sr2forwarder.hh
+++ b/roofnet/sr2/sr2forwarder.hh
@@ -5,15 +5,15 @@
 #include <click/timer.hh>
 #include <click/ipaddress.hh>
 #include <click/etheraddress.hh>
-#include <elements/wifi/linktable.hh>
 #include <click/vector.hh>
 #include <elements/wifi/path.hh>
+#include <click/hashmap.hh>
 CLICK_DECLS
 
 /*
 =c
 
-SR2Forwarder(ETHERTYPE, IP, ETH, ARPTable element, LT LinkTable element
+SR2Forwarder(ETHERTYPE, IP, ETH, ARPTable element, 
     [ETT element], [METRIC GridGenericMetric] )
 
 =s Wifi, Wireless Routing
@@ -46,12 +46,7 @@ class SR2Forwarder : public Element {
 
   /* handler stuff */
   void add_handlers();
-
-  static String static_print_stats(Element *e, void *);
   String print_stats();
-  static String static_print_routes(Element *e, void *);
-  String print_routes();
-
   void push(int, Packet *);
   
   Packet *encap(Packet *, Vector<IPAddress>, int flags);
@@ -61,12 +56,10 @@ private:
   IPAddress _ip;    // My IP address.
   EtherAddress _eth; // My ethernet address.
   uint16_t _et;     // This protocol's ethertype
-//  uint32_t _et;     // This protocol's ethertype
   // Statistics for handlers.
   int _datas;
   int _databytes;
 
-  class LinkTable *_link_table;
   class ARPTable *_arp_table;
   
   class PathInfo {
@@ -80,9 +73,9 @@ private:
   };
   typedef HashMap<Path, PathInfo> PathTable;
   PathTable _paths;
-  
-  bool update_link(IPAddress from, IPAddress to, 
-		   uint32_t seq, uint32_t age, uint32_t metric);
+
+  static String read_handler(Element *, void *);
+
 };
 
 
diff --git a/roofnet/sr2/sr2querier.cc b/roofnet/sr2/sr2querier.cc
index 53a44b6..ef97018 100644
--- a/roofnet/sr2/sr2querier.cc
+++ b/roofnet/sr2/sr2querier.cc
@@ -21,7 +21,6 @@
 #include <click/confparse.hh>
 #include <click/error.hh>
 #include <click/glue.hh>
-#include "sr2linkmetric.hh"
 #include <click/straccum.hh>
 #include <clicknet/ether.h>
 #include "sr2packet.hh"
diff --git a/roofnet/sr2/sr2checkheader.cc b/roofnet/sr2/sr2checkheader.cc
index 36122aa..0793714 100644
--- a/roofnet/sr2/sr2checkheader.cc
+++ b/roofnet/sr2/sr2checkheader.cc
@@ -74,18 +74,13 @@ SR2CheckHeader::simple_action(Packet *p)
   }
 
   if (pk->_version != _sr2_version) {
-    static bool version_warning = false;
 
     _bad_table.insert(EtherAddress(eh->ether_shost), pk->_version);
 
-    if (!version_warning) {
-      version_warning = true;
-      click_chatter ("%s: unknown sr version %x from %s", 
+    click_chatter ("%s: unknown sr version %x from %s", 
 		     name().c_str(), 
 		     pk->_version,
 		     EtherAddress(eh->ether_shost).unparse().c_str());
-    }
-
      
      goto bad;
   }


------------------------------

Message: 6
Date: Mon, 11 Aug 2008 12:09:51 +0200 (CEST)
From: Roberto Riggio <roberto.riggio at create-net.org>
Subject: [Click] [PATCH] Roofnet (2/3)
To: click at pdos.csail.mit.edu
Message-ID: <14582358.509271218449391405.JavaMail.root at aurora>
Content-Type: text/plain; charset=utf-8

This patch fixes a warning and a problem with the scheduler that happens 
when the date is moved forward.

Signed-off-by: Roberto Riggio <roberto.riggio at create-net.org>

-- 

diff --git a/roofnet/sr2/sr2ettstat.cc b/roofnet/sr2/sr2ettstat.cc
index 9f182d5..3d9d293 100644
--- a/roofnet/sr2/sr2ettstat.cc
+++ b/roofnet/sr2/sr2ettstat.cc
@@ -21,6 +21,7 @@
 #include <click/glue.hh>
 #include <click/timer.hh>
 #include <click/straccum.hh>
+#include <click/packet_anno.hh>
 #include "sr2ettstat.hh"
 #include "sr2ettmetric.hh"
 #include "sr2txcountmetric.hh"
@@ -212,9 +213,11 @@ SR2ETTStat::run_timer(Timer *)
 	
 	send_probe();
 	
-	_next += Timestamp::make_msec(p);
-	sr2_add_jitter(max_jitter, &_next);
-	_timer.schedule_at(_next);
+	Timestamp delay = Timestamp::make_msec(p);
+	sr2_add_jitter(max_jitter, &delay);
+	_timer.reschedule_after(delay);
+
+	_next = _timer.expiry();
 }
 
 void
@@ -400,7 +403,7 @@ SR2ETTStat::send_probe()
   lp->_cksum = click_in_cksum((unsigned char *) lp, ntohs(lp->_psz));
   
 
-  struct click_wifi_extra *ceh = (struct click_wifi_extra *)
p->user_anno();
+  click_wifi_extra *ceh = WIFI_EXTRA_ANNO(p);
   ceh->magic = WIFI_EXTRA_MAGIC;
   ceh->rate = rate;
   checked_output_push(0, p);
@@ -490,7 +493,7 @@ SR2ETTStat::simple_action(Packet *p)
     _arp_table->insert(ip, EtherAddress(eh->ether_shost));
     _rev_arp.insert(EtherAddress(eh->ether_shost), ip);
   }
-  struct click_wifi_extra *ceh = (struct click_wifi_extra *)
p->user_anno();
+  click_wifi_extra *ceh = WIFI_EXTRA_ANNO(p);
   uint16_t rate = ceh->rate;
 
   if (ceh->rate != ntohs(lp->_rate)) {


------------------------------

_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click


End of click Digest, Vol 62, Issue 11
*************************************



      Did you know? You can CHAT without downloading messenger. Go to http://in.webmessenger.yahoo.com/


More information about the click mailing list