Skip to content
Snippets Groups Projects
  1. Apr 08, 2014
    • Tomasz Grabiec's avatar
      dhcp: fix parsing of DHCP options · 40d4ae32
      Tomasz Grabiec authored
      
      There are several issues with current code. Firstly, the LENGTH_OK
      macro was used in the condition in while(). This macro was checking if
      options + op_len does not exceed packet limit. This macro works fine
      when used from PARSE_OP() inside the switch, but because 'options' is
      bumped up by op_len at the end of the loop body, use of this macro in
      the while condition may result in premature exit of the loop. This was
      causing that some times OSv was not parsing network mask and gateway
      leaving them at 0.0.0.0 when started on Goodle Compute Engine. As a
      result OSv was not responding over network. See issue #254.
      
      Another issue was that the stop condition which checks for op ==
      DHCP_OPTION_END was using 'op' from the outer context, which was never
      overwritten. The actual variable which was changed based on the packet
      content was redeclared inside the loop.
      
      A third problem, spotted by Vlad, is that the code was not handling
      DHCP_OPTION_PAD properly. This option has only opcode byte and no
      following length byte. Currrent code would attempt to read the length
      byte and skip by that amount, which would yiled incorrect parsing
      result.
      
      Reviewed-by: default avatarVlad Zolotarov <vladz@cloudius-systems.com>
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      40d4ae32
    • Tomasz Grabiec's avatar
      dhcp: remove lookup_opcode() · abbfc557
      Tomasz Grabiec authored
      
      The lookup_opcode() function is incorrect. It was mishandling
      DHCP_OPTION_PAD, which does not have a following length byte.
      
      Also, the while condition is reading 'op' value which never
      changes. This may result in reads beyond packet size.
      
      Since this function is unused the best fix is to remove it.
      
      Reveiwed-by: default avatarVlad Zolotarov <vladz@cloudius-systems.com>
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      abbfc557
  2. Apr 07, 2014
  3. Apr 06, 2014
  4. Apr 04, 2014
  5. Apr 03, 2014
  6. Apr 02, 2014
Loading