* Setting mac address of loopback device
@ 2014-01-23 19:53 Cong Wang
2014-01-23 23:49 ` Hannes Frederic Sowa
0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2014-01-23 19:53 UTC (permalink / raw)
To: David Miller; +Cc: stephen, netdev
Hi,
I am wondering how much sense it makes to allow setting the mac
address of the loopback device?
We are trying to mirror the local traffic from lo to eth0, but
apparently the mac addresses in L2 header are all zero. Of course, one
solution is using pedit action to modify the mac addresses. But still,
if we could set the mac addr of lo, we don't need to modify the mac
header twice.
The patch itself is simple, probably just:
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index c5011e0..a0ee030 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -160,6 +160,7 @@ static const struct net_device_ops loopback_ops = {
.ndo_init = loopback_dev_init,
.ndo_start_xmit= loopback_xmit,
.ndo_get_stats64 = loopback_get_stats64,
+ .ndo_set_mac_address = eth_mac_addr,
};
/*
BTW, how to change route to redirect _local_ traffic (that is packets
sending to itself) to a non-loopback device? I tried to modify local
route table, but have no luck to make it working.
Thanks!
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Setting mac address of loopback device
2014-01-23 19:53 Setting mac address of loopback device Cong Wang
@ 2014-01-23 23:49 ` Hannes Frederic Sowa
2014-01-24 0:03 ` Cong Wang
0 siblings, 1 reply; 5+ messages in thread
From: Hannes Frederic Sowa @ 2014-01-23 23:49 UTC (permalink / raw)
To: Cong Wang; +Cc: David Miller, stephen, netdev
On Thu, Jan 23, 2014 at 11:53:49AM -0800, Cong Wang wrote:
> BTW, how to change route to redirect _local_ traffic (that is packets
> sending to itself) to a non-loopback device? I tried to modify local
> route table, but have no luck to make it working.
Have you seen the route_localnet sysctl? It should avoid the check for
loopback addresses when building outgoing route.
Greetings,
Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Setting mac address of loopback device
2014-01-23 23:49 ` Hannes Frederic Sowa
@ 2014-01-24 0:03 ` Cong Wang
2014-01-24 0:10 ` Hannes Frederic Sowa
0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2014-01-24 0:03 UTC (permalink / raw)
To: Cong Wang, David Miller, stephen, netdev
On Thu, Jan 23, 2014 at 3:49 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
> On Thu, Jan 23, 2014 at 11:53:49AM -0800, Cong Wang wrote:
>> BTW, how to change route to redirect _local_ traffic (that is packets
>> sending to itself) to a non-loopback device? I tried to modify local
>> route table, but have no luck to make it working.
>
> Have you seen the route_localnet sysctl? It should avoid the check for
> loopback addresses when building outgoing route.
I noticed it, the doc said:
This enables the use of 127/8 for local routing purposes.
but I don't care 127/8 traffic at all, only the traffic sending to itself
via a non-127/8 IP. :(
Or the doc is not accurate?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Setting mac address of loopback device
2014-01-24 0:03 ` Cong Wang
@ 2014-01-24 0:10 ` Hannes Frederic Sowa
2014-01-24 0:55 ` Cong Wang
0 siblings, 1 reply; 5+ messages in thread
From: Hannes Frederic Sowa @ 2014-01-24 0:10 UTC (permalink / raw)
To: Cong Wang; +Cc: David Miller, stephen, netdev
On Thu, Jan 23, 2014 at 04:03:29PM -0800, Cong Wang wrote:
> On Thu, Jan 23, 2014 at 3:49 PM, Hannes Frederic Sowa
> <hannes@stressinduktion.org> wrote:
> > On Thu, Jan 23, 2014 at 11:53:49AM -0800, Cong Wang wrote:
> >> BTW, how to change route to redirect _local_ traffic (that is packets
> >> sending to itself) to a non-loopback device? I tried to modify local
> >> route table, but have no luck to make it working.
> >
> > Have you seen the route_localnet sysctl? It should avoid the check for
> > loopback addresses when building outgoing route.
>
> I noticed it, the doc said:
>
> This enables the use of 127/8 for local routing purposes.
>
> but I don't care 127/8 traffic at all, only the traffic sending to itself
> via a non-127/8 IP. :(
>
> Or the doc is not accurate?
It seems accurate. Only other idea is to try netfilter with TEE target on
loopback.
Greetings,
Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Setting mac address of loopback device
2014-01-24 0:10 ` Hannes Frederic Sowa
@ 2014-01-24 0:55 ` Cong Wang
0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2014-01-24 0:55 UTC (permalink / raw)
To: Cong Wang, David Miller, stephen, netdev
On Thu, Jan 23, 2014 at 4:10 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
>
> It seems accurate. Only other idea is to try netfilter with TEE target on
> loopback.
>
xt_TEE should work for me too. But for applications, using iptables
is at least as hard as using a tc action.
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-24 0:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 19:53 Setting mac address of loopback device Cong Wang
2014-01-23 23:49 ` Hannes Frederic Sowa
2014-01-24 0:03 ` Cong Wang
2014-01-24 0:10 ` Hannes Frederic Sowa
2014-01-24 0:55 ` Cong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).