1. 18 5月, 2016 2 次提交
    • S
      batman-adv: Fix integer overflow in batadv_iv_ogm_calc_tq · d285f52c
      Sven Eckelmann 提交于
      The undefined behavior sanatizer detected an signed integer overflow in a
      setup with near perfect link quality
      
          UBSAN: Undefined behaviour in net/batman-adv/bat_iv_ogm.c:1246:25
          signed integer overflow:
          8713350 * 255 cannot be represented in type 'int'
      
      The problems happens because the calculation of mixed unsigned and signed
      integers resulted in an integer multiplication.
      
            batadv_ogm_packet::tq (u8 255)
          * tq_own (u8 255)
          * tq_asym_penalty (int 134; max 255)
          * tq_iface_penalty (int 255; max 255)
      
      The tq_iface_penalty, tq_asym_penalty and inv_asym_penalty can just be
      changed to unsigned int because they are not expected to become negative.
      
      Fixes: c0398768 ("batman-adv: add WiFi penalty")
      Signed-off-by: NSven Eckelmann <sven.eckelmann@open-mesh.com>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <a@unstable.cc>
      d285f52c
    • S
      batman-adv: Fix unexpected free of bcast_own on add_if error · f7dcdf5f
      Sven Eckelmann 提交于
      The function batadv_iv_ogm_orig_add_if allocates new buffers for bcast_own
      and bcast_own_sum. It is expected that these buffers are unchanged in case
      either bcast_own or bcast_own_sum couldn't be resized.
      
      But the error handling of this function frees the already resized buffer
      for bcast_own when the allocation of the new bcast_own_sum buffer failed.
      This will lead to an invalid memory access when some code will try to
      access bcast_own.
      
      Instead the resized new bcast_own buffer has to be kept. This will not lead
      to problems because the size of the buffer was only increased and therefore
      no user of the buffer will try to access bytes outside of the new buffer.
      
      Fixes: d0015fdd ("batman-adv: provide orig_node routing API")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <a@unstable.cc>
      f7dcdf5f
  2. 10 5月, 2016 3 次提交
  3. 04 5月, 2016 2 次提交
  4. 29 2月, 2016 1 次提交
    • A
      batman-adv: keep track of when unicast packets are sent · 95d39278
      Antonio Quartulli 提交于
      To enable ELP to send probing packets over wireless links
      only if needed, batman-adv must keep track of the last time
      it sent a unicast packet towards every neighbour.
      
      For this purpose a 2 main changes are introduced:
      1) a new member of the elp_neigh_node structure stores the
         last time a unicast packet was sent towards this neighbour;
      2) a wrapper function for sending unicast packets is
         implemented. This function will simply update the member
         describe din point 1) and then forward the packet to the
         real sending routine.
      
      Point 2) implies that any code-path leading to a unicast
      sending now has to use the new wrapper.
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      95d39278
  5. 23 2月, 2016 6 次提交
  6. 10 2月, 2016 3 次提交
  7. 02 2月, 2016 3 次提交
  8. 09 1月, 2016 1 次提交
  9. 07 1月, 2016 1 次提交
    • S
      batman-adv: Fix invalid read while copying bat_iv.bcast_own · 13bbdd37
      Sven Eckelmann 提交于
      batadv_iv_ogm_orig_del_if removes a part of the bcast_own which previously
      belonged to the now removed interface. This is done by copying all data
      which comes before the removed interface and then appending all the data
      which comes after the removed interface.
      
      The address calculation for the position of the data which comes after the
      removed interface assumed that the bat_iv.bcast_own is a pointer to a
      single byte datatype. But it is a pointer to unsigned long and thus the
      calculated position was wrong off factor sizeof(unsigned long).
      
      Fixes: 83a8342678a0 ("more basic routing code added (forwarding packets /
      bitarray added)")
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: NAntonio Quartulli <a@unstable.cc>
      13bbdd37
  10. 16 12月, 2015 3 次提交
  11. 28 8月, 2015 4 次提交
  12. 25 8月, 2015 3 次提交
  13. 07 6月, 2015 2 次提交
    • S
    • S
      batman-adv: Add required includes to all files · 1e2c2a4f
      Sven Eckelmann 提交于
      The header files could not be build indepdent from each other. This is
      happened because headers didn't include the files for things they've used.
      This was problematic because the success of a build depended on the
      knowledge about the right order of local includes.
      
      Also source files were not including everything they've used explicitly.
      Instead they required that transitive includes are always stable. This is
      problematic because some transitive includes are not obvious, depend on
      config settings and may not be stable in the future.
      
      The order for include blocks are:
      
       * primary headers (main.h and the *.h file of a *.c file)
       * global linux headers
       * required local headers
       * extra forward declarations for pointers in function/struct declarations
      
      The only exceptions are linux/bitops.h and linux/if_ether.h in packet.h.
      This header file is shared with userspace applications like batctl and must
      therefore build together with userspace applications. The header
      linux/bitops.h is not part of the uapi headers and linux/if_ether.h
      conflicts with the musl implementation of netinet/if_ether.h. The
      maintainers rejected the use of __KERNEL__ preprocessor checks and thus
      these two headers are only in main.h. All files using packet.h first have
      to include main.h to work correctly.
      Reported-by: NMarkus Pargmann <mpa@pengutronix.de>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NMarek Lindner <mareklindner@neomailbox.ch>
      1e2c2a4f
  14. 03 6月, 2015 6 次提交