Module: sip-router
Branch: 3.2
Commit: 118a79b43e87a44184088a57ddc81c5e6411750e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=118a79b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Mar 4 17:22:30 2012 +0100
core: added back the option to use name IDs for tos setting
- reported by Olle E. Johansson
(cherry picked from commit d3eb5d4f21f20a9bc5457642ad5fdcb9e764a02c)
---
cfg.y | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/cfg.y b/cfg.y
index 9317541..dae8fbf 100644
--- a/cfg.y
+++ b/cfg.y
@@ -111,6 +111,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <netinet/ip.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
@@ -1598,6 +1599,33 @@ assign_stm:
}
| MCAST_TTL EQUAL error { yyerror("number expected"); }
| TOS EQUAL NUMBER { tos=$3; }
+ | TOS EQUAL ID { if (strcasecmp($3,"IPTOS_LOWDELAY")) {
+ tos=IPTOS_LOWDELAY;
+ } else if (strcasecmp($3,"IPTOS_THROUGHPUT")) {
+ tos=IPTOS_THROUGHPUT;
+ } else if (strcasecmp($3,"IPTOS_RELIABILITY")) {
+ tos=IPTOS_RELIABILITY;
+#if defined(IPTOS_MINCOST)
+ } else if (strcasecmp($3,"IPTOS_MINCOST")) {
+ tos=IPTOS_MINCOST;
+#endif
+#if defined(IPTOS_LOWCOST)
+ } else if (strcasecmp($3,"IPTOS_LOWCOST")) {
+ tos=IPTOS_LOWCOST;
+#endif
+ } else {
+ yyerror("invalid tos value - allowed: "
+ "IPTOS_LOWDELAY,IPTOS_THROUGHPUT,"
+ "IPTOS_RELIABILITY"
+#if defined(IPTOS_LOWCOST)
+ ",IPTOS_LOWCOST"
+#endif
+#if !defined(IPTOS_MINCOST)
+ ",IPTOS_MINCOST"
+#endif
+ "\n");
+ }
+ }
| TOS EQUAL error { yyerror("number expected"); }
| PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
| PMTU_DISCOVERY error { yyerror("number expected"); }