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 1623
 	}
1623 1624
 	| MCAST_TTL EQUAL error { yyerror("number expected"); }
1624 1625
 	| TOS EQUAL NUMBER { tos=$3; }
1626
+	| TOS EQUAL ID { if (strcasecmp($3,"IPTOS_LOWDELAY")) {
1627
+			tos=IPTOS_LOWDELAY;
1628
+		} else if (strcasecmp($3,"IPTOS_THROUGHPUT")) {
1629
+			tos=IPTOS_THROUGHPUT;
1630
+		} else if (strcasecmp($3,"IPTOS_RELIABILITY")) {
1631
+			tos=IPTOS_RELIABILITY;
1632
+#if defined(IPTOS_MINCOST)
1633
+		} else if (strcasecmp($3,"IPTOS_MINCOST")) {
1634
+			tos=IPTOS_MINCOST;
1635
+#endif
1636
+#if defined(IPTOS_LOWCOST)
1637
+		} else if (strcasecmp($3,"IPTOS_LOWCOST")) {
1638
+			tos=IPTOS_LOWCOST;
1639
+#endif
1640
+		} else {
1641
+			yyerror("invalid tos value - allowed: "
1642
+				"IPTOS_LOWDELAY,IPTOS_THROUGHPUT,"
1643
+				"IPTOS_RELIABILITY"
1644
+#if defined(IPTOS_LOWCOST)
1645
+				",IPTOS_LOWCOST"
1646
+#endif
1647
+#if !defined(IPTOS_MINCOST)
1648
+				",IPTOS_MINCOST"
1649
+#endif
1650
+				"\n");
1651
+		}
1652
+	}
1625 1653
 	| TOS EQUAL error { yyerror("number expected"); }
1626 1654
 	| PMTU_DISCOVERY EQUAL NUMBER { pmtu_discovery=$3; }
1627 1655
 	| PMTU_DISCOVERY error { yyerror("number expected"); }