Skip to contentSkip to conversation

NF_IP_PRE_ROUTING?

DISCUSSION [email protected] 1 participant 2 messages Sep 16, 2005 – Sep 17, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi
I wrote simple linux firewall (nf_hook based). Below is part of that code:
------------
static struct nf_hook_ops lpf_nfh;

lpf_nfh.hook = lpf_hook_fn;
lpf_nfh.hooknum = NF_IP_PRE_ROUTING;
lpf_nfh.pf = PF_INET;
lpf_nfh.priority = NF_IP_PRI_FIRST;

nf_register_hook(&lpf_nfh);
--------------

I have question. It should get only incoming packets so why it takes outgoing to? If i will use NF_IP_POST_ROUTING [4] then it should get outgoing packets right? I found that diagram in "Linux netfilter hacking howto":

--->[1]--->[ROUTE]--->[3]--->[4]--->

                          |                   ^
                          |                    |
                          |              [ROUTE]
                          v                    |
                         [2]                [5]
                          |                   ^
                          |                    |
                          v                    |

Can anyone tell me why it works that way?
Thank you

PS. Sorry for my poor english