All of lore.kernel.org
 help / color / mirror / Atom feed
* Faking ethernet source MAC in NF_IP_POST_ROUTING
@ 2004-06-23 16:15 Phillip Whelan
  2004-06-24  8:07 ` Henrik Nordstrom
  2004-06-28  9:31 ` Mario
  0 siblings, 2 replies; 3+ messages in thread
From: Phillip Whelan @ 2004-06-23 16:15 UTC (permalink / raw)
  To: netfilter-devel

Hello,

Quote: (myself)
  "I've been working lately on a netfilter hook extension which Rewrites outgoing ARP packets to spoof a host's MAC address."

I already managed to solve a problem involving ARP replies automagically updating arp caches by modifying the arp payload's sender hw_addr.
(or perhaps, the tha... whatever, it works).

The kernel is now spoofing itself, etc... but, it still sends out packets with the real MAC address. This, of course confuses the end host to no ends.

In NF_IP_POST_ROUTING, the skb->mac is not NULL, but skb->mac_len is 0.
Directly modifying the skb->mac would just lead to memory corruption. 
How would I modify the source MAC address? (Im inside NF_IP_POST_ROUTING). Can I access through a negative offset from skb->data? (net/ipv4/arp.c does this, I think).

-- 
Phillip Whelan
Lead Programmer
Exis - Extreme Information Solutions/Security
http://www.exis.cl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Faking ethernet source MAC in NF_IP_POST_ROUTING
  2004-06-23 16:15 Faking ethernet source MAC in NF_IP_POST_ROUTING Phillip Whelan
@ 2004-06-24  8:07 ` Henrik Nordstrom
  2004-06-28  9:31 ` Mario
  1 sibling, 0 replies; 3+ messages in thread
From: Henrik Nordstrom @ 2004-06-24  8:07 UTC (permalink / raw)
  To: Phillip Whelan; +Cc: Netfilter Developers List

On Wed, 23 Jun 2004, Phillip Whelan wrote:

> In NF_IP_POST_ROUTING, the skb->mac is not NULL, but skb->mac_len is 0.
> Directly modifying the skb->mac would just lead to memory corruption.  
> How would I modify the source MAC address? (Im inside
> NF_IP_POST_ROUTING). Can I access through a negative offset from
> skb->data? (net/ipv4/arp.c does this, I think).

You can't from netfilter. The MAC is added very very late in the packet 
sending process, after the NF_IP_POST_ROUTING hook.

What you maybe can do if ARP is your only concern is to run ARP in
userspace and send the replies using a raw socket.

But I honestly do not understand why you want to do this. The ARP address
is configurable (see the ip link command), and there even exists patches
to allow a single Ethernet to act as multiple virtual interfaces each with
their own MAC... (look for mac vlan, can be found from the same source as
the vlan patch)

Regards
Henrik

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Faking ethernet source MAC in NF_IP_POST_ROUTING
  2004-06-23 16:15 Faking ethernet source MAC in NF_IP_POST_ROUTING Phillip Whelan
  2004-06-24  8:07 ` Henrik Nordstrom
@ 2004-06-28  9:31 ` Mario
  1 sibling, 0 replies; 3+ messages in thread
From: Mario @ 2004-06-28  9:31 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Phillip Whelan

On Wednesday 23 June 2004 19:15, Phillip Whelan wrote:
> Hello,
>
> Quote: (myself)
>   "I've been working lately on a netfilter hook extension which Rewrites
> outgoing ARP packets to spoof a host's MAC address."
>
> I already managed to solve a problem involving ARP replies automagically
> updating arp caches by modifying the arp payload's sender hw_addr. (or
> perhaps, the tha... whatever, it works).
>
> The kernel is now spoofing itself, etc... but, it still sends out packets
> with the real MAC address. This, of course confuses the end host to no
> ends.
>
> In NF_IP_POST_ROUTING, the skb->mac is not NULL, but skb->mac_len is 0.
> Directly modifying the skb->mac would just lead to memory corruption.
> How would I modify the source MAC address? (Im inside NF_IP_POST_ROUTING).
> Can I access through a negative offset from skb->data? (net/ipv4/arp.c does
> this, I think).


You can modify MAC address by using ebtables & bridge extentions.
Using ebtables on bridge device you can have multiple MACs and can do MAC SNAT 
or DNAT.iptables can't change MAC addresses because iptables is 
layer3.ebtables is layer2 and it can modify MACs.Try it! It works! Tested ;P~
You can use it also if you want to conflict huge ip classes...some ISPs are 
using this way to stop their clients using their local area networks if they 
are not paying.It can be useful in your case.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-06-28  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-23 16:15 Faking ethernet source MAC in NF_IP_POST_ROUTING Phillip Whelan
2004-06-24  8:07 ` Henrik Nordstrom
2004-06-28  9:31 ` Mario

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.