- use a present Route header to determine next-hop

This commit is contained in:
Thomas Ries
2004-05-27 18:46:45 +00:00
parent 6c84c4879c
commit 054c60ac39
2 changed files with 15 additions and 1 deletions
+1
View File
@@ -1,5 +1,6 @@
0.5.7
=====
27-May-2004: - use a present Route header to determine next-hop
25-May-2004: - sip_utils.c:sip_del_myvia check for NULL list
24-May-2004: - included doc/sample_* to package
23-May-2004: - doc/: added configuration example for X-Lite
+14 -1
View File
@@ -119,6 +119,7 @@ int proxy_request (osip_message_t *request, struct sockaddr_in *from) {
get_ip_by_ifname(configuration.inbound_if, &addr2);
get_ip_by_ifname(configuration.outbound_if, &addr3);
/* my own route header? */
if ((sts == STS_SUCCESS) &&
((memcmp(&addr1, &addr2, sizeof(addr1)) == 0) ||
(memcmp(&addr1, &addr3, sizeof(addr1)) == 0)) &&
@@ -128,8 +129,20 @@ int proxy_request (osip_message_t *request, struct sockaddr_in *from) {
osip_list_remove(request->routes, 0);
osip_route_free(route);
/* request->routes will be freed by osip_message_free() */
DEBUGC(DBCLASS_PROXY,"removed Route header pointing to myself");
DEBUGC(DBCLASS_PROXY, "removed Route header pointing to myself");
}
/* rewrite request URI to now topmost Route header */
url=osip_message_get_uri(request);
route = (osip_route_t *) osip_list_get(request->routes, 0);
if (route && route->url && route->url->host) {
DEBUGC(DBCLASS_PROXY, "rewriting request URI from %s to %s",
url->host, route->url->host);
osip_uri_free(url);
url=NULL;
osip_uri_clone(route->url, &url);
}
}