Hi,
it looks to me that Kamailio detects NAT without
NAT being there, when used in IPv6 scenarios.
I have a register, which comes in like this:
U 2015/01/23 11:42:31.013284
2a01:1234:123:1234::2:16732 ->
2001:9876:98:9876::aa01:5060
REGISTER
sip:domain SIP/2.0
Via: SIP/2.0/UDP
[2a01:1234:123:1234::2]:16732;branch=z9hG4bK45528eba
After it has run through Kamailio, the packet is sent
out like this:
U 2015/01/23 11:42:31.015126
1.2.3.4:5060
->
9.8.7.6:5060
REGISTER
sip:domain SIP/2.0
Via: SIP/2.0/UDP
1.2.3.4;branch=z9hG4bK8d21.7fa5fb060c2acc9583f05a93b93f9873.0
Via: SIP/2.0/UDP
[2a01:1234:123:1234::2]:16732;received=2A01:1234:123:1234:0:0:0:2;branch=z9hG4bK45528eba
As far as I know, the received part should only get
appended, if the source IP of the packet differs from
the IP advertised in the topmost Via header. But to me
it looks like it always gets appended. In just IPv4
scenarios, the received parameter only gets appended if
a difference is detected.
And if it gets appended, shouldn't the received
parameter IP be in square brackets, too?
Later on, we have something like this in our code:
if(method=="REGISTER") {
if (nat_uac_test("23")) {
append_hf("X-nathint:
nat\r\n");
force_rport();
if (!add_path_received())
{
sl_send_reply("503", "Internal Path Error");
};
} else {
if (!add_path()) {
sl_send_reply("503", "Internal Path Error");
};
};
}
In our code, Kamailio always jumps into the
add_path_received() part, so I guess, NAT detection
triggers. But why?