Hi Jeremie,
probably you could try to do from script something like this: if the src
ip is the buggy proxy and after loose_route() the destination URI points
to the same IP (use pseudo variables to do this check) , then you are
able to detect your case and to do a special processing.
regards,
bogdan
Jeremie Le Hen wrote:
Hi,
On Mon, Aug 28, 2006 at 04:36:42PM +0200, Jeremie Le Hen wrote:
I am running a NATing proxy. Everything works
fine, except that
some of my neighbour proxies send me BYE requests with an incorrect
Route header containing their own IP address.
The result is naturally that my proxy sends back the request and
the call is never ended.
I know this is a wrong behaviour and I have contacted the remote
administrator to have him fix his proxy. But in the meantime
I would like to find a workaround for my users.
I tried to do the following, before calling loose_routing(). I am
not sure if it's relevant or not nevertheless:
% if (method == "BYE") {
% # XXX Remove buggy Route header from BYE packets.
% xlog("L_ALERT", "Removing buggy Route header from BYE request");
% remove_hf("Route");
% lookup("location");
% }
However, I raised the verbosity level and found that the Route header
is read as soon as the packet is received, therefore the above
block is not really useful.
I dare to post the temporary workaround I have found for this issue,
for the records.
Fortunately, stock OpenSER doesn't allow to do this, which is fine
in regard to the RFC.
However I have customers and I can't afford to wait for the remote
administrator to unbreak his proxy. Given that the packet is
analyzed as soon as it is received by OpenSER, I didn't find an
easy way to circumvent a buggy Route header using the available
modules. Therefore, I wrote my little own module "shuntroute.so"
which mangles the SIP message as though there hav been no Route
header at all.
The above configuration block is now:
% if (method == "BYE") {
% # XXX Remove buggy Route header from BYE packets.
% xlog("L_ALERT", "Removing buggy Route header from BYE
request");
% shuntroute();
% remove_hf("Route");
% lookup("location");
% }
Please purist, forgive me.
Best regards,
------------------------------------------------------------------------
diff -urNp openser-1.1.0-notls/modules/shuntroute/Makefile
openser-1.1.0-shuntroute/modules/shuntroute/Makefile
--- openser-1.1.0-notls/modules/shuntroute/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ openser-1.1.0-shuntroute/modules/shuntroute/Makefile 2006-08-29 14:33:42.000000000
+0200
@@ -0,0 +1,6 @@
+include ../../Makefile.defs
+auto_gen=
+NAME=shuntroute.so
+LIBS=
+
+include ../../Makefile.modules
diff -urNp openser-1.1.0-notls/modules/shuntroute/shuntroute.c
openser-1.1.0-shuntroute/modules/shuntroute/shuntroute.c
--- openser-1.1.0-notls/modules/shuntroute/shuntroute.c 1970-01-01 01:00:00.000000000
+0100
+++ openser-1.1.0-shuntroute/modules/shuntroute/shuntroute.c 2006-08-29 15:50:39.000000000
+0200
@@ -0,0 +1,80 @@
+/*
+ * $Id: mangler.c,v 1.3 2006/01/24 20:56:25 bogdan_iancu Exp $
+ *
+ * mangler module
+ *
+ * Copyright (C) 2001-2003 FhG Fokus
+ *
+ * This file is part of openser, a free SIP server.
+ *
+ * openser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * openser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * History:
+ * --------
+ * 2003-04-07 first version.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "../../sr_module.h"
+#include "../../mem/mem.h"
+#include "../../dprint.h"
+#include "../../ut.h"
+#include "../../error.h"
+#include "../../str.h"
+#include "../../parser/msg_parser.h" /* struct sip_msg */
+
+MODULE_VERSION
+
+static int shuntroute(struct sip_msg *msg, char *unused1, char *unused2);
+
+/* Exported functions. */
+static cmd_export_t cmds[] =
+{
+ {"shuntroute", shuntroute, 0, NULL, REQUEST_ROUTE},
+ {0, 0, 0, 0, 0}
+};
+
+/* Module interface. */
+struct module_exports exports = {
+ "shuntroute",
+ cmds, /* Exported functions */
+ NULL, /* Exported parameters */
+ NULL, /* exported statistics */
+ NULL, /* module initialization function */
+ NULL, /* response function */
+ NULL, /* destroy function */
+ NULL /* child initialization function */
+};
+
+static int
+shuntroute(struct sip_msg *msg,
+ char *unused1 __attribute__ ((unused)),
+ char *unused2 __attribute__ ((unused)))
+{
+ struct hdr_field *itr, *tmp;;
+
+ if (msg->route == NULL)
+ return 1;
+ itr = msg->route;
+ while (itr) {
+ tmp = itr->sibling;
+ pkg_free(itr);
+ itr = tmp;
+ }
+ msg->route = NULL;
+ return 1;
+}
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users