Skip to content

Commit

Permalink
Merge remote branch 'origin/master' into tmp/hpw_curl_improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugh Waite committed Jan 21, 2016
2 parents eb067dd + 1d28d1f commit 5ff7882
Show file tree
Hide file tree
Showing 153 changed files with 6,437 additions and 1,324 deletions.
4 changes: 2 additions & 2 deletions Makefile.defs
Expand Up @@ -97,7 +97,7 @@ INSTALL_FLAVOUR=$(FLAVOUR)
VERSION = 4
PATCHLEVEL = 4
SUBLEVEL = 0
EXTRAVERSION = -dev7
EXTRAVERSION = -dev8

# memory manager switcher
# 0 - f_malloc (fast malloc)
Expand Down Expand Up @@ -1785,7 +1785,7 @@ ifeq ($(CC_NAME), suncc)
endif
OLD_SOLARIS= $(shell echo "$(OSREL)" | \
sed -e 's/^5\.[0-6][^0-9]*$$/yes/' )
LIBS+= -L$(LOCALBASE)/lib -lxnet -lnsl
LIBS+= -L$(LOCALBASE)/lib -lxnet -lsocket -lnsl
ifeq ($(OLD_SOLARIS), yes)
LIBS+=-lposix4
else
Expand Down
4 changes: 2 additions & 2 deletions Makefile.groups
Expand Up @@ -15,7 +15,7 @@ mod_list_basic=async auth benchmark blst cfg_rpc cfgutils corex counters \
nat_traversal nathelper path pike pv ratelimit rr rtimer \
rtpproxy sanity sdpops siputils sl statistics textops \
textopsx tm tmx topoh xlog rtpengine stun sipt tcpops \
auth_xkeys smsops tsilo
auth_xkeys smsops tsilo cfgt

# - extra used modules, with no extra dependency
mod_list_extra=avp auth_diameter call_control dmq domainpolicy msrp pdb \
Expand Down Expand Up @@ -90,7 +90,7 @@ mod_list_purple=purple
mod_list_memcached=memcached

# - modules depending on openssl library
mod_list_tlsdeps=auth_identity tls
mod_list_tlsdeps=auth_identity crypto tls

# - modules depending on openssl library
mod_list_outbound=outbound
Expand Down
16 changes: 15 additions & 1 deletion dprint.c
Expand Up @@ -90,13 +90,27 @@ int str2facility(char *s)
{
int i;

for( i=0; str_fac[i] ; i++) {
for (i=0; str_fac[i]; i++) {
if (!strcasecmp(s,str_fac[i]))
return int_fac[i];
}
return -1;
}

char* facility2str(int fl, int *len)
{
int i;

for (i=0; str_fac[i]; i++) {
if (fl == int_fac[i]) {
*len = strlen(str_fac[i]);
return str_fac[i];
}
}

return NULL;
}

/* fixup function for log_facility cfg parameter */
int log_facility_fixup(void *handle, str *gname, str *name, void **val)
{
Expand Down
2 changes: 2 additions & 0 deletions dprint.h
Expand Up @@ -160,6 +160,8 @@ extern volatile int dprint_crit;
#endif

int str2facility(char *s);
char* facility2str(int fl, int *len);

int log_facility_fixup(void *handle, str *gname, str *name, void **val);

void dprint_color(int level);
Expand Down
39 changes: 39 additions & 0 deletions events.c
Expand Up @@ -165,6 +165,21 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
_sr_events_list.rcv_nosip = f;
else return -1;
break;
case SREV_TCP_CLOSED:
if(_sr_events_list.tcp_closed==0)
_sr_events_list.tcp_closed = f;
else return -1;
break;
case SREV_NET_DATA_RECV:
if(_sr_events_list.net_data_recv==0)
_sr_events_list.net_data_recv = f;
else return -1;
break;
case SREV_NET_DATA_SEND:
if(_sr_events_list.net_data_send==0)
_sr_events_list.net_data_send = f;
else return -1;
break;
default:
return -1;
}
Expand Down Expand Up @@ -284,6 +299,24 @@ int sr_event_exec(int type, void *data)
ret = _sr_events_list.rcv_nosip(data);
return ret;
} else return 1;
case SREV_TCP_CLOSED:
if(unlikely(_sr_events_list.tcp_closed!=0))
{
ret = _sr_events_list.tcp_closed(data);
return ret;
} else return 1;
case SREV_NET_DATA_RECV:
if(unlikely(_sr_events_list.net_data_recv!=0))
{
ret = _sr_events_list.net_data_recv(data);
return ret;
} else return 1;
case SREV_NET_DATA_SEND:
if(unlikely(_sr_events_list.net_data_send!=0))
{
ret = _sr_events_list.net_data_send(data);
return ret;
} else return 1;
default:
return -1;
}
Expand Down Expand Up @@ -319,6 +352,12 @@ int sr_event_enabled(int type)
return (_sr_events_list.stun_in!=0)?1:0;
case SREV_RCV_NOSIP:
return (_sr_events_list.rcv_nosip!=0)?1:0;
case SREV_TCP_CLOSED:
return (_sr_events_list.tcp_closed!=0)?1:0;
case SREV_NET_DATA_RECV:
return (_sr_events_list.net_data_recv!=0)?1:0;
case SREV_NET_DATA_SEND:
return (_sr_events_list.net_data_send!=0)?1:0;
}
return 0;
}
Expand Down
6 changes: 6 additions & 0 deletions events.h
Expand Up @@ -34,6 +34,9 @@
#define SREV_TCP_WS_FRAME_IN 10
#define SREV_TCP_WS_FRAME_OUT 11
#define SREV_STUN_IN 12
#define SREV_TCP_CLOSED 13
#define SREV_NET_DATA_RECV 14
#define SREV_NET_DATA_SEND 15

#define SREV_CB_LIST_SIZE 3

Expand All @@ -52,6 +55,9 @@ typedef struct sr_event_cb {
sr_event_cb_f tcp_ws_frame_out;
sr_event_cb_f stun_in;
sr_event_cb_f rcv_nosip;
sr_event_cb_f tcp_closed;
sr_event_cb_f net_data_recv;
sr_event_cb_f net_data_send;
} sr_event_cb_t;

void sr_event_cb_init(void);
Expand Down
22 changes: 20 additions & 2 deletions forward.h
Expand Up @@ -56,6 +56,7 @@ enum ss_mismatch {
SS_MISMATCH_MCAST /* mcast forced send socket */
};


struct socket_info* get_send_socket2(struct socket_info* force_send_socket,
union sockaddr_union* su, int proto,
enum ss_mismatch* mismatch);
Expand Down Expand Up @@ -97,6 +98,7 @@ void forward_set_send_info(int v);

int is_check_self_func_list_set(void);

#define msg_send(_dst, _buf, _len) msg_send_buffer((_dst), (_buf), (_len), 0)

/* params:
* dst = struct dest_info containing:
Expand All @@ -109,12 +111,17 @@ int is_check_self_func_list_set(void);
* (useful for sending replies on the same connection as the request
* that generated them; use 0 if you don't want this)
* buf, len = buffer
* flags = control internal behavior
* * 1 - skip executing event SREV_NET_DATA_OUT
* returns: 0 if ok, -1 on error*/

static inline int msg_send(struct dest_info* dst, char* buf, int len)
static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
int flags)
{
struct dest_info new_dst;
str outb;
sr_net_info_t netinfo;

#ifdef USE_TCP
int port;
struct ip_addr ip;
Expand All @@ -127,7 +134,9 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)

outb.s = buf;
outb.len = len;
sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
if(!(flags&1)) {
sr_event_exec(SREV_NET_DATA_OUT, (void*)&outb);
}

if(outb.s==NULL) {
LM_ERR("failed to update outgoing buffer\n");
Expand Down Expand Up @@ -265,6 +274,15 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
}
ret = 0;
done:

if(!(flags&1)) {
memset(&netinfo, 0, sizeof(sr_net_info_t));
netinfo.data.s = outb.s;
netinfo.data.len = outb.len;
netinfo.dst = dst;
sr_event_exec(SREV_NET_DATA_SEND, (void*)&netinfo);
}

if(outb.s != buf)
pkg_free(outb.s);
return ret;
Expand Down
5 changes: 5 additions & 0 deletions ip_addr.h
Expand Up @@ -136,6 +136,11 @@ struct receive_info{
/* no need for dst_su yet */
};

typedef struct sr_net_info {
str data;
struct dest_info* dst;
struct receive_info* rcv;
} sr_net_info_t;

/* send flags */
#define SND_F_FORCE_CON_REUSE 1 /* reuse an existing connection or fail */
Expand Down
16 changes: 15 additions & 1 deletion lib/srdb1/schema/uacreg.xml
Expand Up @@ -9,7 +9,7 @@

<table id="uacreg" xmlns:db="http://docbook.org/ns/docbook">
<name>uacreg</name>
<version>1</version>
<version>2</version>
<type db="mysql">&MYSQL_TABLE_TYPE;</type>
<description>
<db:para>This table is used by theuac module to load user details for remote server registration: &KAMAILIO_MOD_DOC;uac.html
Expand Down Expand Up @@ -105,6 +105,20 @@
<description>Expiration time (in seconds, 0 means disabled)</description>
</column>

<column id="flags">
<name>flags</name>
<type>int</type>
<default>0</default>
<description>Flags to control the behavior</description>
</column>

<column id="reg_delay">
<name>reg_delay</name>
<type>int</type>
<default>0</default>
<description>Initial registration delay</description>
</column>

<index>
<name>l_uuid_idx</name>
<colref linkend="l_uuid"/>
Expand Down
2 changes: 2 additions & 0 deletions modules/auth_radius/authrad_mod.c
Expand Up @@ -66,6 +66,7 @@ static int service_type = -1;

int use_ruri_flag = -1;
int ar_radius_avps_mode = 0;
int append_realm_to_username = 1;

static char *auth_extra_str = 0;
struct extra_attr *auth_extra = 0;
Expand Down Expand Up @@ -95,6 +96,7 @@ static param_export_t params[] = {
{"use_ruri_flag", INT_PARAM, &use_ruri_flag },
{"auth_extra", PARAM_STRING, &auth_extra_str },
{"radius_avps_mode", INT_PARAM, &ar_radius_avps_mode },
{"append_realm_to_username", INT_PARAM, &append_realm_to_username },
{0, 0, 0}
};

Expand Down
1 change: 1 addition & 0 deletions modules/auth_radius/authrad_mod.h
Expand Up @@ -41,6 +41,7 @@ extern struct extra_attr *auth_extra;

extern int use_ruri_flag;
extern int ar_radius_avps_mode;
extern int append_realm_to_username;

extern auth_api_s_t auth_api;

Expand Down
5 changes: 5 additions & 0 deletions modules/auth_radius/doc/auth_radius.xml
Expand Up @@ -38,6 +38,11 @@
<surname>Janak</surname>
<email>jan@iptel.org</email>
</editor>
<editor>
<firstname>Phil</firstname>
<surname>Lavin</surname>
<email>phil.lavin@synety.com</email>
</editor>
</authorgroup>
<copyright>
<year>2002</year>
Expand Down
17 changes: 17 additions & 0 deletions modules/auth_radius/doc/auth_radius_admin.xml
Expand Up @@ -206,6 +206,23 @@ modparam("auth_radius", "radius_avps_mode", 1)
</programlisting>
</example>
</section>
<section id="auth_radius.p.append_realm_to_username">
<title><varname>append_realm_to_username</varname> (integer)</title>
<para>
If set to 1, the username passed to the RADIUS server will have the
digest realm appended to it, if no domain is provided in the digest
username.
</para>
<para>
Default value is 1.
</para>
<example>
<title><varname>append_realm_to_username</varname> parameter usage</title>
<programlisting format="linespecific">
modparam("auth_radius", "append_realm_to_username", 0)
</programlisting>
</example>
</section>
</section>

<section>
Expand Down
2 changes: 1 addition & 1 deletion modules/auth_radius/sterman.c
Expand Up @@ -243,7 +243,7 @@ int radius_authorize_sterman(struct sip_msg* _msg, dig_cred_t* _cred, str* _meth
* Add all the user digest parameters according to the qop defined.
* Most devices tested only offer support for the simplest digest.
*/
if (_cred->username.domain.len) {
if (_cred->username.domain.len || !append_realm_to_username) {
if (!rc_avpair_add(rh, &send, attrs[A_USER_NAME].v, _cred->username.whole.s, _cred->username.whole.len, 0)) {
LM_ERR("unable to add User-Name attribute\n");
goto err;
Expand Down
10 changes: 9 additions & 1 deletion modules/carrierroute/cr_fifo.c
Expand Up @@ -490,7 +490,15 @@ static int get_fifo_opts(str * buf, fifo_opt_t * opts, unsigned int opt_set[]) {
LM_DBG("token %.*s", opt_argv[i].len, opt_argv[i].s);
if (opt_argv[i].len >= 1) {
switch(*opt_argv[i].s) {
case '-': switch(opt_argv[i].s[1]) {
case '-':
/* -{OPTION}{PARAMETER} is not allowed */
if (opt_argv[i].len != 2) {
FIFO_ERR(E_WRONGOPT);
LM_DBG("Unknown option: %.*s\n", opt_argv[i].len, opt_argv[i].s);
return -1;
}

switch(opt_argv[i].s[1]) {
case OPT_DOMAIN_CHR:
op = OPT_DOMAIN;
used_opts |= O_DOMAIN;
Expand Down
2 changes: 2 additions & 0 deletions modules/cdp/routing.c
Expand Up @@ -89,7 +89,9 @@ peer* get_first_connected_route(cdp_session_t* cdp_session, routing_entry *r, in
/*try and find an already used peer for this session - sticky*/
if ((cdp_session->sticky_peer_fqdn.len > 0) && cdp_session->sticky_peer_fqdn.s) {
//we have an old sticky peer. let's make sure it's up and connected before we use it.
AAASessionsUnlock(cdp_session->hash); /*V1.1 - Don't attempt to hold two locks at same time */
p = get_peer_by_fqdn(&cdp_session->sticky_peer_fqdn);
AAASessionsLock(cdp_session->hash); /*V1.1 - As we were...no call seems to pass cdp_session unlocked */
if (p && !p->disabled && (p->state == I_Open || p->state == R_Open) && peer_handles_application(p, app_id, vendor_id)) {
p->last_selected = time(NULL);
LM_DBG("Found a sticky peer [%.*s] for this session - re-using\n", p->fqdn.len, p->fqdn.s);
Expand Down
17 changes: 17 additions & 0 deletions modules/cfgt/Makefile
@@ -0,0 +1,17 @@
#
# cfgt module makefile
#
# WARNING: do not run this directly, it should be run by the master Makefile

include ../../Makefile.defs
auto_gen=
NAME=cfgt.so
LIBS=

DEFS+=-DKAMAILIO_MOD_INTERFACE

SERLIBPATH=../../lib
SER_LIBS+=$(SERLIBPATH)/kcore/kcore
SER_LIBS+=$(SERLIBPATH)/srutils/srutils

include ../../Makefile.modules

0 comments on commit 5ff7882

Please sign in to comment.