[Olsr-dev] Using IP TOS

Teco Boot (spam-protected)
Tue Sep 13 23:18:45 CEST 2011


OK, I have something working meeting todays QoS handling.
TOS config parameter is unchanged (TosValue).
Range is 0 - 252, must be multiple of 4, because ECN-bits must be 
unset. Default is 32, which set IP preference (sorry, yesterdays 
setting) to 001, or DSCP to cs1 (001000)
Henning: accept and push to stable?

Thanks, Teco

--- ./src/cfgparser/olsrd_conf.c.org    2011-09-12 07:17:49.000000000 +0000
+++ ./src/cfgparser/olsrd_conf.c        2011-09-13 20:47:22.000000000 +0000
@@ -425,12 +425,18 @@
     return -1;
   }
 
-  /* TOS */
+  /* TOS range */
   if (cnf->tos > MAX_TOS) {
     fprintf(stderr, "TOS %d is not allowed\n", cnf->tos);
     return -1;
   }
 
+  /* TOS ECN */
+  if (cnf->tos & 0x03) {
+    fprintf(stderr, "TOS %d has set ECN bits, not allowed\n", cnf->tos);
+    return -1;
+  }
+
   if (cnf->willingness_auto == false && (cnf->willingness > MAX_WILLINGNESS)) {
     fprintf(stderr, "Willingness %d is not allowed\n", cnf->willingness);
     return -1;



--- ./src/olsr_cfg.h.org        2011-09-12 07:17:49.000000000 +0000
+++ ./src/olsr_cfg.h    2011-09-13 21:06:23.000000000 +0000
@@ -60,7 +60,7 @@
 #define DEF_WILL_AUTO        false
 #define DEF_WILLINGNESS      3
 #define DEF_ALLOW_NO_INTS    true
-#define DEF_TOS              16
+#define DEF_TOS              32
 #define DEF_DEBUGLVL         1
 #define DEF_IPC_CONNECTIONS  0
 #define DEF_USE_HYST         false
@@ -97,7 +97,7 @@
 #define MIN_NICCHGPOLLRT     1.0
 #define MAX_DEBUGLVL         9
 #define MIN_DEBUGLVL         0
-#define MAX_TOS              31
+#define MAX_TOS              252
 #define MIN_TOS              0
 #define MAX_WILLINGNESS      7
 #define MIN_WILLINGNESS      0
@@ -223,7 +223,7 @@
   bool host_emul;
   int ip_version;
   bool allow_no_interfaces;
-  uint16_t tos;
+  uint8_t tos;
   uint8_t rt_proto;
   uint8_t rt_table, rt_table_default, rt_table_tunnel;
   int32_t rt_table_pri, rt_table_tunnel_pri;



--- ./src/unix/ifnet.c.org      2011-09-12 07:17:49.000000000 +0000
+++ ./src/unix/ifnet.c  2011-09-13 20:49:39.000000000 +0000
@@ -562,7 +562,7 @@
   size_t name_size;
 #ifdef linux
   int precedence = IPTOS_PREC(olsr_cnf->tos);
-  int tos_bits = IPTOS_TOS(olsr_cnf->tos);
+  int tos_bits = olsr_cnf->tos;
 #endif
 
   if (iface->host_emul)



--- ./files/olsrd.conf.default.full.org 2011-09-12 07:17:49.000000000 +0000
+++ ./files/olsrd.conf.default.full     2011-09-13 20:58:24.000000000 +0000
@@ -62,10 +62,11 @@
 
 # NicChgsPollInt  2.5
 
-# TOS(type of service) value for the IP header of control traffic.
-# (Default is 16)
+# TOS(type of service) byte value for the IP header of control traffic.
+# Must be multiple of 4, because OLSR doesn't use ECN
+# (Default is 32)
 
-# TosValue 16
+# TosValue 32
 
 # FIBMetric controls the metric value of the host-routes OLSRd sets.
 # - "flat" means that the metric value is always 2. This is the preferred value



Op 13 sep 2011, om 19:24 heeft Ferry Huberts het volgende geschreven:

> On 09/13/2011 06:23 PM, Henning wrote:
>> On Tue, 13.09.2011 08:31:53 Teco Boot wrote:
>>> Great, TOS can be set.
>>> 
>>> The configured value is placed in the TOS byte. So range should
>>> be 0 - 255.
>>> 
>>> But it must be multiple of 4. The last two bits MUST be cleared.
>>> It doesn't make sense to use ECN for OLSR. Add comment in sample
>>> config? Add the clear ECN-bits function?
>> so you suggest a possible value between 0 and 255, but with a bitmask of 0xfc?
>> 
>> Henning Rogge
>> 
>> 
>> 
> I had a talk with Teco this afternoon and he's experimenting with it,
> there were some clashes with the priority socket option.
> 
> -- 
> Ferry Huberts
> 
> -- 
> Olsr-dev mailing list
> (spam-protected)
> https://lists.olsr.org/mailman/listinfo/olsr-dev





More information about the Olsr-dev mailing list