[Click] File operations in Click

Roman Chertov rchertov at purdue.edu
Wed Jul 16 23:23:22 EDT 2008


Jelena,

If the size of list is not too long, you can just pass it in the config 
file to your element.  You can also make a script to print out a new 
config per set of IP/delays.

Roman
P.S. I am now in the same state as you :)

Jelena Mirkovic wrote:
> Well, Script element is not quite what I want. I want to read a set of 
> IPs and delays like this:
>     1.1.1.1 200
>     2.2.2.2 300
> then remember them in the kernel module. When a packet comes from 
> 1.1.1.1 I want to impose 200 ms delay, and for 2.2.2.2 source 300 ms 
> delay. So I'm afraid some file reading is necessary and I cannot use 
> variables from Script.  Or am I missing some other Script functionality 
> that may be useful?
> 
> Thanks
> -------------------------------------
> Jelena Mirkovic
> Computer Scientist
> USC Information Sciences Institute
> 4676 Admiralty Way, Suite 1001
> Marina del Rey, CA 90292
> 310-448-9170
> 
> 
> On Jul 16, 2008, at 7:03 PM, Roman Chertov wrote:
> 
>> Jelena Mirkovic wrote:
>>> I've been trying to write a kernel module in Click that reads 
>>> address  info from a file, then manipulates (drops or forwards) 
>>> packets for  the specified addresses. I've had problems with using 
>>> fopen -  basically click-install informs me that fopen is unknown 
>>> symbol even  though I've included stdio.h in my file. I seem to 
>>> remember Linux  kernel has a problem manipulating files. Is there an 
>>> easy way to open
>>
>> It is disallowed to use system calls inside the kernel.  It is 
>> possible to still use them with some trickery but is best not to do so.
>>
>> Take a look at the Script element; it might be what you are looking for.
>>
>> Roman
>>
>>> and read a file from a Click kernel module?
>>> Thanks
>>> -------------------------------------
>>> Jelena Mirkovic
>>> Computer Scientist
>>> USC Information Sciences Institute
>>> 4676 Admiralty Way, Suite 1001
>>> Marina del Rey, CA 90292
>>> 310-448-9170
>>> _______________________________________________
>>> click mailing list
>>> click at amsterdam.lcs.mit.edu
>>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 
> 


More information about the click mailing list