All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira <pablo@eurodev.net>
To: "Gary W. Smith" <gary@primeexalia.com>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: Modifications to netmap target
Date: Fri, 15 Apr 2005 22:27:15 +0200	[thread overview]
Message-ID: <426023A3.4020001@eurodev.net> (raw)
In-Reply-To: <27594E8BA9D5CA458F5EF87D88B6B48F1D4F@pxtvjoexd01.pxt.primeexalia.com>

Gary W. Smith wrote:
> After talking to Jason over on the netfilter users list about netmap target I found that it doesn't support the output chain of nat. 
>  
> I was looking through the code and found that it only registers itself with the pre and post route chains.  I was wondering if adding support for the output chain was as simple as adding the hook for the local_out and then ensuring that the correct modifications are made.  The following looks logically correct from looking into some of the source code for other modules.  Would more be required to make the ouput nat work with netmap?
>  
> Example.
>         if (hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING))) {
>                 DEBUGP(MODULENAME":check: bad hooks %x.\n", hook_mask);
>                 return 0;
>         }
> to:
>         if (hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING) | (1 << NF_IP_LOCAL_OUT) )) {
>                 DEBUGP(MODULENAME":check: bad hooks %x.\n", hook_mask);
>                 return 0;
>         }
>  
> and 
>    if (hooknum == NF_IP_PRE_ROUTING)
>                 new_ip = (*pskb)->nh.iph->daddr & ~netmask;
>         else
> to:
>    if (hooknum == NF_IP_PRE_ROUTING || hooknum == NF_IP_LOCAL_OUT)
>                 new_ip = (*pskb)->nh.iph->daddr & ~netmask;
>         else
>  
> I put the above changes in and compiled and I was able load the table but I'm not sure what the other imacts might be.  Comments would be greatly appreciated.
>  
> /sbin/iptables -t nat -A PREROUTING -d 10.0.0.56/29  -j NETMAP --to 10.0.0.80/29
> /sbin/iptables -t nat -A POSTROUTING -s 10.0.0.80/29 -j NETMAP --to 10.0.0.56/29
> /sbin/iptables -t nat -A OUTPUT -d 10.0.0.56/29  -j NETMAP --to 10.0.0.80/29

There's something that I don't understand yet, why you want to use 
NETMAP in the OUTPUT chain ?

--
Pablo

  reply	other threads:[~2005-04-15 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15 18:42 Modifications to netmap target Gary W. Smith
2005-04-15 20:27 ` Pablo Neira [this message]
2005-04-17 22:09 ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2005-04-15 19:55 Gary W. Smith
2005-04-15 20:28 Gary W. Smith

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=426023A3.4020001@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=gary@primeexalia.com \
    --cc=netfilter-devel@lists.netfilter.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 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.