[Click] click Digest, Vol 92, Issue 25

Cliff Frey cliff at meraki.com
Tue Feb 22 13:01:33 EST 2011


2011/2/21 Justok Jiang|蒋小可 <justok06 at gmail.com>

> Dear all,
> I am sure If I could send email to this mailling-list when I have some
> Questions about Click.
> If It's not appropriate, Please skip this email; but I would be thanksful
> if some do me some favor to answer.
>
> Q. 1/
> FromDevice(eth1)->
> c::Classifier(12/0806 20/0001,
>             12/0806 20/0002,
>             12/0800,
>             -);
>
> I would find that all the packet are sent to c[3]
>

Is eth1 a normal ethernet device?  Perhaps you should add a Print() element
which will show you the actual binary data inside of each packet, and you
can see what bytes are at offset 12?


>
>
> FromDevice(eth1)->Strip(14)->cip::CheckIPHeader->IPClassifier->IPPrint(ip)->Discard;
> cip[1]->Discard;
>
>
> I would find that some IP packet also output warning msg "cip: IP header
> check failed: bad IP version "
>

This is expected, because you might be sending non-IP packets to a
CheckIPHeader.


> Q. 2/
> My Project is flexable, so I want to use some configure files, which store
> host name, host interface and their ip.
> So how can I use that configure file?
>

There is no one-size-fits-all answer for this.  You can pass in variables on
the command line.  You can use cpp or some other pre processor on your
config files.  You can come up with another solution...


>
> Q. 3/
> About script,
>   s :: Script(set x 0,
>               label begin_loop,
>               print $x,
>               set x $(s.add $x 1),
>               goto begin_loop $(s.lt $x 5),
>               );
> this code runs well and output "0 1 2 3 4", but
>   s :: Script(set x 0,
>               label begin_loop,
>               print $x,
>               set x $(s.add $x 1),
>               goto begin_loop $(s.lt $x 5),
>               );
> InfiniteSource(DATA \<00 00 c0 ae 67 ef  00 00 00 00 00 00  08 00
> 45 00 00 28  00 00 00 00  40 11 77 c3  01 00 00 01
> 02 00 00 02  13 69 13 69  00 14 d6 41  55 44 50 20
> 70 61 63 6b  65 74 21 0a>, LIMIT 10, *STOP true*)
>    -> Strip(14)
>    -> Align(4, 0)    // in case we're not on x86
>    -> cih::CheckIPHeader()
>    ->IPPrint(ip)
>    ->c::Counter
>    ->Discard;
> those code runs well, but the output have no "0 1 2 3 4"
>

The "STOP true" parameter on your InfiniteSource element will stop the
entire router as soon as the source has generated 10 packets.


More information about the click mailing list