- feature: DSCP value for RTP packets defineable (by Nick
Vermeer, Internet Express)
This commit is contained in:
parent
2757a6bad6
commit
ab78ddb984
@ -1,5 +1,7 @@
|
|||||||
0.5.11
|
0.5.11
|
||||||
======
|
======
|
||||||
|
19-Apr-2005: - feature: DSCP value for RTP packets defineable (by Nick
|
||||||
|
Vermeer, Internet Express)
|
||||||
15-Apr-2005: - feature: auto-save registration table during operation
|
15-Apr-2005: - feature: auto-save registration table during operation
|
||||||
10-Apr-2005: - started DocBook documentation
|
10-Apr-2005: - started DocBook documentation
|
||||||
3-Apr-2005: - fix: changing public IP address
|
3-Apr-2005: - fix: changing public IP address
|
||||||
|
|||||||
@ -126,6 +126,22 @@ rtp_port_high = 7079
|
|||||||
#
|
#
|
||||||
rtp_timeout = 300
|
rtp_timeout = 300
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
# DSCP value for sent RTP packets
|
||||||
|
# The Differentiated Service Code Point is a selector for
|
||||||
|
# router's per-hop behaviours.
|
||||||
|
# RFC2598 defined a "expedited forwarding" service. This service
|
||||||
|
# is designed to allow ISPs to offer a service with attributes
|
||||||
|
# similar to a "leased line". This service offers the ULTIMATE IN LOW
|
||||||
|
# LOSS, LOW LATENCY AND LOW JITTER by ensuring that there is always
|
||||||
|
# sufficent room in output queues for the contracted expedited forwarding
|
||||||
|
# traffic.
|
||||||
|
# The Expedited Forwarding service has a DSCP of 46.
|
||||||
|
# Putting a 0 here means that siproxd does NOT set the DSCP field.
|
||||||
|
# Siproxd must be started as root for this to work.
|
||||||
|
#
|
||||||
|
rtp_dscp = 46
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Default Expiration timeout for Registrations
|
# Default Expiration timeout for Registrations
|
||||||
# If a REGISTER request does not contain an Expires header
|
# If a REGISTER request does not contain an Expires header
|
||||||
|
|||||||
@ -155,6 +155,7 @@ static int parse_config (FILE *configfile) {
|
|||||||
{ "rtp_port_high", TYP_INT4, &configuration.rtp_port_high },
|
{ "rtp_port_high", TYP_INT4, &configuration.rtp_port_high },
|
||||||
{ "rtp_timeout", TYP_INT4, &configuration.rtp_timeout },
|
{ "rtp_timeout", TYP_INT4, &configuration.rtp_timeout },
|
||||||
{ "rtp_proxy_enable", TYP_INT4, &configuration.rtp_proxy_enable },
|
{ "rtp_proxy_enable", TYP_INT4, &configuration.rtp_proxy_enable },
|
||||||
|
{ "rtp_dscp", TYP_INT4, &configuration.rtp_dscp },
|
||||||
{ "user", TYP_STRING, &configuration.user },
|
{ "user", TYP_STRING, &configuration.user },
|
||||||
{ "chrootjail", TYP_STRING, &configuration.chrootjail },
|
{ "chrootjail", TYP_STRING, &configuration.chrootjail },
|
||||||
{ "hosts_allow_reg", TYP_STRING, &configuration.hosts_allow_reg },
|
{ "hosts_allow_reg", TYP_STRING, &configuration.hosts_allow_reg },
|
||||||
|
|||||||
@ -395,6 +395,7 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
|||||||
int sock, port;
|
int sock, port;
|
||||||
int freeidx;
|
int freeidx;
|
||||||
int sts=STS_SUCCESS;
|
int sts=STS_SUCCESS;
|
||||||
|
int tos;
|
||||||
osip_call_id_t cid;
|
osip_call_id_t cid;
|
||||||
|
|
||||||
|
|
||||||
@ -566,6 +567,35 @@ int rtp_relay_start_fwd (osip_call_id_t *callid, char *client_id,
|
|||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set DSCP value, need to be ROOT */
|
||||||
|
if (configuration.rtp_dscp) {
|
||||||
|
int uid,euid;
|
||||||
|
uid=getuid();
|
||||||
|
euid=geteuid();
|
||||||
|
DEBUGC(DBCLASS_RTP,"uid=%i, euid=%i", uid, euid);
|
||||||
|
if (uid != euid) seteuid(0);
|
||||||
|
if (geteuid()==0) {
|
||||||
|
/* now I'm root */
|
||||||
|
if (!(configuration.rtp_dscp & ~0x3f)) {
|
||||||
|
tos = (configuration.rtp_dscp << 2) & 0xff;
|
||||||
|
if(setsockopt(sock, SOL_IP, IP_TOS, &tos, sizeof(tos))) {
|
||||||
|
ERROR("rtp_relay_start_fwd: setsockopt() failed while "
|
||||||
|
"setting DSCP value: ", strerror(errno));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ERROR("rtp_relay_start_fwd: Invalid DSCP value %d",
|
||||||
|
configuration.rtp_dscp);
|
||||||
|
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* could not get root */
|
||||||
|
WARN("siproxd not started as root - cannot set DSCP value");
|
||||||
|
configuration.rtp_dscp = 0; /* inhibit further attempts */
|
||||||
|
}
|
||||||
|
/* drop privileges */
|
||||||
|
if (uid != euid) seteuid(euid);
|
||||||
|
}
|
||||||
|
|
||||||
/* write entry into rtp_proxytable slot (freeidx) */
|
/* write entry into rtp_proxytable slot (freeidx) */
|
||||||
rtp_proxytable[freeidx].rtp_rx_sock=sock;
|
rtp_proxytable[freeidx].rtp_rx_sock=sock;
|
||||||
|
|
||||||
|
|||||||
@ -67,6 +67,7 @@ struct siproxd_config {
|
|||||||
int rtp_port_low;
|
int rtp_port_low;
|
||||||
int rtp_port_high;
|
int rtp_port_high;
|
||||||
int rtp_timeout;
|
int rtp_timeout;
|
||||||
|
int rtp_dscp;
|
||||||
int rtp_proxy_enable;
|
int rtp_proxy_enable;
|
||||||
char *user;
|
char *user;
|
||||||
char *chrootjail;
|
char *chrootjail;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user