[Babel-users] [PATCH] Set diffserv to CS6 for babel packets

Dave Taht dave.taht at gmail.com
Wed Sep 28 13:09:39 UTC 2011


Setting the IPv6 dscp field to CS6 allows for babel packets to
'jump' a bufferbloated queue and get to a destination sooner.

With the pfifo_fast qdisc (the default for ethernet), this
'does the right thing'.

With mac80211 wireless, this moves babel packets into the VO
queue, from which it is hopefully extracted and then multicast.
---
 net.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net.c b/net.c
index 69769f1..b53afca 100644
--- a/net.c
+++ b/net.c
@@ -21,12 +21,14 @@ THE SOFTWARE.
 */

 #include <unistd.h>
+#include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/socket.h>
+#include <netinet/ip.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <errno.h>
@@ -42,6 +44,7 @@ babel_socket(int port)
     int s, rc;
     int saved_errno;
     int one = 1, zero = 0;
+    const int ds = IPTOS_CLASS_CS6; /* CS6 - Network Control */

     s = socket(PF_INET6, SOCK_DGRAM, 0);
     if(s < 0)
@@ -70,6 +73,10 @@ babel_socket(int port)
     if(rc < 0)
         goto fail;

+    rc = setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &ds, sizeof(ds));
+    if (rc < 0)
+        perror("Couldn't set Traffic Class");
+
     rc = fcntl(s, F_GETFL, 0);
     if(rc < 0)
         goto fail;
-- 
1.7.4.1

-- 
Dave Täht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://the-edge.blogspot.com



More information about the Babel-users mailing list