Module: sip-router
Branch: master
Commit: a7ddee8e5f9fba13c482e8b1b2ba3a59e5598fea
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a7ddee8…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jun 14 17:30:26 2010 +0200
*_radius(s): doc: update to the new doc makefile format
Update the doc makefiles for auth_radius, avp_radius and
uri_radius.
---
modules_s/auth_radius/doc/Makefile | 31 +++----------------------------
modules_s/avp_radius/doc/Makefile | 31 +++----------------------------
modules_s/uri_radius/doc/Makefile | 31 +++----------------------------
3 files changed, 9 insertions(+), 84 deletions(-)
diff --git a/modules_s/auth_radius/doc/Makefile b/modules_s/auth_radius/doc/Makefile
index 4537cf4..477c335 100644
--- a/modules_s/auth_radius/doc/Makefile
+++ b/modules_s/auth_radius/doc/Makefile
@@ -1,29 +1,4 @@
-#
-# The list of documents to build (without extensions)
-#
-DOCUMENTS = auth_radius
+docs = auth_radius.xml
-#
-# The root directory containing Makefile.doc
-#
-ROOT_DIR=../../..
-
-#
-# Validate docbook documents before generating output
-# (may be slow)
-#
-#VALIDATE=1
-
-#
-# You can override the stylesheet used to generate
-# xhtml documents here
-#
-#XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.xsl
-
-#
-# You can override the stylesheet used to generate
-# plain text documents here
-#
-#TXT_XSL=$(XHTML_XSL)
-
-include $(ROOT_DIR)/Makefile.doc
+docbook_dir=../../../docbook
+include $(docbook_dir)/Makefile.module
diff --git a/modules_s/avp_radius/doc/Makefile b/modules_s/avp_radius/doc/Makefile
index 1bd9eb9..dd0cd7c 100644
--- a/modules_s/avp_radius/doc/Makefile
+++ b/modules_s/avp_radius/doc/Makefile
@@ -1,29 +1,4 @@
-#
-# The list of documents to build (without extensions)
-#
-DOCUMENTS = avp_radius
+docs = avp_radius.xml
-#
-# The root directory containing Makefile.doc
-#
-ROOT_DIR=../../..
-
-#
-# Validate docbook documents before generating output
-# (may be slow)
-#
-#VALIDATE=1
-
-#
-# You can override the stylesheet used to generate
-# xhtml documents here
-#
-#XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.xsl
-
-#
-# You can override the stylesheet used to generate
-# plain text documents here
-#
-#TXT_XSL=$(XHTML_XSL)
-
-include $(ROOT_DIR)/Makefile.doc
+docbook_dir=../../../docbook
+include $(docbook_dir)/Makefile.module
diff --git a/modules_s/uri_radius/doc/Makefile b/modules_s/uri_radius/doc/Makefile
index 27d7ea1..829e048 100644
--- a/modules_s/uri_radius/doc/Makefile
+++ b/modules_s/uri_radius/doc/Makefile
@@ -1,29 +1,4 @@
-#
-# The list of documents to build (without extensions)
-#
-DOCUMENTS = uri_radius
+docs = uri_radius.xml
-#
-# The root directory containing Makefile.doc
-#
-ROOT_DIR=../../..
-
-#
-# Validate docbook documents before generating output
-# (may be slow)
-#
-#VALIDATE=1
-
-#
-# You can override the stylesheet used to generate
-# xhtml documents here
-#
-#XHTML_XSL=$(ROOT_DIR)/doc/stylesheets/xhtml.xsl
-
-#
-# You can override the stylesheet used to generate
-# plain text documents here
-#
-#TXT_XSL=$(XHTML_XSL)
-
-include $(ROOT_DIR)/Makefile.doc
+docbook_dir=../../../docbook
+include $(docbook_dir)/Makefile.module
Hi,
I used the shm_regex functions from lib in one of my own modules and
noticed that it is dead-locking (it hangs in FUTEX_WAIT).
The code hangs in regexec() when trying to acquire the lock. This was
a bit hard to find out as I couldn't reproduce it in a virtual
machine with some test code I wrote. It turns out this only happens if
the machine has more than one physical CPU core.
Reproducable on x86_64 with two CPU cores, glibc 2.3.6 (from Debian
Etch) and glibc 2.11.1 (from Ubuntu Jaunty).
Attached is a patch which does its own locking and thus works around
this problem.
Best regards,
Stefan
--
M.Eng. Stefan Keller
CTO (Technischer Leiter)
Phone +49-30-203899889
Mobile +49-170-4150437
Fax +49-30-722399150
stefan.keller(a)isaco.de
www.isaco.de
ISACO GmbH
Kurfürstenstr. 79
10787 Berlin
Germany
Amtsgericht Charlottenburg, HRB 112464B
Geschäftsführer: Daniel Frommherz
[cc'ed sr-dev]
On Jun 13, 2010 at 11:10, Juha Heinanen <jh(a)tutpro.com> wrote:
> Dmitry Kirillov writes:
>
> > Program received signal SIGSEGV, Segmentation fault.
> > 0x2880c2c0 in qop () from /usr/local/lib/ser/modules_s/auth.so
> > (gdb) bt
> > #0 0x2880c2c0 in qop () from /usr/local/lib/ser/modules_s/auth.so
> > #1 0x28816555 in authorize (_msg=0x8343b58, _realm=0x0, _uri_user=0x0,
> > _hftype=15) at authorize.c:102
> > #2 0x288163e8 in radius_proxy_authorize_1 (_msg=0x8343b58, _realm=0x0,
> > _s2=0x0) at authorize.c:157
>
> i'm not sure what is going on. looks like you are using s version of
> auth module, but there pre_auth has five params:
>
> auth_result_t pre_auth(struct sip_msg* msg, str* realm, hdr_types_t hftype,
> struct hdr_field** hdr, check_auth_hdr_t check_auth_hdr)
>
> whereas the above seems to indicate that k version of auth module is in
> use where pre_auth has four params:
>
> auth_result_t pre_auth(struct sip_msg* _m, str* _realm, hdr_types_t _hftype,
> struct hdr_field** _h)
It looks like he uses modules/auth_radius (which seems to be the k
version) and modules_s/auth. Unfortunately the ser auth api is
incompatible with the k one.
OTOH IMHO the ser auth module is superior to the k one, e.g.:
ser auth:
+ nonce-count/qop=auth* support:
http://sip-router.org/docbook/sip-router/branch/master/modules_s/auth/auth.…
+ lockless in nonce-count or one time nonce mode
+ extra protection even in non qop=auth mode and non-one-time-nonce mode
(the one time nonce mode has potential issues with retransmissions):
http://sip-router.org/docbook/sip-router/branch/master/modules_s/auth/auth.…
+ speed optimized (less syscalls, concurrent access)
+ base64 nonces (shorter)
k auth (at first sight) seems to support only on-time-nonces and their
implementation uses locks (and seems to be more "limited").
>
> anyway, i only have experience with kamailio_3.0 radius auth, which has
> worked fine. perhaps you can try with that too.
We need either to quickly merge the auth apis or revive
modules_s/auth_radius (and probably the other modules_s/*radius).
Unfortunately merging the auth api doesn't look like a quick job:
ser auth api:
+ build_challenge()
+ qop
+ calc_response()
k auth api:
+ rpid_avp
+ rpid_avp_type
+ check_response()
so reviving the modules_s/*radius looks like the quick fix (at least
for 3.0).
So anybody against reviving them in 3.0? (or does anybody remember any
problem with the s versions?)
Andrei
Module: sip-router
Branch: andrei/raw_sock
Commit: 861d3a2edc57842e35768d06ea4440e53a6f2f81
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=861d3a2…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Jun 9 22:55:21 2010 +0200
core: basic support for receiving udp sip packets on raw sockets
Functions for receiving udp sip packets from raw sockets.
---
raw_listener.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
raw_listener.h | 39 +++++++++++++++
2 files changed, 186 insertions(+), 0 deletions(-)
diff --git a/raw_listener.c b/raw_listener.c
new file mode 100644
index 0000000..ef707a2
--- /dev/null
+++ b/raw_listener.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/** raw socket udp listen functions.
+ * @file raw_listener.c
+ * @ingroup core
+ * Module: @ref core
+ */
+/*
+ * History:
+ * --------
+ * 2010-06-09 intial version (from older code) andrei
+ */
+
+#ifdef USE_RAW_SOCKS
+
+#include "../../config.h"
+#include "../../receive.h"
+
+#include "raw_listener.h"
+#include "raw_sock.h"
+#include "tlb_send.h"
+#include "tlb_cfg.h"
+
+#include <errno.h>
+#include <string.h>
+
+struct raw_listen_info* raw_sendipv4=0;
+
+/** creates a raw socket based on a socket_info structure.
+ * Side-effects: sets raw_udp_sendipv4 if not already set.
+ * @param si - pointer to partially filled socket_info structure (su must
+ * be set).
+ * @param iface - pointer to network interface to bind on (str). Can be null.
+ * @param iphdr_incl - 1 if send on these socket will include the IP header.
+ * @return <0 on error, socket on success.
+ */
+int raw_listener_init(struct socket_info* si, str* iface, int iphdr_incl)
+{
+ int sock;
+ struct ip_addr ip;
+
+ su2ip_addr(&ip, &si->su);
+ sock=raw_udp4_socket(&ip, iface, iphdr_incl);
+ if (sock>=0){
+ if (raw_sendipv4==0 || iface==0 || iface->s==0)
+ raw_udp_sendipv4=si;
+ }
+ return sock;
+}
+
+
+
+/** receive sip udp ipv4 packets over a raw socket in a loop.
+ * It should be called by a "raw socket receiver" process
+ * (since the function never exits unless it encounters a
+ * critical error).
+ * @param rsock - initialized raw socket.
+ * @param port1 - start of port range.
+ * @param port2 - end of port range. If 0 it's equivalent to listening only
+ * on port1.
+ * @return <0 on error, never returns on success.
+ */
+int raw_udp4_rcv_loop(int rsock, int port1, int port2)
+{
+ static char buf[BUF_SIZE+1];
+ char* p;
+ char* tmp;
+ union sockaddr_union from;
+ union sockaddr_union to;
+ struct receive_info ri;
+ struct raw_filter rf;
+ int len;
+
+ /* this will not change */
+ from.sin.sin_family=AF_INET;
+ ri.bind_address=0;
+ ri.proto=PROTO_UDP;
+ ri.proto_reserved1=0;
+ ri.proto_reserved2=0;
+ /* set filter to match any address but with the specified port range */
+ memset(&rf, 0, sizeof(rf));
+ rf.dst.ip.af=AF_INET;
+ rf.dst.ip.len=4;
+ rf.dst.mask.af=AF_INET;
+ rf.dst.mask.len=4;
+ rf.proto=PROTO_UDP;
+ rf.port1=port1;
+ rf.port2=port2?port2:port1;
+ for(;;){
+ p=buf;
+ len=raw_udp4_recv(rsock, &p, BUF_SIZE, &from, &to, &rf);
+ if (len<0){
+ if (len==-1){
+ LOG(L_ERR, "ERROR: raw_udp4_rcv_loop:raw_udp4_recv: %s [%d]\n",
+ strerror(errno), errno);
+ if ((errno==EINTR)||(errno==EWOULDBLOCK))
+ continue;
+ else
+ goto error;
+ }else{
+ DBG("raw_udp4_rcv_loop: raw_udp4_recv error: %d\n", len);
+ continue;
+ }
+ }
+ /* we must 0-term the message */
+ p[len]=0;
+ ri.src_su=from;
+ su2ip_addr(&ri.src_ip, &from);
+ ri.src_port=su_getport(&from);
+ su2ip_addr(&ri.dst_ip, &to);
+ ri.dst_port=su_getport(&to);
+ /* sanity checks */
+ if (len<MIN_UDP_PACKET){
+ tmp=ip_addr2a(&ri.src_ip);
+ DBG("raw_udp4_rcv_loop: probing packet received from %s %d\n",
+ tmp, htons(ri.src_port));
+ continue;
+ }
+ if (ri.src_port==0){
+ tmp=ip_addr2a(&ri.src_ip);
+ LOG(L_INFO, "raw_udp4_rcv_loop: dropping 0 port packet from %s\n",
+ tmp);
+ continue;
+ }
+ tmp=ip_addr2a(&ri.src_ip);
+ DBG("raw_udp4_rcv_loop: received from %s:\n[%.*s]\n", tmp, len, p);
+ receive_msg(p, len, &ri);
+ }
+error:
+ return -1;
+}
+
+
+#endif /* USE_RAW_SOCKS */
diff --git a/raw_listener.h b/raw_listener.h
new file mode 100644
index 0000000..5bc2f58
--- /dev/null
+++ b/raw_listener.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/** raw socket udp listen functions.
+ * @file raw_listener.h
+ * @ingroup core
+ * Module: @ref core
+ */
+/*
+ * History:
+ * --------
+ * 2010-06-09 initial version (from older code) andrei
+ */
+
+#ifndef _raw_listener_h
+#define _raw_listener_h
+
+#include "../../ip_addr.h"
+
+
+/** default raw socket used for sending on udp ipv4 */
+struct struct_info* raw_udp_sendipv4;
+
+int raw_listener_init(struct socket_info* si, str* iface, int iphdr_incl);
+int raw_udp4_rcv_loop(int rsock, int port1, int port2);
+
+#endif /* _raw_listener_h */