lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5142CE23.9070804@hhi.fraunhofer.de>
Date:	Fri, 15 Mar 2013 08:30:43 +0100
From:	Thomas Martitz <thomas.martitz@....fraunhofer.de>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
CC:	richard -rw- weinberger <richard.weinberger@...il.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>,
	"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>
Subject: Re: Trying to implement secondary loopback

Am 13.03.2013 22:21, schrieb Eric W. Biederman:
> "Martitz, Thomas" <thomas.martitz@....fraunhofer.de> writes:
>
>>> Von: Eric W. Biederman [ebiederm@...ssion.com]
>>>
>>> The easy solution is to setup two network namespaces and two nics.
>>> And transmit data from one network namespace to another, through your
>>> nics.
>
>>
>> That sounds a lot more involed than using loopback to send data back
>> to the same process. And I guess just calling netif_rx() in the xmit()
>> function wouldn't be sufficient either? Also I wouldn't know how to do
>> that as I'm not yet very familiar with network namespaces (but that
>> can clearly get fixed).
>
> It may sound involved but it is just a few lines of code to set up.
>
> ip netns add ns1
> ip netns add ns2
> ip link set nic1 netns ns1
> ip link set nic2 netns ns2
>
> int main(int argc, char **argv)
> {
>          int netfd1, netfd2;
>          int sk1, sk2;
> 	netfd1 = open(/var/run/netns/nic1);
> 	netfd2 = open(/var/run/netns/nic2);
>
> 	setns(netfd1, 0);
> 	sk1 = socket(...);
>
>          setns(netfd2, 0);
>          sk2 = socket(...);
>
>          /* test test test */
> }
>
> And what is partidcularly interesting is that all of this works with
> your drivers normal code paths without any kernel hacks.
>
> Eric
>


I have trouble understanding this approach. Does it mean that I have to 
expose two interfaces from my kernel module. I.e. call register_netdev() 
twice? Or use a "struct pernet_operations" to create a netdev on a 
per-namespace basis.
If I do either of the above I end up with two "struct netdev" and two 
MAC addresses, which I don't really want. Also I would need to transfer 
from one netdev to the other in the driver's ndo_start_xmit() method 
instead of simply calling netif_rx().

Perhaps I'm misunderstanding, I'm s

During my development, looping back the data in ndo_start_xmit() is only 
a first step. The next step is to pass the data via PCIe and getting the 
same data back later. This is why I want to keep the loopback as 
simple/straightforward as possible.

Thanks for your assistance.

Best regards.

-----
visit us at

OFC 2013 / March 19-21 / Anaheim Convention Center, CA, USA / booth 11807

NABSHOW 2013 / April 8-11 / Las Vegas Convention Center, Nevada, USA / booth C7843

www.hhi.fraunhofer.de/events
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ