Prem Gopalan: Re: Click Dynamic loading

Eddie Kohler eddietwo at cag.lcs.mit.edu
Fri Apr 21 09:30:31 EDT 2000


------- Forwarded Message

Received: from herald.cc.purdue.edu (herald.cc.purdue.edu [128.210.11.29])
	by amsterdam.lcs.mit.edu (8.8.7/8.8.7) with ESMTP id WAA17082
	for <eddietwo at naugabutt.lcs.mit.edu>; Thu, 20 Apr 2000 22:38:56 -0400 (EDT)
Received: from localhost by herald.cc.purdue.edu with ESMTP; Thu, 20 Apr 2000 21:38:54 -0500
Date: Thu, 20 Apr 2000 21:38:54 -0500 (EST)
From: Prem Gopalan <gopalan at purdue.edu>
X-Sender: gopalan at herald.cc.purdue.edu
To: Eddie Kohler <eddietwo at naugabutt.lcs.mit.edu>
Subject: Re: Click Dynamic loading  
In-Reply-To: <200004201304.JAA08612 at naugabutt.lcs.mit.edu>
Message-Id: <Pine.SOL.4.10.10004202131460.13-100000 at herald.cc.purdue.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

hi Eddie:
	Thanks for your prompt reply on dynamic loading of modules in
Click. We just tried it out and it works fine the first time; but when
click is already loaded as kernel module and is running as router, it says
the device is busy and the configuration cannot be loaded. We thought that
it should be possible for click-install to rmmod click and remove it..but
that doesnt happen. Why ?

Also, we are trying to build a dynamic loader that automatically downloads
modules from remote servers if they do not exist on the same server. So we
are interested in knowing if the click configuration is ripped apart each
time we do click-install with a different archive made with the same
configuration file but with a different (downloaded) module. Or does it
just install the package/module and leaves the config in
/proc/click/config intact ? 

In case, it does change the configuration file on the fly, what happens to
packets "trapped" in elements/queues as per the old configuration.

Do let us know if our line of thinking is on the right track. Thanks a
million for all your help.

Prem.




On Thu, 20 Apr 2000, Eddie Kohler wrote:

> BENJIE!
> 
> They are creating their own archive. so they want to know how the
> downloadable package stuff works in general.
> 
> The way to include dynamically loadable packages is to use 'ar'.
> 
> If you have a Click configuration in 'FILE.click', the steps are something
> like this. I'll write it down as if you were doing it by hand. This all
> assumes that you are using the Linux kernel module. If you are using the
> 'click' user-level program, write back. Some things are different.
> 
> (1) Check to see if 'FILE.click' is an ar(1) archive. ar(1) archives begin
> with the magic string "!<arch>\n".
> 
> If it is NOT an archive, turn it into an archive in the following way:
> 
>    % mv FILE.click /tmp/config
>    % ar cr FILE.click /tmp/config
> 
> (2) Add `myclass.cc' to the archive. Also add 'myclass.hh' if you have that
> 
>    % ar r FILE.click myclass.cc [myclass.hh]
> 
> NOTE: You do not need to add the .o file. click-install will compile it
> from the source automatically.
> 
> (3) Extract the configuration and add a _requirement_. This will force
> click-install to download myclass.o.
> 
>    % echo 'require(myclass)' > /tmp/config
>    % ar p FILE.click config >> /tmp/config
>    % ar r FILE.click /tmp/config
> 
> (4) You are now done and can run 'click-install FILE.click'.
> 
> HOWEVER!!!!!!!!!!!!!!!
> 
> The myclass.cc file needs to follow some guidelines to work efffectively as
> a downloadable module. It must have init_module and cleanup_module
> functions. It must call click_provide and click_unprovide (in init_module
> and cleanup_module, respectively) to inform the main Click module when it
> is loaded and unloaded. Finally, if your module contains new element types,
> you need to write code that informs the Click module that the new element
> types exist, and that removes the element types when the module is
> unloaded. This sounds like a lot but it is not that hard. I advise you to
> create a very simple configuration containing one Classifier element. Then
> run that configuration through 'click-fastclassifier' and look at its
> output. The output will be an archive including source code; the source
> code demonstrates what you need to do.
> 
> Please write back if this is confusing.
> love,
> ed
> 
> 



Prem Gopalan
Home phone: 1-765-746-1896



------- End of Forwarded Message




More information about the click mailing list