sergey-safarov left a comment (kamailio/kamailio#4418)
Here, it is not only binding. Here is the user identification and
`Record-Route` and `Route` headers management.
Example.
Two users registered via different VRF:
1. user1 registered via vrf-1 and uses IP address 192.168.1.2, Kamailio IP
192.168.1.1;
2. user2 registered via vrf-2 and uses IP address 192.168.1.2; Kamailio IP
192.168.1.1.
In this case, we need to separate users and the Kamailio interface not only by
IP. In the provided example, both are the same. We need add VRF ID for Kamailio
interfaces and users.
Also, add 5 cents more. In the current IT, containerization technology is
present everywhere. For containers separation used `namespace` technology. This
technology, like VRF. The difference is the loopback interface. When you
create namespace, it creates a new loopback interface. In VRF loopback
interface is not created.
Here ChatGPT example of how to open a socket in the namespace
```
#include <sched.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main() {
int fd = open("/var/run/netns/nsB", O_RDONLY); // target namespace
setns(fd, CLONE_NEWNET); // switch to nsB
close(fd);
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in addr = {
.sin_family = AF_INET,
.sin_addr.s_addr = inet_addr("10.0.0.1"),
.sin_port = htons(8080)
};
bind(sock, (struct sockaddr *)&addr, sizeof(addr));
// Optionally, switch back to original namespace
// (if you saved it before switching)
listen(sock, 5);
}
```
In my understanding, Kamailio can open a socket in different namespaces and
then manipulate messages like in VRF.
For me, `namespacs` is more often used than `vrf` and more easier to understand
for users. It is just my opinion.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4418#issuecomment-3371390639
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4418/[email protected]>_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the
sender!