netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kristian Evensen <kristian.evensen@gmail.com>
To: Jan Engelhardt <jengelh@medozas.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Wrong MAC in redirected packet
Date: Wed, 25 Mar 2009 20:47:55 +0100	[thread overview]
Message-ID: <49CA8A6B.1020603@gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.00.0903251603050.18819@fbirervta.pbzchgretzou.qr>


>>>> My theory is that the original MAC-address is somehow added to the SKB
>>>> before it reaches the output-part of the RAW-table (which is where I
>>>> hook in),
>>>>         
>>> Routing is done before rawpost, yes, but before the (traditional) raw table.
>>> (it's in skb->dst)
>>>       
>> Ok, I assumed that the MAC-header was added at a lower layer, but that
>> was then wrong? For some reason I have always though skb->dst was the
>> IP-adress, I will look into that field.
>>     
>
> skb->dst contains the pointer to the neighbor (simply put), and a 
> neighbor is (also simplified) what you see in `ip neigh`, i.e. MAC 
>
>   
I can now confirm that this works, doing another lookup and updating the 
dst solved the problem and the MAC-header is now correct. I will clean 
up the code and then patch it into RAWNAT or something similar tomorrow, 
if it is of any interest.

However, I have noticed a similar problem when using my module on 
incoming packets in PREROUTING (on the multihomed receiver), the IP 
adress is changed (accoring to my dmesg-output) but then they are not 
heard from again. I have not debugged this properly, but if anyone has 
experienced something similar, feel free :) Can it be caused by the 
wrong MAC-header (changing dst does not work on input on my machine, the 
two interfaces are not aware of eachother's MAC address) being refused 
by some part of the kernel? As always, it for some reasong works when 
using DNAT, but I have not been able to figure out why :)

-Kristian

  parent reply	other threads:[~2009-03-25 19:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25 14:27 Wrong MAC in redirected packet Kristian Evensen
2009-03-25 14:33 ` Jan Engelhardt
2009-03-25 15:00   ` Kristian Evensen
2009-03-25 15:04     ` Jan Engelhardt
2009-03-25 15:17       ` Kristian Evensen
2009-03-25 15:20         ` Jan Engelhardt
2009-03-25 19:47       ` Kristian Evensen [this message]
2009-03-25 19:48         ` Jan Engelhardt
2009-03-25 19:56           ` Kristian Evensen
2009-03-25 19:57             ` Jan Engelhardt
2009-03-25 21:00               ` Kristian Evensen
2009-03-26 10:26                 ` Kristian Evensen
2009-03-26 20:07                   ` Jan Engelhardt
2009-03-26 20:54                     ` Kristian Evensen
2009-04-26  9:46                       ` Jan Engelhardt
2009-04-26 16:22                         ` Kristian Evensen
2009-04-26 21:29                           ` Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49CA8A6B.1020603@gmail.com \
    --to=kristian.evensen@gmail.com \
    --cc=jengelh@medozas.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).