<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Problems with mhomed </TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>As I see in sip-router and in kamailio, the mhomed implementation is very very slow . For each SIP packet a<BR>
temporary socket is created, connected to the remote host and than checked to see what interface was selected<BR>
to connect the socket(see method get_out_socket() in forward.c)<BR>
<BR>
As test have shown, this implementation, albeit correct from a funtional point of view, it's really too slow<BR>
(or too expensive) to be used in medium-large production setups.<BR>
<BR>
I am currently working on a patch that mitigates this problem. The way the patch works is like this:<BR>
<BR>
1. Get the routing table from the kernel via NETLINK sockets(done at start)<BR>
2. Construct a link list of routes, each entry for one interface(either real of virtual). The structure will hold<BR>
the address of the interface and the destination (as reported by route -n)(this will be a CIDR entry). Also it's<BR>
decided if on that interface a default route has been assigned(done at start)<BR>
3. get_out_socket() will be changed to loop thru the list described above and decide based on the destination member<BR>
of the struct describe above on what interface the packet is to be routed. If no destination is matched than the<BR>
default one is selected.(done for each packet)<BR>
4.A NETLINK socket will be added to the poll()ing loop so it can monitor the changes in the kernel's routing table<BR>
and update the internal structure if necessary.(done at start)(The table is updated only if administration changes the<BR>
routing table via route or ip route commands)<BR>
<BR>
I have implemented the first 3 steps and preliminary tests look ok. step for is required only if we want updates on<BR>
the routing table in real time.<BR>
<BR>
Limitations:<BR>
1. This only works for Linux, AF_INET sockets. AF_INET6 is also supported but i don't know to what extent<BR>
2. For BSD, route sockets should replace the NETLINK sockets<BR>
<BR>
What are your suggestion about this? Should this patch (when completely finished) be commited?<BR>
<BR>
Thanks for any suggestions!<BR>
<BR>
Marius.<BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>