[Babel-users] [PATCH] Set CS6 for AHCP packets

Dave Taht dave.taht at gmail.com
Wed Sep 28 13:14:11 UTC 2011


Setting the IPv6 dscp field to CS6 allows for AHCP 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 AHCP packets into the VO
queue, from which it is hopefully extracted and then multicast.
---
 ahcpd.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ahcpd.c b/ahcpd.c
index 6908e60..138a76a 100644
--- a/ahcpd.c
+++ b/ahcpd.c
@@ -35,6 +35,7 @@ THE SOFTWARE.
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <netinet/in.h>
+#include <netinet/ip.h>
 #include <arpa/inet.h>
 #include <net/if.h>

@@ -969,6 +970,7 @@ ahcp_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)
@@ -995,6 +997,10 @@ ahcp_socket(int port)
         perror("setsockopt(IPV6_V6ONLY)");
 #endif

+    rc = setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &ds, sizeof(ds));
+    if (rc < 0)
+        perror("setsockopt(IPV6_TCLASS)");
+
     rc = fcntl(s, F_GETFD, 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