From momina.azam at gmail.com Mon Jul 22 07:41:17 2013 From: momina.azam at gmail.com (Momina Khan) Date: Mon, 22 Jul 2013 16:41:17 +0500 Subject: [Click] IPFilter: need to classify packets according to value of certain bits of a field Message-ID: Hi all i have been going through the IPFilter code for some time now ... i have to filter packets based on the value of the 6 high end unused bits of the TOS field in the IP header. have set _mask.u to 252 ... as per my understanding the value of the field to be checked is applied this mask before value checking The problem is that the config parameter to be compared with _u.u leaves a gap between the greater than and less ( >110 and < 110) than value provided after the bit shift and in this gap of values the router neither labels packets as greater than nor less than. referring to the set_mask() routine. What routine actually does the comparison and filtering? is there detailed documentation of IPFilter code? from .click file ip_classifier :: IPClassifier(tcp and ip tos > 110,tcp and ip tos < 110/*protocol == tcp and TOS < 110*/,- /*everything else */ ); regards momina From ekohler at gmail.com Mon Jul 22 09:28:41 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Mon, 22 Jul 2013 09:28:41 -0400 Subject: [Click] IPFilter: need to classify packets according to value of certain bits of a field In-Reply-To: References: Message-ID: Momina, aren't those bits the same as the formerly-defined DSCP (Differentiated Services Code Point)? Can't you just say "tcp and ip dscp = 10" or whatever? I don't understand your problem; if you provided a specific Click configuration, perhaps using FromIPSummaryDump in the style of the tests, showing what you expect to happen, that would help. (Of course there's a gap between ip tos > 110 and ip tos < 110, namely ip tos == 110, but of course you know this.) Eddie On Mon, Jul 22, 2013 at 7:41 AM, Momina Khan wrote: > Hi all i have been going through the IPFilter code for some time now ... i > have to filter packets based on the value of the 6 high end unused bits of > the TOS field in the IP header. > > have set _mask.u to 252 ... as per my understanding the value of the field > to be checked is applied this mask before value checking > The problem is that the config parameter to be compared with _u.u leaves a > gap between the greater than and less ( >110 and < 110) than value provided > after the bit shift and in this gap of values the router neither labels > packets as greater than nor less than. referring to the set_mask() routine. > What routine actually does the comparison and filtering? is there detailed > documentation of IPFilter code? > > from .click file > ip_classifier :: IPClassifier(tcp and ip tos > 110,tcp and ip tos < > 110/*protocol == tcp and TOS < 110*/,- /*everything else */ ); > > regards > momina > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click From momina.azam at gmail.com Mon Jul 22 15:30:57 2013 From: momina.azam at gmail.com (Momina Khan) Date: Tue, 23 Jul 2013 00:30:57 +0500 Subject: [Click] IPFilter: need to classify packets according to value of certain bits of a field In-Reply-To: References: Message-ID: Thank you Eddie this just solves the issue! I concede my ignorance i was unaware of the dscp and ECN devision of the TOS field. So what i was wanting to do was to use the higher order 6 bits for transferring a value in the IP header and i did a bit shift by two bits so as to leave the ECN bits unchanged in the header. The bit shift widened the gap between < and > values. (Ofcourse = was also not catered for :)) thanks again! momina On Mon, Jul 22, 2013 at 6:28 PM, Eddie Kohler wrote: > Momina, aren't those bits the same as the formerly-defined DSCP > (Differentiated Services Code Point)? Can't you just say > "tcp and ip dscp = 10" or whatever? I don't understand your problem; > if you provided a specific Click configuration, perhaps using > FromIPSummaryDump in the style of the tests, showing what you expect > to happen, that would help. (Of course there's a gap between ip tos > > 110 and ip tos < 110, namely ip tos == 110, but of course you know > this.) > > Eddie > > > On Mon, Jul 22, 2013 at 7:41 AM, Momina Khan > wrote: > > Hi all i have been going through the IPFilter code for some time now ... > i > > have to filter packets based on the value of the 6 high end unused bits > of > > the TOS field in the IP header. > > > > have set _mask.u to 252 ... as per my understanding the value of the > field > > to be checked is applied this mask before value checking > > The problem is that the config parameter to be compared with _u.u > leaves a > > gap between the greater than and less ( >110 and < 110) than value > provided > > after the bit shift and in this gap of values the router neither labels > > packets as greater than nor less than. referring to the set_mask() > routine. > > What routine actually does the comparison and filtering? is there > detailed > > documentation of IPFilter code? > > > > from .click file > > ip_classifier :: IPClassifier(tcp and ip tos > 110,tcp and ip tos < > > 110/*protocol == tcp and TOS < 110*/,- /*everything else */ ); > > > > regards > > momina > > _______________________________________________ > > click mailing list > > click at amsterdam.lcs.mit.edu > > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > From boka at hawaii.edu Mon Jul 22 22:57:30 2013 From: boka at hawaii.edu (Bronson Oka) Date: Mon, 22 Jul 2013 16:57:30 -1000 Subject: [Click] Fwd: Timestamp and Timers Questions In-Reply-To: References: Message-ID: Hello, I was just wondering if you could answer a few questions about the implementation of the Click Router. I'm trying to implement a protocol Element. The implementation is for testing and verification of the protocol, so precision and speed are a factor. I've been looking at the Click source code for the past few weeks trying to figure out how precise the Timers and Timestamp are. Form what I understand, all the Elements that depend on system time rely on the Timestamp Element. The timestamp.hh header file has a definition for different inline assign() functions, but there are many #if statements that control which macros get defined and I'm not sure how to tell which ones are actually being used when compiling the code. Is there a simple way to tell which #if statements are invoked? This would make it much easier to focus on specific parts of the code. I would also like to ask how the Timestamp gets the system time. I saw that the assign_now() inline function calls current_kernel_time(), but I wasn't able to trace this call back to its origin. When running on Linux, does the Click Router use system calls to get the time (such as POSIX)? I would also greatly appreciate it if you can offer any extra tips for understanding the Timestamp implementation. Thanks for your help. From clfrey at cisco.com Mon Jul 22 23:56:59 2013 From: clfrey at cisco.com (Cliff Frey) Date: Mon, 22 Jul 2013 20:56:59 -0700 Subject: [Click] Fwd: Timestamp and Timers Questions In-Reply-To: References: Message-ID: I find the easiest way to trace through lots of #if code is to add #error statements in each branch, and see which ones are hit when compiling. When running userlevel-linux click, timestamp uses either the clock_gettime or gettimeofday library functions to get the current time. Cliff On Mon, Jul 22, 2013 at 7:57 PM, Bronson Oka wrote: > Hello, > > I was just wondering if you could answer a few questions about the > implementation of the Click Router. > > I'm trying to implement a protocol Element. The implementation is for > testing and verification of the protocol, so precision and speed are a > factor. I've been looking at the Click source code for the past few weeks > trying to figure out how precise the Timers and Timestamp are. > > Form what I understand, all the Elements that depend on system time rely on > the Timestamp Element. The timestamp.hh header file has a definition for > different inline assign() functions, but there are many #if statements that > control which macros get defined and I'm not sure how to tell which ones > are actually being used when compiling the code. > > Is there a simple way to tell which #if statements are invoked? > This would make it much easier to focus on specific parts of the code. > > I would also like to ask how the Timestamp gets the system time. I saw > that the assign_now() inline function calls current_kernel_time(), but I > wasn't able to trace this call back to its origin. > > When running on Linux, does the Click Router use system calls to get the > time (such as POSIX)? > > I would also greatly appreciate it if you can offer any extra tips for > understanding the Timestamp implementation. > > Thanks for your help. > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > From jopen at informatik.uni-bonn.de Tue Jul 30 09:43:48 2013 From: jopen at informatik.uni-bonn.de (Sascha Alexander Jopen) Date: Tue, 30 Jul 2013 15:43:48 +0200 Subject: [Click] Packet alignment Message-ID: <51F7C314.5030607@informatik.uni-bonn.de> Hey, I have a question regarding the click packet data alignment. I have an element which generates packets with 46 bytes of headroom followed by some data. The whole packet gets aligned in memory, but data() points to a memory section which is 2 bytes off the alignment on a 32bit machine. This packet will eventually be pushed into an UDPIPEncap element. On some architectures (where HAVE_INDIFFERENT_ALIGNMENT is not defined) a 4-byte alignment is expected (see line 94 udpipencap.cc). However, click-align does not insert an Align element on those architectures. If i do this manually, everything is fine. How can i make click-align insert the Align element? Thanks in advance, Sascha -- Dipl.-Inform. Sascha Jopen University of Bonn Tel.: +49-228-73-54219 Institute of Computer Science 4 Fax: +49-228-73-4571 Friedrich-Ebert-Allee 144 E-mail: jopen at cs.uni-bonn.de D-53113 Bonn, Germany From clfrey at cisco.com Wed Jul 31 12:41:37 2013 From: clfrey at cisco.com (Cliff Frey) Date: Wed, 31 Jul 2013 09:41:37 -0700 Subject: [Click] Packet alignment In-Reply-To: <51F7C314.5030607@informatik.uni-bonn.de> References: <51F7C314.5030607@informatik.uni-bonn.de> Message-ID: You need to add your custom element to the "class_factory" function of tools/click-align/click-align.cc to indicate the alignment of the packets generated by your element. Then click-align will add the necessary Align elements for you. Cliff On Tue, Jul 30, 2013 at 6:43 AM, Sascha Alexander Jopen < jopen at informatik.uni-bonn.de> wrote: > Hey, > > I have a question regarding the click packet data alignment. > > I have an element which generates packets with 46 bytes of headroom > followed by some data. The whole packet gets aligned in memory, but > data() points to a memory section which is 2 bytes off the alignment on > a 32bit machine. This packet will eventually be pushed into an > UDPIPEncap element. On some architectures (where > HAVE_INDIFFERENT_ALIGNMENT is not defined) a 4-byte alignment is > expected (see line 94 udpipencap.cc). However, click-align does not > insert an Align element on those architectures. If i do this manually, > everything is fine. How can i make click-align insert the Align element? > > Thanks in advance, > Sascha > > -- > Dipl.-Inform. Sascha Jopen > > University of Bonn Tel.: +49-228-73-54219 > Institute of Computer Science 4 Fax: +49-228-73-4571 > Friedrich-Ebert-Allee 144 E-mail: jopen at cs.uni-bonn.de > D-53113 Bonn, Germany > _______________________________________________ > click mailing list > click at amsterdam.lcs.mit.edu > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > From ekohler at gmail.com Wed Jul 31 14:05:22 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Wed, 31 Jul 2013 14:05:22 -0400 Subject: [Click] Packet alignment In-Reply-To: References: <51F7C314.5030607@informatik.uni-bonn.de> Message-ID: (Not sure but:) Basically, if Click sees an element it doesn't understand, it assumes the element either doesn't generate packets, or that it generates packets with correct alignment requirements. Probably it would be better to default to "arbitrary alignment" rather than "correct alignment," but that might be difficult. Eddie On Wed, Jul 31, 2013 at 12:41 PM, Cliff Frey wrote: > You need to add your custom element to the "class_factory" function of > tools/click-align/click-align.cc to indicate the alignment of the packets > generated by your element. Then click-align will add the necessary Align > elements for you. > > Cliff > > > On Tue, Jul 30, 2013 at 6:43 AM, Sascha Alexander Jopen < > jopen at informatik.uni-bonn.de> wrote: > >> Hey, >> >> I have a question regarding the click packet data alignment. >> >> I have an element which generates packets with 46 bytes of headroom >> followed by some data. The whole packet gets aligned in memory, but >> data() points to a memory section which is 2 bytes off the alignment on >> a 32bit machine. This packet will eventually be pushed into an >> UDPIPEncap element. On some architectures (where >> HAVE_INDIFFERENT_ALIGNMENT is not defined) a 4-byte alignment is >> expected (see line 94 udpipencap.cc). However, click-align does not >> insert an Align element on those architectures. If i do this manually, >> everything is fine. How can i make click-align insert the Align element? >> >> Thanks in advance, >> Sascha >> >> -- >> Dipl.-Inform. Sascha Jopen >> >> University of Bonn Tel.: +49-228-73-54219 >> Institute of Computer Science 4 Fax: +49-228-73-4571 >> Friedrich-Ebert-Allee 144 E-mail: jopen at cs.uni-bonn.de >> D-53113 Bonn, Germany >> _______________________________________________ >> 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 From ekohler at gmail.com Wed Jul 31 14:05:58 2013 From: ekohler at gmail.com (Eddie Kohler) Date: Wed, 31 Jul 2013 14:05:58 -0400 Subject: [Click] Packet alignment In-Reply-To: References: <51F7C314.5030607@informatik.uni-bonn.de> Message-ID: Another solution is of course to generate the correct amount of headroom (say 48B) so that UDPIPEncap is naturally aligned! On Wed, Jul 31, 2013 at 2:05 PM, Eddie Kohler wrote: > (Not sure but:) Basically, if Click sees an element it doesn't > understand, it assumes the element either doesn't generate packets, or > that it generates packets with correct alignment requirements. > > Probably it would be better to default to "arbitrary alignment" rather > than "correct alignment," but that might be difficult. > > Eddie > > > On Wed, Jul 31, 2013 at 12:41 PM, Cliff Frey wrote: >> You need to add your custom element to the "class_factory" function of >> tools/click-align/click-align.cc to indicate the alignment of the packets >> generated by your element. Then click-align will add the necessary Align >> elements for you. >> >> Cliff >> >> >> On Tue, Jul 30, 2013 at 6:43 AM, Sascha Alexander Jopen < >> jopen at informatik.uni-bonn.de> wrote: >> >>> Hey, >>> >>> I have a question regarding the click packet data alignment. >>> >>> I have an element which generates packets with 46 bytes of headroom >>> followed by some data. The whole packet gets aligned in memory, but >>> data() points to a memory section which is 2 bytes off the alignment on >>> a 32bit machine. This packet will eventually be pushed into an >>> UDPIPEncap element. On some architectures (where >>> HAVE_INDIFFERENT_ALIGNMENT is not defined) a 4-byte alignment is >>> expected (see line 94 udpipencap.cc). However, click-align does not >>> insert an Align element on those architectures. If i do this manually, >>> everything is fine. How can i make click-align insert the Align element? >>> >>> Thanks in advance, >>> Sascha >>> >>> -- >>> Dipl.-Inform. Sascha Jopen >>> >>> University of Bonn Tel.: +49-228-73-54219 >>> Institute of Computer Science 4 Fax: +49-228-73-4571 >>> Friedrich-Ebert-Allee 144 E-mail: jopen at cs.uni-bonn.de >>> D-53113 Bonn, Germany >>> _______________________________________________ >>> 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