23 Feb, 2016

6 commits


16 Feb, 2016

1 commit

  • The batadv_gw_node reference counter in batadv_gw_node_update can only be
    reduced when the list entry was actually removed. Otherwise the reference
    counter may reach zero when batadv_gw_node_update is called from two
    different contexts for the same gw_node but only one context is actually
    removing the entry from the list.

    The release function for this gw_node is not called inside the list_lock
    spinlock protected region because the function batadv_gw_node_update still
    holds a gw_node reference for the object pointer on the stack. Thus the
    actual release function (when required) will be called only at the end of
    the function.

    Fixes: bd3524c14bd0 ("batman-adv: remove obsolete deleted attribute for gateway node")
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

10 Feb, 2016

2 commits

  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     
  • batman-adv uses a self-written reference implementation which is just based
    on atomic_t. This is less obvious when reading the code than kref and
    therefore increases the change that the reference counting will be missed.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

02 Feb, 2016

2 commits


28 Aug, 2015

2 commits


25 Aug, 2015

2 commits


18 Aug, 2015

1 commit

  • Antonio Quartulli says:

    ====================
    Included changes:
    - avoid integer overflow in GW selection routine
    - prevent race condition by making capability bit changes atomic (use
    clear/set/test_bit)
    - fix synchronization issue in mcast tvlv handler
    - fix crash on double list removal of TT Request objects
    - fix leak by puring packets enqueued for sending upon iface removal
    - ensure network header pointer is set in skb
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

12 Aug, 2015

2 commits

  • The gateway selection based on fast connections is using a single value
    calculated from the average tq (0-255) and the download bandwidth (in
    100Kibit). The formula for the first step (tq ** 2 * 10000 * bandwidth)
    tends to overflow a u32 with low bandwidth settings like 50 [100KiBit]
    and a tq value of over 92.

    Changing this to a 64 bit unsigned integer allows to support a
    bandwidth_down with up to ~2.8e10 [100KiBit] and a perfect tq of 255. This
    is ~6.6 times higher than the maximum possible value of the gateway
    announcement TVLV.

    This problem only affects the non-default gw_sel_class 1.

    Signed-off-by: Ruben Wisniewsi
    [sven@narfation.org: rewritten commit message]
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Ruben Wisniewski
     
  • The gw_factor is divided by BATADV_TQ_LOCAL_WINDOW_SIZE ** 2 * 64. But the
    rest of the calculation has nothing to do with the tq window size and
    therefore the calculation is just (tmp_gw_factor / (64 ** 3)).

    Replace it with a simple shift to avoid a costly 64-bit divide when the
    max_gw_factor is changed from u32 to u64. This type change is necessary
    to avoid an overflow bug.

    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Sven Eckelmann
     

05 Aug, 2015

1 commit

  • Without this initialization, gateways which actually announce up/down
    bandwidth of 0/0 could be added. If these nodes get purged via
    _batadv_purge_orig() later, the gw_node structure does not get removed
    since batadv_gw_node_delete() updates the gw_node with up/down
    bandwidth of 0/0, and the updating function then discards the change
    and does not free gw_node.

    This results in leaking the gw_node structures, which references other
    structures: gw_node -> orig_node -> orig_node_ifinfo -> hardif. When
    removing the interface later, the open reference on the hardif may cause
    hangs with the infamous "unregister_netdevice: waiting for mesh1 to
    become free. Usage count = 1" message.

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     

07 Jun, 2015

2 commits

  • Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    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: Markus Pargmann
    Signed-off-by: Sven Eckelmann
    Signed-off-by: Marek Lindner

    Sven Eckelmann
     

29 May, 2015

1 commit


23 Feb, 2015

1 commit

  • net-next commit 6d91147d183c ("batman-adv: Remove uses of return value
    of seq_printf") incorrectly changed the overflow occurred return from
    -1 to 1. Change it back so that the test of batadv_write_buffer_text's
    return value in batadv_gw_client_seq_print_text works properly.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

21 Feb, 2015

1 commit


08 Jan, 2015

1 commit


24 Dec, 2014

1 commit

  • Gateway having bandwidth_down equal to zero are not accepted
    at all and so never added to the Gateway list.
    For this reason checking the bandwidth_down member in
    batadv_gw_out_of_range() is useless.

    This is probably a copy/paste error and this check was supposed
    to be "!gw_node" only. Moreover, the way the check is written
    now may also lead to a NULL dereference.

    Fix this by rewriting the if-condition properly.

    Introduced by 414254e342a0d58144de40c3da777521ebaeeb07
    ("batman-adv: tvlv - gateway download/upload bandwidth container")

    Signed-off-by: Antonio Quartulli
    Reported-by: David Binderman
    Signed-off-by: Marek Lindner
    Signed-off-by: David S. Miller

    Antonio Quartulli
     

16 May, 2014

1 commit

  • A pointer to the orig_node representing a bat-gateway is
    stored in the gw_node->orig_node member, but the refcount
    for such orig_node is never increased.
    This leads to memory faults when gw_node->orig_node is accessed
    and the originator has already been freed.

    Fix this by increasing the refcount on gw_node creation
    and decreasing it on gw_node free.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     

22 Mar, 2014

2 commits

  • On some architectures ether_addr_copy() is slightly faster
    than memcpy() therefore use the former when possible.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • Our .ndo_start_xmit handler (batadv_interface_tx()) can rely on having
    the skb mac header pointer set correctly since the following commit
    present in kernels >= 3.9:

    "net: reset mac header in dev_start_xmit()" (6d1ccff627)

    Therefore we can safely use eth_hdr() and vlan_eth_hdr() instead of
    skb->data now, which spares us some ugly type casts.

    At the same time set the mac_header in batadv_dat_snoop_incoming_arp_request()
    before sending the skb along the TX path.

    Signed-off-by: Linus Lüssing
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Linus Lüssing
     

14 Feb, 2014

1 commit

  • One of my pet coding style peeves is the practice of
    adding extra return; at the end of function.
    Kill several instances of this in network code.

    I suppose some coccinelle wizardy could do this automatically.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

12 Jan, 2014

3 commits

  • Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     
  • For the network wide multi interface optimization there are different
    routers for each outgoing interface (outgoing from the OGM perspective,
    incoming for payload traffic). To reflect this, change the router and
    associated data to a list of routers.

    While at it, rename batadv_orig_node_get_router() to
    batadv_orig_router_get() to follow the new naming scheme.

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     
  • For the network wide multi interface optimization it is required to save
    metrics per outgoing interface in one neighbor. Therefore a new type is
    introduced to keep interface-specific information. This also requires
    some changes in access and list management.

    The compare and equiv_or_better API calls are changed to take the
    outgoing interface into consideration.

    Signed-off-by: Simon Wunderlich
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Simon Wunderlich
     

09 Jan, 2014

4 commits

  • In different situations it is possible that the DHCP server
    or client uses broadcast Ethernet frames to send messages
    to each other. The GW component in batman-adv takes care of
    using bat-unicast packets to bring broadcast DHCP
    Discover/Requests to the "best" server.

    On the way back the DHCP server usually sends unicasts,
    but upon client request it may decide to use broadcasts as
    well.

    This patch improves the GW component so that it now snoops
    and sends as unicast all the DHCP packets, no matter if they
    were generated by a DHCP server or client.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • The function batadv_gw_deselect() is actually not deselecting
    anything. It is just informing the GW code to perform a
    re-election procedure when possible.
    The current gateway is not being touched at all and therefore
    the name of this function is rather misleading.

    Rename it to batadv_gw_reselect() to batadv_gw_reselect()
    to make its behaviour easier to grasp.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     
  • When switching from gw_mode client to either off or server
    the current selected gateway has to be deselected.
    In this way when client mode is enabled again a gateway
    re-election is forced and a GW_ADD event is consequently
    sent.

    The current behaviour instead is to keep the current gateway
    leading to no GW_ADD event when gw_mode client is selected
    for a second time

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner
    Signed-off-by: Antonio Quartulli

    Antonio Quartulli
     
  • As suggested by checkpatch, remove all the references to the
    FSF address since the kernel already has one reference in
    its documentation.

    In this way it is easier to update it in case of future
    changes.

    Signed-off-by: Antonio Quartulli
    Signed-off-by: Marek Lindner

    Antonio Quartulli
     

23 Oct, 2013

1 commit


19 Oct, 2013

2 commits