Re: strange IP rewrite of the libnetfilter_conntrack

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

 



Sorry for the previous mail.  My problem is solved. It should have use
ntfc_set_attr_u32 for address.
Please kindly ignore.

P

On Fri, Jul 30, 2010 at 11:34 AM, Pete Kay <petedao@xxxxxxxxx> wrote:
> Hi,
>
> I am trying to add the following rule to the conntrack table:
>
> nfct_set_attr_u8(ct, ATTR_L3PROTO, AF_INET);
> nfct_set_attr_u32(ct, ATTR_IPV4_SRC, inet_addr("192.168.1.20"));
> nfct_set_attr_u32(ct, ATTR_IPV4_DST, inet_addr("192.168.1.114"));
> nfct_set_attr_u8(ct, ATTR_L4PROTO, IPPROTO_UDP);
> nfct_set_attr_u16(ct, ATTR_PORT_SRC, htons(10012);
> nfct_set_attr_u16(ct, ATTR_PORT_DST, htons(18482);
>
> nfct_setobjopt(ct, NFCT_SOPT_SETUP_REPLY);
> nfct_set_attr_u32(ct, ATTR_TIMEOUT, 100);
>
> nfct_set_attr_u16(ct, ATTR_SNAT_IPV4, inet_addr("192.168.1.114"));
> nfct_set_attr_u16(ct, ATTR_SNAT_PORT, htons(18480);
> nfct_set_attr_u16(ct, ATTR_DNAT_IPV4, inet_addr("192.168.1.56");
> nfct_set_attr_u16(ct, ATTR_DNAT_PORT, htons(16385);
>
>
> The tcpdump shows:
>
> 11:24:44.062306 IP 192.168.1.20.10012 > 192.168.1.114.18482: udp/rtp
> 160 c0  17381 2867392
> 11:24:44.062336 IP 192.168.0.0.18482 > 192.168.0.0.16385: udp/rtp 160
> c0  17381 2867392
>
> But I am actually expecting:
>
> 11:24:44.062306 IP 192.168.1.20.10012 > 192.168.1.114.18482: udp/rtp
> 160 c0  17381 2867392
> 11:24:44.062336 IP 1192.168.1.114.18482 > 192.168.1.56.16385: udp/rtp
> 160 c0  17381 2867392
>
>
> Can someone tell me what is wrong with my code?
>
> Thanks,
> P
>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux