[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3D7E565A361FB844A410A5EFCDD7BA4002F351@MXSRV3.fe.hhi.de>
Date: Wed, 13 Mar 2013 22:01:00 +0000
From: "Martitz, Thomas" <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: AW: AW: Trying to implement secondary loopback
>
> ________________________________________
> Von: Eric W. Biederman [ebiederm@...ssion.com]
> Gesendet: Mittwoch, 13. März 2013 22:21
> An: Martitz, Thomas
> Cc: richard -rw- weinberger; netdev@...r.kernel.org; davem@...emloft.net; edumazet@...gle.com; herbert@...dor.apana.org.au
> Betreff: Re: AW: Trying to implement secondary loopback
>
> "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.
>
Thanks for the info, sounds very interesting. Now, how do I provide multiple interfaces within a single kernel module. Just call register_netdev() multiple times?
Best regards.
-----
visit us at
OFC 2013 / March 19-21 / Anaheim Convention Center, CA, USA / booth 11807
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