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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/dccp/dccp_options.c
          +++ new/usr/src/uts/common/inet/dccp/dccp_options.c
↓ open down ↓ 9 lines elided ↑ open up ↑
  10   10   */
  11   11  
  12   12  /*
  13   13   * Copyright 2012 David Hoeppner. All rights reserved.
  14   14   */
  15   15  
  16   16  #include <sys/types.h> 
  17   17  #include <sys/stream.h> 
  18   18  #include <sys/debug.h> 
  19   19  #include <sys/cmn_err.h>
       20 +
  20   21  #include <inet/dccp_impl.h>
  21   22  #include <inet/dccp_stack.h>
  22   23  
  23   24  /*
  24   25   * This file contains functions to parse and process DCCP options.
  25   26   */
  26   27  
  27   28  
  28   29  /*
  29   30   * Parse the options in a DCCP header.
↓ open down ↓ 90 lines elided ↑ open up ↑
 120  121                          break;
 121  122                  case DCCP_OPTION_DATA_DROPPED:
 122  123                          cmn_err(CE_NOTE, "DATA DROPPED");
 123  124                          break;
 124  125                  case DCCP_OPTION_TIMESTAMP:
 125  126                          cmn_err(CE_NOTE, "TIMESTAMP");
 126  127                          if (option_length != 4)
 127  128                                  goto option_error;
 128  129  
 129  130                          /* XXX read unaligned big endian */
 130      -                        option_value = ((uint8_t)value[0] << 31);
      131 +                        option_value = ((uint8_t)value[0] << 24);
      132 +                        option_value += ((uint8_t)value[1] << 16);
      133 +                        option_value += ((uint8_t)value[2] << 8);
      134 +                        option_value += (uint8_t)value[3];
 131  135                          if (option_value) {
 132  136                                  cmn_err(CE_NOTE, "Zero timestamp");
 133  137                                  break;
 134  138                          }
 135  139  
 136  140                          dccp->dccp_timestamp_echo = ntohs(option_value);
 137      -                        dccp->dccp_timestamp = gethrtime();
      141 +                        dccp->dccp_timestamp = TICK_TO_MSEC(LBOLT_FASTPATH);
 138  142                          break;
 139  143                  case DCCP_OPTION_TIMESTAMP_ECHO:
 140  144                          cmn_err(CE_NOTE, "TIMESTAMP ECHO");
 141  145                          if (option_length != 4 &&
 142  146                              option_length != 6 &&
 143  147                              option_length != 8) {
 144  148                                  goto option_error;
 145  149                          }
 146  150  
 147  151                          break;
↓ open down ↓ 107 lines elided ↑ open up ↑
 255  259                          buf[len] = feature->df_type;
 256  260                          len++;
 257  261                          buf[len] = 1;
 258  262                          len++;
 259  263                  }
 260  264          }
 261  265  
 262  266          if (dccp->dccp_timestamp_echo != 0) {
 263  267                  uint32_t        elapsed;
 264  268                  int             elapsed_length;
      269 +                clock_t         now;
 265  270  
 266  271                  buf[len] = DCCP_OPTION_TIMESTAMP_ECHO;
 267  272                  len++;
      273 +                buf[len] = 10;
      274 +                len++;
      275 +
      276 +                now = TICK_TO_MSEC(LBOLT_FASTPATH);
      277 +                elapsed =  now - dccp->dccp_timestamp;
 268  278  
 269      -                elapsed = gethrtime() - dccp->dccp_timestamp;
 270  279  
 271  280                  dccp->dccp_timestamp_echo = 0;
 272  281          }
 273  282  
 274  283          total_len = ((len + (4 - 1)) / 4) * 4;
 275  284          options = kmem_zalloc(total_len, KM_SLEEP);
 276  285          if (options == NULL) {
 277  286                  cmn_err(CE_NOTE, "kmem_zalloc failed");
 278  287                  return (ENOMEM);
 279  288          }
 280  289          memcpy(options, buf, len);
 281  290  
 282  291          *opt = options;
 283  292          *opt_len = len;
 284  293  
 285  294          return (0);
 286  295  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX