[Click] patchless click patches

Sascha Alexander Jopen jopen at informatik.uni-bonn.de
Tue Nov 23 17:42:51 EST 2010


Hey,

i managed to test click patchless with a more complex click script and
everything runs fine. Additionally i implemented the missing
functionality to set the fake devices ip address on more recent kernels.
I tested the code on 2.6.35 and 2.6.32 kernels.

Please find attached the required patch to set the ip address. It
applies on top of all patches submitted by Joonwoo, including the patch
to set the mac address. Maybe the patch needs some cleanup and testing
for older kernels.

Regards,
Sascha

On 11/17/2010 08:12 AM, Joonwoo Park wrote:
> This is cool. Thanks so much Cliff.
> 
> Interesting.. I'm almost using the same environment with yours but was
> not able to reproduce oops by reconfiguring config.
> I ran this on ubuntu 9.10 + linux 2.6.35 inside kvm virtual machine.
> On the top of your today's branch, I also applied the patch that I
> posted to set mac address for IP type but it shouldn't be difference I
> think.
> 
> If you have chance, please let me see call back trace I'll have a look.
> 
> Joonwoo.
> 
> On Tue, Nov 16, 2010 at 10:23 PM, Cliff Frey <cliff at meraki.com> wrote:
>> I'm not sure at all what the current best-guess set of patches is to make
>> patchless fully work.  I cobbled together enough patches from the list and
>> did very very basic testing on my machine, and came up with this branch
>>
>> https://github.com/clifffrey/click/tree/working-fromhost-fixincludes
>>
>> It roughly works for me on first, but it crashed when I reconfigured it.
>>  I'm running ubuntu 10.10, with 2.6.35-22-generic.  It is running inside of
>> a qemu virtual machine.
>>
>> Perhaps I will spend more time debugging, not sure if I'll have time soon or
>> not.  I will keep the branch up to date with anything that I fix though.
>>
>> Cliff
>>
>> On Tue, Nov 16, 2010 at 5:29 PM, Sascha Alexander Jopen <
>> jopen at informatik.uni-bonn.de> wrote:
>>
>>> Hey,
>>>
>>> today i tried FromHost with your patch applied. The ethernet address is
>>> now set as expected. I could not yet test the element because of
>>> possible errors in my click script. I will check this tomorrow.
>>>
>>> I tried to fix the problem with not being able to set the ip address as
>>> well. Since devinet_ioctl seems no longer available in recent kernels, i
>>> tried to use inet_ioctl instead, which passes through to devinet_ioctl
>>> for certain commands. inet_ioctl expects a struct socket as an argument
>>> however, which i do not know how to create and bind to the correct
>>> interface. I tried to fill in only the struct sock *sk part, obtained
>>> through inet_ctl_sock_create, as the socket itself should never be used
>>> by inet_ioctl. The machine crashed with a kernel panic on testing.
>>>
>>> Further investigation will follow. As i'm new to kernel level
>>> programming, figuring out the problem may take some time, however.
>>>
>>> Sascha
>>>
>>>
>>> Am 15.11.2010 22:50, schrieb Joonwoo Park:
>>>> CC'ing Eddie.
>>>>
>>>> On Sun, Nov 14, 2010 at 2:32 PM, Joonwoo Park <joonwpark81 at gmail.com>
>>> wrote:
>>>>> Hi,
>>>>>
>>>>> Thanks for testing.  Can you try this patch once again?
>>>>> It seems to me linuxmodule FromHost never allowed to set ethernet
>>>>> address by it's argument if type is IP.
>>>>> It has been clearing ethernet address with 0 always after parsing
>>> argument.
>>>>>
>>>>> Eddie,
>>>>> Would you mind to shed on me why FromHost is doing that?
>>>>>
>>>>> Thanks,
>>>>> Joonwoo
>>>>>
>>>>> ---
>>>>> diff --git a/elements/linuxmodule/fromhost.cc
>>> b/elements/linuxmodule/fromhost.cc
>>>>> index 8b76672..6bde049 100644
>>>>> --- a/elements/linuxmodule/fromhost.cc
>>>>> +++ b/elements/linuxmodule/fromhost.cc
>>>>> @@ -205,9 +205,7 @@ FromHost::configure(Vector<String> &conf,
>>>>> ErrorHandler *errh)
>>>>>     }
>>>>>
>>>>>     // set type
>>>>> -    if (type == "IP")
>>>>> -       _macaddr = EtherAddress();
>>>>> -    else if (type != "ETHER" && type != "")
>>>>> +    if (type != "ETHER" && type != "IP")
>>>>>        return errh->error("bad TYPE");
>>>>>
>>>>>     // set up queue
>>>>> ---
>>>>>
>>>>> On Sun, Nov 14, 2010 at 2:37 AM, Sascha Alexander Jopen
>>>>> <jopen at informatik.uni-bonn.de> wrote:
>>>>>> Hey,
>>>>>>
>>>>>> thank you for the patch, Joonwoo.
>>>>>> Now i can start the click instance without further crashes.
>>>>>> I have problems setting the encap type and mac address of the fake
>>>>>> device, though. Although i specified a mac address in the click script,
>>>>>> the encap type of the tun/tap interface is UNSPEC with no mac address
>>> set.
>>>>>> Is it possible to set these parameters manually after the click kernel
>>>>>> module is installed? Will click detect those changes?
>>>>>> Not being able to set the fake interfaces ip address shouldn'z be that
>>>>>> much of a problem, i think. Is this due to missing ioctl's in newer
>>>>>> kernels or what is the problem here?
>>>>>>
>>>>>> Thanks,
>>>>>> Sascha
>>>>>>
>>>>>> Am 14.11.2010 07:34, schrieb Joonwoo Park:
>>>>>>> Hello,
>>>>>>>
>>>>>>> Can you please try attached patch to see if it works for you?
>>>>>>> You have to revert patch 07/12 if you applied already to apply
>>> attached patch.
>>>>>>>
>>>>>>> p.s I couldn't find a nice way to set ip address from kernel module
>>>>>>> without patching kernel therefore you have to set ip address of your
>>>>>>> device after configuring FromHost. (You won't be able to set it by
>>>>>>> FromHost argument)
>>>>>>> Setting ethernet address by FromHost argument should be still working.
>>>>>>>
>>>>>>> Joonwoo.
>>>>>>>
>>>>>>> On Tue, Nov 9, 2010 at 9:25 PM, Joonwoo Park <joonwpark81 at gmail.com>
>>> wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Thanks for call trace and simplified config.
>>>>>>>> I should have allocated netdev_ops and assign it to dev->netdev_ops.
>>>>>>>> It seem to me dev->netdev_ops is NULL.
>>>>>>>> My bad.  I'll fix and submit new patch as soon as I have chance.
>>>>>>>>
>>>>>>>> Joonwoo
>>>>>>>>
>>>>>>>> On Tue, Nov 9, 2010 at 3:30 PM, Sascha Alexander Jopen
>>>>>>>> <jopen at informatik.uni-bonn.de> wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> i finally removed the mentioned 'false' requirement and the element
>>> was
>>>>>>>>> compiled and integrated into the kernel module. When installing the
>>>>>>>>> module with a click script using click-install, the module crashes
>>> with
>>>>>>>>> a null pointer dereference, however. I didn't have the time to do
>>>>>>>>> further tests with simpler click scripts. I will check this within
>>> the
>>>>>>>>> next days.
>>>>>>>>> Attached you will find the kernel call trace for this null pointer
>>>>>>>>> dereference. The corresponding click part:
>>>>>>>>>
>>>>>>>>> AddressInfo(localDevice DEVNAME:ip/24 DEVNAME:eth);
>>>>>>>>> FromHost(fake0, localDevice:ipnet, ETHER localDevice:eth, TYPE IP)
>>> -> ...
>>>>>>>>>
>>>>>>>>> DEVNAME will be replaced by an existing network device.
>>>>>>>>> Maybe this is sufficient for someone to detect the problem.
>>>>>>>>>
>>>>>>>>> Sascha
>>>>>>>>>
>>>>>>>>> Am 09.11.2010 22:27, schrieb Sascha Alexander Jopen:
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> the FromHost element simply does not exist after compiling. ToHost,
>>>>>>>>>> ToHostSniffers and ToDevice, as well as FromDevice, are compiled,
>>>>>>>>>> FromHost not.
>>>>>>>>>> When feeding a click script to click-install the following error is
>>> emitted:
>>>>>>>>>> <stdin>:144: unknown element class 'FromHost'
>>>>>>>>>>
>>>>>>>>>> fromhost.cc contains
>>>>>>>>>> ELEMENT_REQUIRES(AnyDevice linuxmodule false)
>>>>>>>>>> The 'false' requirement, may be this prevents compiling this
>>> element?
>>>>>>>>>>
>>>>>>>>>> Sascha
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Am 09.11.2010 22:06, schrieb Joonwoo Park:
>>>>>>>>>>> Hi Sascha,
>>>>>>>>>>>
>>>>>>>>>>> I guess I'm not quite following FromHost issue here.
>>>>>>>>>>>
>>>>>>>>>>> Are you having build failure or any other problem?
>>>>>>>>>>> When I submitted patchless patches, I also built and fixes
>>> FromHost
>>>>>>>>>>> element and confirmed it's building.  I haven't tested element
>>> though.
>>>>>>>>>>> Did you apply '07/12 FromHost: netdev_ops for linux 2.6.33+'?
>>>>>>>>>>>
>>> http://www.mail-archive.com/click@amsterdam.lcs.mit.edu/msg04242.html
>>>>>>>>>>>
>>>>>>>>>>> Thanks,
>>>>>>>>>>> Joonwoo
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Nov 9, 2010 at 11:42 AM, Sascha Alexander Jopen
>>>>>>>>>>> <jopen at informatik.uni-bonn.de> wrote:
>>>>>>>>>>>> Hey,
>>>>>>>>>>>>
>>>>>>>>>>>> i compiled for a recent kernel from ubuntu, namely
>>> 2.6.35-22-generic. I
>>>>>>>>>>>> didn't apply your NETREG_REGISTERED patch, but it seems,
>>> everything
>>>>>>>>>>>> compiled fine.
>>>>>>>>>>>> I think this patch part is included in Joonwoos "[PATCH 04/12]
>>>>>>>>>>>> Configury: prepend net_device namespace for NETREG_REGISTERED"
>>>>>>>>>>>> As the enum in question is part of the net_device struct,
>>> everything
>>>>>>>>>>>> should work as expected. Applying your patch leads to compiler
>>> errors on
>>>>>>>>>>>> my system.
>>>>>>>>>>>>
>>>>>>>>>>>> So basically i am right, that FromHost is completely missing,
>>> currently?
>>>>>>>>>>>> It would be nice, if someone could point me to the right
>>> direction. What
>>>>>>>>>>>> is the problematic part in implementing this element?
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>> Sascha
>>>>>>>>>>>>
>>>>>>>>>>>> Am 09.11.2010 19:35, schrieb Roman Chertov:
>>>>>>>>>>>>> Sascha,
>>>>>>>>>>>>>
>>>>>>>>>>>>> What kernel version did you use?  It appears that for 2.6.35 and
>>> above the
>>>>>>>>>>>>> NETREG_REGISTERED fix is required as well.  If you start on
>>> updating FromHost, I
>>>>>>>>>>>>> will be glad to give you a hand.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Roman
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Fri, 05 Nov 2010 20:02:38 +0100 Sascha Alexander Jopen
>>>>>>>>>>>>> <jopen at informatik.uni-bonn.de> wrote
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> i tried click patchless today. I used those patches from
>>> Joonwoo, which
>>>>>>>>>>>>>> didn't make it into the repository till now. Especially the
>>> patches to
>>>>>>>>>>>>>> fixincludes and the configure scripts were necessary.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> It seems the FromHost element is not included during build. I
>>> know this
>>>>>>>>>>>>>> was the last element which had to be done, but is it really
>>> still not
>>>>>>>>>>>>>> finished? What are the missing parts for this element to work?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> We are using click userlevel and kernel level isn't really
>>> necessary but
>>>>>>>>>>>>>> still nice to have. So maybe i could use some spare time to
>>> finish the
>>>>>>>>>>>>>> FromHost element, if there isn't that much missing.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>> Sascha Jopen
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 11/03/10 17:42, Roman Chertov wrote:
>>>>>>>>>>>>>>> This will also require Joonwoo's PATCH1/12.  It removes
>>> #include
>>>>>>>>>>>>>>> <linux/autoconf.h>  from configure.in
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Tue, 02 Nov 2010 18:44:32 -0700 "Roman Chertov"<
>>> rchertov at cs.ucsb.edu>
>>>>>>>>>>>>>>> wrote
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> This works on Fedora 13 running 2.6.35.8 SMP kernel.  The
>>> second patch is
>>>>>>>>>>>>>>>> based
>>>>>>>>>>>>>>>> on patches 2/12 and 3/12 that Joonwoo released.  I had to add
>>> the
>>>>>>>>>>>>>>>> NETREG_REGISTERED patch due to scoping issues when an enum
>>> declared in
>>>>>>>>>>>>>>>> net_device is used.  Otherwise, the code is same as in github
>>> master
>>>>>>>>>>>>>>>> branch.
>>>>>>>>>>>>>>>> I
>>>>>>>>>>>>>>>> am not sure if there is a more elegant way to solve that
>>> issue.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Roman
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>> 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
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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
>>>>>>
>>>>>
>>>
>>> _______________________________________________
>>> 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
>>
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-FromHost-set-addresses.patch
Type: text/x-patch
Size: 9195 bytes
Desc: not available
Url : http://amsterdam.lcs.mit.edu/pipermail/click/attachments/20101123/8a5199da/attachment-0001.bin 


More information about the click mailing list