Hi all,
i'll present in the next week the Kamailio project at the FFG 2009 conference.
Topics of my talk are:
- overview about Kamailio
- applications and usage scenarios
- new and interesting stuff in the 1.5.0 release
- future developments, the sip-router project
Date: Thursday, 12.03.2009
Place: Karlsruhe, Germany
Link to the abstract (in german as the talk will be also held in german):
http://www.guug.de/veranstaltungen/ffg2009/abstracts.html#3_2_1
More information about the event:
http://www.guug.de/veranstaltungen/ffg2009/
I'll provide the slides and eventual some notes after the talk as usual.
Cheers,
Henning
Hi, a current limitation in Kamailio (and AFAIK also in SER) is that TCP
childs block waiting for the connection being established or ended.
For example, if we run Kamailio with "tcp_children=8" and receive 8 "hacked"
INVITE's via UDP like:
INVITE sip:hello@non.responding.host1;transport=TCP SIP/2.0
INVITE sip:hello@non.responding.host2;transport=TCP SIP/2.0
INVITE sip:hello@non.responding.host3;transport=TCP SIP/2.0
...
INVITE sip:hello@non.responding.host2;transport=TCP SIP/2.0
then Kamailio will have all their TCP childs busy waiting for 8 outgoing TCP
connections to timeout. If a new request requires TCP it must wait for long
time until one of the TCP childs becomes available.
Of course this can be very easily hackeable by an attacker.
To improve it, a TCP child should not block waiting for the TCP connection to
end.
Perhaps I'm wrong (I will check it in a testing escenario soon). If not, is it
planned to improve it?
Thanks a lot.
--
Iñaki Baz Castillo
Module: sip-router
Branch: janakj/kcore
Commit: 15bb433960da81e252ed25973a27897bc96228c3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=15bb433…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Mar 3 00:36:29 2009 +0100
Kamailio functions and macros missing in sip-router/ut.h
This is the supplemental file to sip-router/ut.h, the contents of this
file was taken from kamailio/ut.h and it contains only functions,
variables and defines which are missing in sip-router/ut.h
Kamailio modules that included ut.h should be modified to include
"lib/kcore/km_ut.h" _in addition to_ "../../ut.h"
---
lib/kcore/km_ut.h | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/lib/kcore/km_ut.h b/lib/kcore/km_ut.h
new file mode 100644
index 0000000..43fc11b
--- /dev/null
+++ b/lib/kcore/km_ut.h
@@ -0,0 +1,120 @@
+/*
+ *$Id$
+ *
+ * - various general purpose functions
+ *
+ * Copyright (C) 2001-2003 FhG Fokus
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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
+ *
+ */
+
+/*!
+ * \file
+ * \brief Various utility functions, mostly related to string handling
+ */
+
+#ifndef _KM_UT_H
+#define _KM_UT_H
+
+#include "../../ut.h"
+
+#ifndef MIN
+#define MIN(a, b) (a<b?a:b)
+#endif
+#ifndef MAX
+#define MAX(a, b) (a>b?a:b)
+#endif
+
+
+#define append_str(_dest,_src,_len) \
+ do{ \
+ memcpy( (_dest) , (_src) , (_len) ); \
+ (_dest) += (_len) ; \
+ }while(0); \
+
+
+
+/* INTeger-TO-Buffer-STRing : convers an unsigned long to a string
+ * IMPORTANT: the provided buffer must be at least INT2STR_MAX_LEN size !! */
+static inline char* int2bstr(unsigned long l, char *s, int* len)
+{
+ int i;
+ i=INT2STR_MAX_LEN-2;
+ s[INT2STR_MAX_LEN-1]=0;
+ /* null terminate */
+ do{
+ s[i]=l%10+'0';
+ i--;
+ l/=10;
+ }while(l && (i>=0));
+ if (l && (i<0)){
+ LM_CRIT("overflow error\n");
+ }
+ if (len) *len=(INT2STR_MAX_LEN-2)-i;
+ return &s[i+1];
+}
+
+
+inline static int hexstr2int(char *c, int len, unsigned int *val)
+{
+ char *pc;
+ int r;
+ char mychar;
+
+ r=0;
+ for (pc=c; pc<c+len; pc++) {
+ r <<= 4 ;
+ mychar=*pc;
+ if ( mychar >='0' && mychar <='9') r+=mychar -'0';
+ else if (mychar >='a' && mychar <='f') r+=mychar -'a'+10;
+ else if (mychar >='A' && mychar <='F') r+=mychar -'A'+10;
+ else return -1;
+ }
+ *val = r;
+ return 0;
+}
+
+
+
+/*
+ * Convert a str (base 10 or 16) into integer
+ */
+static inline int strno2int( str *val, unsigned int *mask )
+{
+ /* hexa or decimal*/
+ if (val->len>2 && val->s[0]=='0' && val->s[1]=='x') {
+ return hexstr2int( val->s+2, val->len-2, mask);
+ } else {
+ return str2int( val, mask);
+ }
+}
+
+
+
+/*! right and left space trimming */
+#define trim_spaces_lr(_s_) \
+ do{ \
+ for(;(_s_).s[(_s_).len-1]==' ';(_s_).s[--(_s_).len]=0); \
+ for(;(_s_).s[0]==' ';(_s_).s=(_s_).s+1,(_s_).len--); \
+ \
+ } \
+ while(0); \
+
+
+
+#endif /* _KM_UT_H */
Module: sip-router
Branch: janakj/kcore
Commit: bf3d622b425765640287b00f90755709a0d66007
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bf3d622…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Mar 3 00:40:19 2009 +0100
Files local_route.[ch] from kamailio core add to libkcore
Kamailio modules that include "../../local_route.h" should be updated
to include "../../lib/kcore/local_route.h" instead.
---
lib/kcore/local_route.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++
lib/kcore/local_route.h | 42 +++++++++++++++++++++++++
2 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/lib/kcore/local_route.c b/lib/kcore/local_route.c
new file mode 100644
index 0000000..ba2f156
--- /dev/null
+++ b/lib/kcore/local_route.c
@@ -0,0 +1,78 @@
+/*
+ *$Id: local_route.c 5132 2008-10-24 11:49:14Z miconda $
+ *
+ * Copyright (C) 2001-2003 FhG Fokus
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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
+ */
+
+/*!
+ * \file
+ * \brief Local Route related functions.
+ */
+
+#include <string.h>
+
+#include "../../dprint.h"
+#include "../../mem/mem.h"
+
+#include "local_route.h"
+
+static lrt_info_t* lrt_info_list = 0;
+static int lrt_info_no = 0;
+
+
+int lrt_do_init_child(void)
+{
+ int i;
+
+ for ( i=0; i< lrt_info_no; i++ )
+ {
+ if ( lrt_info_list[i].init && lrt_info_list[i].init()!=0 )
+ {
+ LM_ERR("failed to init child for local route <%s>\n",
+ lrt_info_list[i].name);
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int register_lrt_info(lrt_info_t *lrti)
+{
+ lrt_info_t *l;
+
+ if(lrti==NULL || lrti->name==NULL || lrti->init==NULL)
+ return 0;
+
+ l = (lrt_info_t*)pkg_realloc(lrt_info_list,
+ (lrt_info_no+1)*sizeof(lrt_info_t));
+ if (l==0)
+ {
+ LM_ERR("no more pkg memory\n");
+ return -1;
+ }
+
+ lrt_info_list = l;
+ lrt_info_list[lrt_info_no].init = lrti->init;
+ lrt_info_list[lrt_info_no].name = lrti->name;
+ lrt_info_no++;
+
+ return 0;
+}
+
+
diff --git a/lib/kcore/local_route.h b/lib/kcore/local_route.h
new file mode 100644
index 0000000..fe1da2c
--- /dev/null
+++ b/lib/kcore/local_route.h
@@ -0,0 +1,42 @@
+/*
+ *$Id: local_route.h 5132 2008-10-24 11:49:14Z miconda $
+ *
+ * Copyright (C) 2001-2003 FhG Fokus
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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
+ */
+
+/*!
+ * \file
+ * \brief Local Route related functions.
+ */
+
+#ifndef _LOCAL_ROUTE_H_
+#define _LOCAL_ROUTE_H_
+
+typedef int (lrt_child_init_f)(void);
+
+typedef struct _lrt_info {
+ char *name;
+ lrt_child_init_f *init;
+} lrt_info_t;
+
+int lrt_do_init_child(void);
+int register_lrt_info(lrt_info_t *lrti);
+
+#endif
+
Module: sip-router
Branch: janakj/kcore
Commit: 02363feec26cc2ec858badf0ac30c97d4fbb398f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=02363fe…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Mar 3 00:51:43 2009 +0100
File radius.h from kamailio core added to libkcore
This file was originally located at kamailio/radius.h, since
the file is missing from the sip router core we need to put
it in the library.
---
lib/kcore/radius.h | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/lib/kcore/radius.h b/lib/kcore/radius.h
new file mode 100644
index 0000000..92a44af
--- /dev/null
+++ b/lib/kcore/radius.h
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2001-2003 FhG Fokus
+ *
+ * This file is part of Kamailio, a free SIP server.
+ *
+ * Kamailio 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
+ *
+ * Kamailio 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
+ *
+ * WARNING: Don't forget to update the dictionary if you update this file !!!
+ *
+ * History:
+ * --------
+ * 2005-06-28 multi leg call support added (bogdan)
+ * 2008-09-03 added type field to attribute structure, which is set
+ * during INIT_AV.
+ *
+ */
+
+/*!
+ * \file
+ * \brief Radius support
+ */
+
+
+#ifndef _RADIUS_CORE_H
+#define _RADIUS_CORE_H
+
+#ifndef USE_FREERADIUS
+ #include <radiusclient-ng.h>
+ #define DEFAULT_RADIUSCLIENT_CONF \
+ "/usr/local/etc/radiusclient-ng/radiusclient.conf"
+#else
+ #include <freeradius-client.h>
+ #define DEFAULT_RADIUSCLIENT_CONF ""
+#endif
+
+
+struct attr {
+ const char *n;
+ int v;
+ unsigned int t; /* type of attribute */
+};
+
+struct val {
+ const char *n;
+ int v;
+};
+
+#define A_USER_NAME 0
+#define A_SERVICE_TYPE 1
+#define A_CALLED_STATION_ID 2
+#define A_CALLING_STATION_ID 3
+#define A_ACCT_STATUS_TYPE 4
+#define A_ACCT_SESSION_ID 5
+#define A_SIP_METHOD 6
+#define A_SIP_RESPONSE_CODE 7
+#define A_SIP_CSEQ 8
+#define A_SIP_TO_TAG 9
+#define A_SIP_FROM_TAG 10
+#define A_DIGEST_RESPONSE 11
+#define A_DIGEST_ATTRIBUTES 12
+#define A_SIP_URI_USER 13
+#define A_SIP_URI_HOST 14
+#define A_DIGEST_REALM 15
+#define A_DIGEST_NONCE 16
+#define A_DIGEST_METHOD 17
+#define A_DIGEST_URI 18
+#define A_DIGEST_QOP 19
+#define A_DIGEST_ALGORITHM 20
+#define A_DIGEST_BODY_DIGEST 21
+#define A_DIGEST_CNONCE 22
+#define A_DIGEST_NONCE_COUNT 23
+#define A_DIGEST_USER_NAME 24
+#define A_SIP_GROUP 25
+#define A_CISCO_AVPAIR 26
+#define A_SIP_AVP 27
+#define A_TIME_STAMP 28
+#define A_SIP_CALL_ID 29
+#define A_SIP_REQUEST_HASH 30
+#define A_MAX 31
+
+#define V_STATUS_START 0
+#define V_STATUS_STOP 1
+#define V_STATUS_FAILED 2
+#define V_CALL_CHECK 3
+#define V_SIP_SESSION 4
+#define V_GROUP_CHECK 5
+#define V_SIP_CALLER_AVPS 6
+#define V_SIP_CALLEE_AVPS 7
+#define V_SIP_VERIFY_DESTINATION 8
+#define V_SIP_VERIFY_SOURCE 9
+#define V_MAX 10
+
+#define INIT_AV(rh, at, nr_at, vl, nr_vl, fn, e1, e2) \
+{ \
+ int i; \
+ DICT_ATTR *da; \
+ DICT_VALUE *dv; \
+ \
+ for (i = 0; i < nr_at; i++) { \
+ if (at[i].n == NULL) \
+ continue; \
+ da = rc_dict_findattr(rh, at[i].n); \
+ if (da == NULL) { \
+ LM_ERR("%s: can't get code for the " \
+ "%s attribute\n", fn, at[i].n); \
+ return e1; \
+ } \
+ at[i].v = da->value; \
+ at[i].t = da->type; \
+ } \
+ for (i = 0; i < nr_vl; i++) { \
+ if (vl[i].n == NULL) \
+ continue; \
+ dv = rc_dict_findval(rh, vl[i].n); \
+ if (dv == NULL) { \
+ LM_ERR("%s: can't get code for the " \
+ "%s attribute value\n", fn, vl[i].n);\
+ return e2; \
+ } \
+ vl[i].v = dv->value; \
+ } \
+}
+
+#endif