Sample pf code gives DIOCNATLOOK error

Hello

I have a rule in my pf.conf that looks like this:

Code:
rdr on $intif inet proto tcp from 192.168.0/24 to any port 2:65535 -> 127.0.1.2 port 8003


When you do a man on pf you see at the very bottom sample code for doing a NAT lookup

so I compile the code, and run it like so:

./a.out 127.0.1.2 8003 192.168.0.101 80

(This is after I have attempted to hit a website with the browser running on 192.168.0.101)

So I can see the state table entry in pfctl -ss

Code:
all tcp 127.0.1.2:8003 (173.194.73.104:80) <- 192.168.0.101:57598 ESTABLISHED:ESTABLISHED

So why is that sample code telling me
Code:
DIOCNATLOOK: No such file or directory
?

I am trying to use similar code in my own project, and I am getting the same thing.
 
After playing with this for a bit - it seems like I am able to get the sample to work for me if I punch in the final destination and the original source. Is there a way to do a reverse lookup where I only know the source and the loopback's address?
 
nevermind..just realized if I switched it to PF_OUT in the natlook struct it gave me what iw as looking for. Maybe this can help someone else.
 
Back
Top