Print this page
dccp: getting kernel segfaults, back out recent added features

@@ -15,10 +15,11 @@
 
 #include <sys/types.h> 
 #include <sys/stream.h> 
 #include <sys/debug.h> 
 #include <sys/cmn_err.h>
+
 #include <inet/dccp_impl.h>
 #include <inet/dccp_stack.h>
 
 /*
  * This file contains functions to parse and process DCCP options.

@@ -125,18 +126,21 @@
                         cmn_err(CE_NOTE, "TIMESTAMP");
                         if (option_length != 4)
                                 goto option_error;
 
                         /* XXX read unaligned big endian */
-                        option_value = ((uint8_t)value[0] << 31);
+                        option_value = ((uint8_t)value[0] << 24);
+                        option_value += ((uint8_t)value[1] << 16);
+                        option_value += ((uint8_t)value[2] << 8);
+                        option_value += (uint8_t)value[3];
                         if (option_value) {
                                 cmn_err(CE_NOTE, "Zero timestamp");
                                 break;
                         }
 
                         dccp->dccp_timestamp_echo = ntohs(option_value);
-                        dccp->dccp_timestamp = gethrtime();
+                        dccp->dccp_timestamp = TICK_TO_MSEC(LBOLT_FASTPATH);
                         break;
                 case DCCP_OPTION_TIMESTAMP_ECHO:
                         cmn_err(CE_NOTE, "TIMESTAMP ECHO");
                         if (option_length != 4 &&
                             option_length != 6 &&

@@ -260,15 +264,20 @@
         }
 
         if (dccp->dccp_timestamp_echo != 0) {
                 uint32_t        elapsed;
                 int             elapsed_length;
+                clock_t         now;
 
                 buf[len] = DCCP_OPTION_TIMESTAMP_ECHO;
                 len++;
+                buf[len] = 10;
+                len++;
+
+                now = TICK_TO_MSEC(LBOLT_FASTPATH);
+                elapsed =  now - dccp->dccp_timestamp;
 
-                elapsed = gethrtime() - dccp->dccp_timestamp;
 
                 dccp->dccp_timestamp_echo = 0;
         }
 
         total_len = ((len + (4 - 1)) / 4) * 4;