Browse code

core: added back the option to use name IDs for tos setting

- reported by Olle E. Johansson

Daniel-Constantin Mierla authored on 04/03/2012 16:22:30
Showing 1 changed files
... ...
@@ -111,6 +111,7 @@
111 111
 #include <sys/types.h>
112 112
 #include <sys/socket.h>
113 113
 #include <netinet/in.h>
114
+#include <netinet/ip.h>
114 115
 #include <arpa/inet.h>
115 116
 #include <string.h>
116 117
 #include <errno.h>
... ...
@@ -1622,6 +1623,33 @@ assign_stm:
1622 1622
 	}
1623 1623
 	| MCAST_TTL EQUAL error { yyerror("number expected"); }
1624 1624
 	| TOS EQUAL NUMBER { tos=$3; }
1625
+	| TOS EQUAL ID { if (strcasecmp($3,"IPTOS_LOWDELAY")) {
1626
+			tos=IPTOS_LOWDELAY;
1627
+		} else if (strcasecmp($3,"IPTOS_THROUGHPUT")) {
1628
+			tos=IPTOS_THROUGHPUT;
1629
+		} else if (strcasecmp($3,"IPTOS_RELIABILITY")) {
1630
+			tos=IPTOS_RELIABILITY;
1631
+#if defined(IPTOS_MINCOST)
1632
+		} else if (strcasecmp($3,"IPTOS_MINCOST")) {
1633
+			tos=IPTOS_MINCOST;
1634
+#endif
1635
+#if defined(IPTOS_LOWCOST)
1636
+		} else if (strcasecmp($3,"IPTOS_LOWCOST")) {
1637
+			tos=IPTOS_LOWCOST;
1638
+#endif
1639
+		} else {
1640
+			yyerror("invalid tos value - allowed: "
1641
+				"IPTOS_LOWDELAY,IPTOS_THROUGHPUT,"
1642
+				"IPTOS_RELIABILITY"
1643
+#if defined(IPTOS_LOWCOST)
1644
+				",IPTOS_LOWCOST"
1645
+#endif
1646
+#if !defined(IPTOS_MINCOST)
1647
+				",IPTOS_MINCOST"
1648
+#endif
1649
+				"\n");
1650
+		}
1651
+	}
1625 1652
 	| TOS EQUAL error { yyerror("number expected"); }
1626 1653
 	| PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
1627 1654
 	| PMTU_DISCOVERY error { yyerror("number expected"); }