programming rules with libiptc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to code a specific rule in C.
I read this howto http://www.faqs.org/docs/Linux-HOWTO/Querying-libiptc-HOWTO.html.
But it is not totally clear, especially for the target info.

Let's say I want to do the equivalent of "iptables -t nat -A OUTPUT -d 192.168.0.1 -j DNAT --to-destination 192.168.0.2"

here is briefly what I got so far
-------------
struct in_addr dest;
struct in_addr real;
inet_aton("192.168.0.1", &dest);
inet_aton("192.168.0.2", &real);
const char *chain = "OUTPUT";
const char *tablename = "nat";
const char *targetname = "DNAT";

iptc_handle_t h;
struct ipt_entry e;

h = iptc_init(tablename);
e.ip.dst = dest;

//missing some stuff here!!

iptc_append_entry(chain, &e, &h);
iptc_commit(&h);
--------------

Can anyone can help me setting a target for this rule?
I am going through iptables source code, but it is not really easy..

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

[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux