<h3>Description</h3>
<p>When using Kamailio with <code>tcp_accept_haproxy=yes</code>, the <code>$si</code> and <code>$sp</code> variables have the<br>
real IP & Port information from the original connection to the LB leaving no way to access the connection IP & Port from where the packet is received from Kamailio perspective.</p>
<h3>Possible Solutions</h3>
<p>Create two new pseudovariables that contain the connection IP & Port where the packet was received for use cases where <code>tcp_accept_haproxy=yes</code>.</p>
<p>Suggested names (but could be any): $CI and $CP meaning -> Connection IP and Connection Port.</p>
<h3>Example</h3>
<p>With <code>tcp_accept_haproxy=yes</code>:</p>
<p>UAC (1.1.1.1:45621) -> (2.2.2.2:5060) LB <strong>with</strong> Proxy Protocol (3.3.3.3:57482) -> (4.4.4.4:5060) Kamailio.</p>
<pre><code>$si = 1.1.1.1
$sp = 45621
$CI = 3.3.3.3
$CP = 57482
</code></pre>
<p>With <code>tcp_accept_haproxy=no</code>:</p>
<p>UAC (1.1.1.1:45621) -> (2.2.2.2:5060) LB <strong>without</strong> Proxy Protocol (3.3.3.3:57482) -> (4.4.4.4:5060) Kamailio.</p>
<pre><code>$si = 3.3.3.3
$sp = 57482
$CI = 3.3.3.3
$CP = 57482
</code></pre>
<p>I don't think there is any way to get the <code>3.3.3.3:57482</code> IP and Port from the example above when using <code>tcp_accept_haproxy=yes</code> but I could be wrong.</p>
<p>Thanks!<br>
Joel.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/2103?email_source=notifications&email_token=ABO7UZNRUD7AX2AJFQHMXVLQPD7IPA5CNFSM4JCA6F5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSTPLHA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZLBJOFEN2N32JTP2JDQPD7IPANCNFSM4JCA6F5A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZMQDYG3UKK7P55UNSDQPD7IPA5CNFSM4JCA6F5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSTPLHA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/2103?email_source=notifications\u0026email_token=ABO7UZNRUD7AX2AJFQHMXVLQPD7IPA5CNFSM4JCA6F5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSTPLHA",
"url": "https://github.com/kamailio/kamailio/issues/2103?email_source=notifications\u0026email_token=ABO7UZNRUD7AX2AJFQHMXVLQPD7IPA5CNFSM4JCA6F5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HSTPLHA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>