IPv4 in IPv6 encapsulator - Locally generated traffic issue

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

 



Hi all,
I try to implement an IPv4 in IPv6 encapsulator/decapsulator on my own. I know that ip4ip6 tunnel exists in Linux but I need to do it for some special features!
So in order to do that, I use libipq (which is quite obsolete I know).
The principle is the following:

IPv4/IPv6                    IPv4/IPv6
Host A     --------------->  Host B
@IPv4A                       @IPv4B
@IPv6A                       @IPv6B

Host A pings host B in IPv4 (ping @IPv4B).

With libipq, I encapsulate the V4 ping in V6 which gives the following packet: [@IPv6A @IPv6B][@IPv4A @IPv4B][ICMPv4]. Host B receives the IPv4 in IPv6 ping. I decapsulate the IPv6 header with libipq. It gives me the following IPv4 echo request: [@IPv4A @IPv4B][ICMPv4]. Then with a row socket where sin->addr is set to @IPv4B, I "send" the IPv4 echo request in order to have the right echo reply. The kernel produces me an echo reply but it's where the problem begins. The echo reply has as source addr @IPv4B which is logical but also @IPv4B as destination address wereas I'm waiting @IPv4A to reply to the ping. I dont understand why. I think it has something to deal with the fact that the IPv4 echo reply is "generated locally" when I decaspulate the IPv6 header but I dont get it... Note also that I just decapsulate/encapsulate the header, I never manipulate src or dst address.

If you have any tips for solving that, it would be great.

Thank you,
cheers.

Tanguy

--
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