1. 17 Aug, 2015 17 commits
  2. 14 Aug, 2015 23 commits
    • Linus Lüssing's avatar
      batman-adv: Fix potentially broken skb network header access · 53cf037b
      Linus Lüssing authored
      The two commits noted below added calls to ip_hdr() and ipv6_hdr(). They
      need a correctly set skb network header.
      
      Unfortunately we cannot rely on the device drivers to set it for us.
      Therefore setting it in the beginning of the according ndo_start_xmit
      handler.
      
      Fixes: 1d8ab8d3 ("batman-adv: Modified forwarding behaviour for multicast packets")
      Fixes: ab49886e ("batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      53cf037b
    • Simon Wunderlich's avatar
      batman-adv: remove broadcast packets scheduled for purged outgoing if · 3f1e08d0
      Simon Wunderlich authored
      When an interface is purged, the broadcast packets scheduled for this
      interface should get purged as well.
      Signed-off-by: default avatarSimon Wunderlich <simon@open-mesh.com>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      3f1e08d0
    • Marek Lindner's avatar
      batman-adv: protect tt request from double deletion · 1f155101
      Marek Lindner authored
      The list_del() calls were changed to list_del_init() to prevent
      an accidental double deletion in batadv_tt_req_node_new().
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      1f155101
    • Linus Lüssing's avatar
      batman-adv: Fix potential synchronization issues in mcast tvlv handler · 8a4023c5
      Linus Lüssing authored
      So far the mcast tvlv handler did not anticipate the processing of
      multiple incoming OGMs from the same originator at the same time. This
      can lead to various issues:
      
      * Broken refcounting: For instance two mcast handlers might both assume
        that an originator just got multicast capabilities and will together
        wrongly decrease mcast.num_disabled by two, potentially leading to
        an integer underflow.
      
      * Potential kernel panic on hlist_del_rcu(): Two mcast handlers might
        one after another try to do an
        hlist_del_rcu(&orig->mcast_want_all_*_node). The second one will
        cause memory corruption / crashes.
        (Reported by: Sven Eckelmann <sven@narfation.org>)
      
      Right in the beginning the code path makes assumptions about the current
      multicast related state of an originator and bases all updates on that. The
      easiest and least error prune way to fix the issues in this case is to
      serialize multiple mcast handler invocations with a spinlock.
      
      Fixes: 60432d75 ("batman-adv: Announce new capability via multicast TVLV")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      8a4023c5
    • Linus Lüssing's avatar
      batman-adv: Make MCAST capability changes atomic · 9c936e3f
      Linus Lüssing authored
      Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
      OGM handler might undo the set/clear of a specific bit from another
      handler run in between.
      
      Fix this by using the atomic set_bit()/clear_bit()/test_bit() functions.
      
      Fixes: 60432d75 ("batman-adv: Announce new capability via multicast TVLV")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      9c936e3f
    • Linus Lüssing's avatar
      batman-adv: Make TT capability changes atomic · ac4eebd4
      Linus Lüssing authored
      Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
      OGM handler might undo the set/clear of a specific bit from another
      handler run in between.
      
      Fix this by using the atomic set_bit()/clear_bit()/test_bit() functions.
      
      Fixes: e17931d1 ("batman-adv: introduce capability initialization bitfield")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      ac4eebd4
    • Linus Lüssing's avatar
      batman-adv: Make NC capability changes atomic · 4635469f
      Linus Lüssing authored
      Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
      OGM handler might undo the set/clear of a specific bit from another
      handler run in between.
      
      Fix this by using the atomic set_bit()/clear_bit()/test_bit() functions.
      
      Fixes: 3f4841ff ("batman-adv: tvlv - add network coding container")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      4635469f
    • Linus Lüssing's avatar
      batman-adv: Make DAT capability changes atomic · 65d7d460
      Linus Lüssing authored
      Bitwise OR/AND assignments in C aren't guaranteed to be atomic. One
      OGM handler might undo the set/clear of a specific bit from another
      handler run in between.
      
      Fix this by using the atomic set_bit()/clear_bit()/test_bit() functions.
      
      Fixes: 17cf0ea4 ("batman-adv: tvlv - add distributed arp table container")
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: default avatarMarek Lindner <mareklindner@neomailbox.ch>
      Signed-off-by: default avatarAntonio Quartulli <antonio@meshcoding.com>
      65d7d460
    • Emmanuel Grumbach's avatar
      mac80211: fix BIT position for TDLS WIDE extended cap · 8f9c98df
      Emmanuel Grumbach authored
      The bit was not according to ieee80211 specification.
      Fix that.
      Reviewed-by: default avatarArik Nemtsov <arik@wizery.com>
      Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      8f9c98df
    • Johannes Berg's avatar
      mac80211: use DECLARE_EWMA · 40d9a38a
      Johannes Berg authored
      Instead of using the out-of-line average calculation, use the new
      DECLARE_EWMA() macro to declare a signal EWMA, and use that.
      
      This actually *reduces* the code size slightly (on x86-64) while
      also reducing the station info size by 80 bytes.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      40d9a38a
    • Johannes Berg's avatar
      average: provide macro to create static EWMA · 2377799c
      Johannes Berg authored
      Having the EWMA parameters stored in the runtime struct imposes
      memory requirements for the constant values that could just be
      inlined in the code. This particularly makes sense if there are
      a lot of such structs, for example in mac80211 in the station
      table where each station has a number of these in an array, and
      there can be many stations.
      
      Provide a macro DECLARE_EWMA() that declares the necessary struct
      and inline functions to access it with the parameters hard-coded;
      using this also means the user no longer needs to 'select AVERAGE'
      as it's entirely self-contained.
      
      In the mac80211 case, on x86-64, this actually slightly *reduces*
      code size, while also saving 80 bytes of runtime memory per sta.
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      2377799c
    • Su Kang Yin's avatar
      mac80211_hwsim: unregister genetlink family properly · 2459cd87
      Su Kang Yin authored
      During hwsim_init_netlink(), we should call genl_unregister_family()
      if failed on netlink_register_notifier() since the genetlink is
      already registered.
      Signed-off-by: default avatarSu Kang Yin <cantona@cantona.net>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      2459cd87
    • Lorenzo Bianconi's avatar
      mac80211: add rate mask logic for vht rates · b119ad6e
      Lorenzo Bianconi authored
      Define rc_rateidx_vht_mcs_mask array and rate_idx_match_vht_mcs_mask()
      method in order to apply mcs mask for vht rates
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      b119ad6e
    • Lorenzo Bianconi's avatar
      mac80211: define rate_control_apply_mask_ratetbl() · e910867b
      Lorenzo Bianconi authored
      Define rate_control_apply_mask_ratetbl() in order to apply ratemask in
      rate_control_set_rates() for station rate table
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      e910867b
    • Lorenzo Bianconi's avatar
      mac80211: remove ieee80211_tx_rate dependency in rate mask code · 90c66bd2
      Lorenzo Bianconi authored
      Remove ieee80211_tx_rate dependency in rate_idx_match_legacy_mask(),
      rate_idx_match_mcs_mask() and rate_idx_match_mask() in order to use the
      previous logic to define a ratemask in rate_control_set_rates() for
      station rate table. Moreover move rate mask definition logic in
      rate_control_cap_mask()
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      90c66bd2
    • Lorenzo Bianconi's avatar
      mac80211: remove ieee80211_tx_info from rate_control_apply_mask signature · 35225eb7
      Lorenzo Bianconi authored
      Remove unnecessary ieee80211_tx_info pointer from rate_control_apply_mask
      signature. rate_control_apply_mask() will be used to define a ratemask in
      rate_control_set_rates() for station rate table
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      35225eb7
    • Bertold Van den Bergh's avatar
      mac80211: Make OCB mode set BSSID · 4b819f6c
      Bertold Van den Bergh authored
      Perform the BSS_CHANGED_BSSID action when joining an OCB network.
      This is required to set the broadcast BSSID in some network drivers.
      Signed-off-by: default avatarBertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      4b819f6c
    • Bertold Van den Bergh's avatar
      mac80211: Only accept data frames in OCB mode · cc117298
      Bertold Van den Bergh authored
      Currently OCB mode accepts frames with bssid==broadcast and type!=beacon.
      Some non-data frames are sent matching this, for example probe responses.
      This results in unnecessary creation of STA entries.
      Signed-off-by: default avatarBertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      cc117298
    • Bertold Van den Bergh's avatar
      mac80211: Set txrc.bss to true for OCB interfaces · 5765f9f6
      Bertold Van den Bergh authored
      To make mac80211 accept the multicast rate requested by the user the
      rate control should be told that it is operating in BSS mode.
      Without this, the default rate is selected in rate_control_send_low
      (!pubsta and !txrc->bss)
      Signed-off-by: default avatarBertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      5765f9f6
    • Bertold Van den Bergh's avatar
      nl80211: Allow setting multicast rate on OCB interfaces · 876dc930
      Bertold Van den Bergh authored
      Allow setting multicast rate on OCB interfaces.
      Current behaviour results in EOPNOTSUPP when attempting this.
      Signed-off-by: default avatarBertold Van den Bergh <bertold.vandenbergh@esat.kuleuven.be>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      876dc930
    • Michal Kazior's avatar
      cfg80211: propagate set_wiphy failure to userspace · 9189ee31
      Michal Kazior authored
      If driver failed to setup wiphy params (e.g. rts
      threshold, fragmentation treshold) userspace
      wasn't properly notified about this. This could
      lead to user confusion who would think the command
      succeeded even if that wasn't the case.
      Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      9189ee31
    • Matthias May's avatar
      cfg80211: regulatory: handle 5 and 10 MHz channels properly · 4edd5698
      Matthias May authored
      The original assumption of 20MHz wide channels hasn't been true since
      the addition of support for 5 and 10 MHz channels.
      Change the code to no longer disable all channels that don't fit into
      the 20MHz grid, but instead set the appropriate flags to disable
      operation on specific bandwidths.
      Signed-off-by: default avatarMatthias May <matthias.may@neratec.com>
      [reword commit message]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      4edd5698
    • David S. Miller's avatar
      Merge branch 'vrf-lite' · d52736e2
      David S. Miller authored
      David Ahern says:
      
      ====================
      VRF-lite - v6
      
      In the context of internet scale routing a requirement that always comes
      up is the need to partition the available routing tables into disjoint
      routing planes. A specific use case is the multi-tenancy problem where
      each tenant has their own unique routing tables and in the very least
      need different default gateways.
      
      This patch allows the ability to create virtual router domains (aka VRFs
      (VRF-lite to be specific) in the linux packet forwarding stack. The main
      observation is that through the use of rules and socket binding to interfaces,
      all the facilities that we need are already present in the infrastructure. What
      is missing is a handle that identifies a routing domain and can be used to
      gather applicable rules/tables and uniqify neighbor selection. The scheme used
      needs to preserves the notions of ECMP, and general routing principles.
      
      This driver is a cross between functionality that the IPVLAN driver
      and the Team drivers provide where a device is created and packets
      into/out of the routing domain are shuttled through this device. The
      device is then used as a handle to identify the applicable rules. The
      VRF device is thus the layer3 equivalent of a vlan device.
      
      The very important point to note is that this is only a Layer3 concept
      so L2 tools (e.g., LLDP) do not need to be run in each VRF, processes can
      run in unaware mode or select a VRF to be talking through. Also the
      behavioral model is a generalized application of the familiar VRF-Lite
      model with some performance paths that need optimization. (Specifically
      the output route selector that Roopa, Robert, Thomas and EricB are
      currently discussing on the MPLS thread)
      
      High Level points
      =================
      1. Simple overlay driver (minimal changes to current stack)
         * uses the existing fib tables and fib rules infrastructure
      2. Modelled closely after the ipvlan driver
      3. Uses current API and infrastructure.
         * Applications can use SO_BINDTODEVICE or cmsg device indentifiers
           to pick VRF (ping, traceroute just work)
         * Standard IP Rules work, and since they are aggregated against the
           device, scale is manageable
      4. Completely orthogonal to Namespaces and only provides separation in
         the routing plane (and ARP)
      
                                                       N2
                 N1 (all configs here)          +---------------+
          +--------------+                      |               |
          |swp1 :10.0.1.1+----------------------+swp1 :10.0.1.2 |
          |              |                      |               |
          |swp2 :10.0.2.1+----------------------+swp2 :10.0.2.2 |
          |              |                      +---------------+
          | VRF 1        |
          | table 5      |
          |              |
          +---------------+
          |              |
          | VRF 2        |                             N3
          | table 6      |                      +---------------+
          |              |                      |               |
          |swp3 :10.0.2.1+----------------------+swp1 :10.0.2.2 |
          |              |                      |               |
          |swp4 :10.0.3.1+----------------------+swp2 :10.0.3.2 |
          +--------------+                      +---------------+
      
      Given the topology above, the setup needed to get the basic VRF
      functions working would be
      
      Create the VRF devices and associate with a table
          ip link add vrf1 type vrf table 5
          ip link add vrf2 type vrf table 6
      
      Install the lookup rules that map table to VRF domain
          ip rule add pref 200 oif vrf1 lookup 5
          ip rule add pref 200 iif vrf1 lookup 5
          ip rule add pref 200 oif vrf2 lookup 6
          ip rule add pref 200 iif vrf2 lookup 6
      
          ip link set vrf1 up
          ip link set vrf2 up
      
      Enslave the routing member interfaces
          ip link set swp1 master vrf1
          ip link set swp2 master vrf1
          ip link set swp3 master vrf2
          ip link set swp4 master vrf2
      
      Connected and local routes are automatically moved from main and local
      tables to the VRF table.
      
      ping using VRF0 is simply
          ping -I vrf0 10.0.1.2
      
      Design Highlights
      =================
      If a device is enslaved to a VRF device (ie., associated with a VRF)
      then:
      1. Rx path
         The master device index is used as the iif for all lookups.
      
      2. Tx path
         Similarly, for Tx the VRF device oif is used in the flow to direct
         lookups to the table associated with the VRF via its rule. From there
         the FLOWI_FLAG_VRFSRC flag is used to indicate that the oif should
         not be used for FIB table lookups.
      
      3. Connected and local routes
         On link up for a device, connected and local routes are added to the
         table associated with the VRF device, rather than the local and main
         tables.
      
      4. Socket lookups
         Sockets operating in the VRF must be bound to the VRF device. As such
         socket lookups compare the VRF device index to sk_bound_dev_if.
      
      5. Neighbor entries
         Neighbor entries are not impacted by the VRF device. Entries are
         associated with a particular interface; the VRF association is indirect
         via the interface-to-VRF device enslavement.
      
      Version 6
      - addressed comments from DaveM
      
      - added patch to properly set oif in ip_send_unicast_reply. Needs to be
        set to VRF device for proper FIB lookup
      
      - added patch to handle IP fragments
      
      Version 5
      - dropped patch regarding socket lookups; no longer needed
        + removed vrf helpers no longer needed after this patch is dropped
      - removed dev_open and close operations
        + no need to reset vrf data on an ifdown and creates problems if a
          slave is deleted while the vrf interface is down (Thanks, Nikolay)
      - cleanups for sparse warnings
        + make C=2 is now clean for vrf driver
      
      Version 4
      - builds are clean with and without VRF device enabled (no, yes and module)
      - tightened the driver implementation
        + device add/delete, slave add/remove, and module unload are all clean
      - fixed RCU references
        + with RCU and lock debugging enabled changes are clean through the
          suite of tests
      - TX path uses custom dst, so patch refactoring rtable allocation is
        dropped along with the patch adding rt_nexthop helper
      - dropped the task patch that adds default bind to interface for sockets
        and the associated chvrf example command
        + the patches are a convenience for running unmodified code. They
          are not needed for the core functionality. Any application with
          support for SO_BINDTODEVICE works properly with this patch set.
      
      Version 3
      - addressed comments from first 2 RFCs with the exception of the name
        Nicolas: We will do the name conversion once we agree on what the
                 correct name should be (vrf, mrf or something else)
      
      -  packets flow through the VRF device in both directions allowing the
         following:
         - tcpdump -i vrf<n>
         - tc rules on vrf device
         - netfilter rules on vrf device
      
      TO-DO
      =====
      1. IPv6
      
      2. ipsec, xfrms
         - dst patch accepted into ipsec-next; will post VRF patch once merge happens
      
      3. listen filter to allow 1 socket to work with multiple VRF devices
         - i.e., bind to VRF's a, b, c only or NOT VRFs e, f, g
      
      Eric B:
        I have ipsec working with VRFs implemented using the VRF driver,
        including the worst case scenario of complete duplication in the
        networking config.
      
      Thanks to Nikolay for his many, many code reviews whipping the device
      driver into shape, and bug-Fixes and ideas from Hannes, Roopa Prabhu,
      Jon Toppins, Jamal.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d52736e2