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 16:00:32 +0100	[thread overview]
Message-ID: <17e3a8f80903250800q15964da1gaf24ff1670ba3802@mail.gmail.com> (raw)
In-Reply-To: <alpine.LSU.2.00.0903251528420.19598@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.

>>because of the sender's mapping between the original
>>destination IP and MAC. However, I have not been able to figure this
>>out. Also, I  looked at the NAT-code, but it seems to "only" change
>>IP-address as well. Have I overlooked something or am I correct?
>
> Most likely RAWS/DNAT should gain another option to also tweak the
> MAC daddr, by calling ip_route_output_key to get a new skb->dst.

This sounds like a good idea. I will look at the ip_route_output_key,
try to write a function for my module and patch it into RAWNAT (unless
somebody else does it first).

>>Btw, RAWDNAT throws up a couple of errors on my machine, so I have not
>>been able to see it it does what I want to do.
>
> Which errors?
>

After struggling a bit with the compilation (I had to remove the
iptable_rawpost.o ip6table_rawpost.o in Kbuild or the compiler
complained that it couldn't find the files), I get this error when I
try to use it:

kristrev@mylatop:~/src/xtables-addons-1.12$ sudo iptables -A
PREROUTING -t raw -p udp -d 192.168.101.14 --dport 9999 -j RAWDNAT
--to-destination 192.168.100.250
iptables: Invalid argument

-Kristian
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-03-25 15:00 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 [this message]
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
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=17e3a8f80903250800q15964da1gaf24ff1670ba3802@mail.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).