diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-04-30 16:16:26 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-04-30 16:16:26 +0000 |
commit | b419fc1134c7cb0b0ba92428185d3546be98cf11 (patch) | |
tree | d7bac5beb193490f4242d9a69cad3457727ba5d8 /channels/chan_iax2.c | |
parent | a91f9b138db6eecfe65b29f788c82a688526b9cf (diff) |
Add support for setting the CoS for VLAN traffic (802.1p) in Linux. The
file doc/qos.tex has been updated to document the new functionality.
(issue #9540, patch submitted by IgorG)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@62457 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 6b943ea58..a250899a6 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -178,6 +178,8 @@ static int iaxdefaulttimeout = 5; /* Default to wait no more than 5 seconds for static unsigned int tos = 0; +static unsigned int cos = 0; + static int min_reg_expire; static int max_reg_expire; @@ -8538,7 +8540,7 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr) sin.sin_addr.s_addr = INADDR_ANY; if (ast_netsock_find(netsock, &sin)) { sin.sin_addr.s_addr = orig_saddr; - sock = ast_netsock_bind(outsock, io, srcaddr, port, tos, socket_read, NULL); + sock = ast_netsock_bind(outsock, io, srcaddr, port, tos, cos, socket_read, NULL); if (sock) { sockfd = ast_netsock_sockfd(sock); ast_netsock_unref(sock); @@ -9204,7 +9206,13 @@ static int set_config(char *config_file, int reload) tosval = ast_variable_retrieve(cfg, "general", "tos"); if (tosval) { if (ast_str2tos(tosval, &tos)) - ast_log(LOG_WARNING, "Invalid tos value, see doc/ip-tos.txt for more information.\n"); + ast_log(LOG_WARNING, "Invalid tos value, see doc/qos.tex for more information.\n"); + } + /* Seed initial cos value */ + tosval = ast_variable_retrieve(cfg, "general", "cos"); + if (tosval) { + if (ast_str2cos(tosval, &cos)) + ast_log(LOG_WARNING, "Invalid cos value, see doc/qos.tex for more information.\n"); } while(v) { if (!strcasecmp(v->name, "bindport")){ @@ -9272,7 +9280,7 @@ static int set_config(char *config_file, int reload) if (reload) { ast_log(LOG_NOTICE, "Ignoring bindaddr on reload\n"); } else { - if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, tos, socket_read, NULL))) { + if (!(ns = ast_netsock_bind(netsock, io, v->value, portno, tos, cos, socket_read, NULL))) { ast_log(LOG_WARNING, "Unable apply binding to '%s' at line %d\n", v->value, v->lineno); } else { if (option_verbose > 1) { @@ -9379,7 +9387,10 @@ static int set_config(char *config_file, int reload) ast_context_create(NULL, regcontext, "IAX2"); } else if (!strcasecmp(v->name, "tos")) { if (ast_str2tos(v->value, &tos)) - ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/ip-tos.txt for more information.'\n", v->lineno); + ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.'\n", v->lineno); + } else if (!strcasecmp(v->name, "cos")) { + if (ast_str2cos(v->value, &cos)) + ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.'\n", v->lineno); } else if (!strcasecmp(v->name, "accountcode")) { ast_copy_string(accountcode, v->value, sizeof(accountcode)); } else if (!strcasecmp(v->name, "mohinterpret")) { @@ -9409,7 +9420,7 @@ static int set_config(char *config_file, int reload) } if (defaultsockfd < 0) { - if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, tos, socket_read, NULL))) { + if (!(ns = ast_netsock_bind(netsock, io, "0.0.0.0", portno, tos, cos, socket_read, NULL))) { ast_log(LOG_ERROR, "Unable to create network socket: %s\n", strerror(errno)); } else { if (option_verbose > 1) |