1. 25 3月, 2019 6 次提交
    • L
      batman-adv: Add multicast-to-unicast support for multiple targets · 32e72744
      Linus Lüssing 提交于
      With this patch multicast packets with a limited number of destinations
      (current default: 16) will be split and transmitted by the originator as
      individual unicast transmissions.
      
      Wifi broadcasts with their low bitrate are still a costly undertaking.
      In a mesh network this cost multiplies with the overall size of the mesh
      network. Therefore using multiple unicast transmissions instead of
      broadcast flooding is almost always less burdensome for the mesh
      network.
      
      The maximum amount of unicast packets can be configured via the newly
      introduced multicast_fanout parameter. If this limit is exceeded
      distribution will fall back to classic broadcast flooding.
      
      The multicast-to-unicast conversion is performed on the initial
      multicast sender node and counts on a final destination node, mesh-wide
      basis (and not next hop, neighbor node basis).
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      32e72744
    • L
      batman-adv: allow updating DAT entry timeouts on incoming ARP Replies · 099e6cc1
      Linus Lüssing 提交于
      Currently incoming ARP Replies, for example via a DHT-PUT message, do
      not update the timeout for an already existing DAT entry. These ARP
      Replies are dropped instead.
      
      This however defeats the purpose of the DHCPACK snooping, for instance.
      Right now, a DAT entry in the DHT will be purged every five minutes,
      likely leading to a mesh-wide ARP Request broadcast after this timeout.
      Which then recreates the entry. The idea of the DHCPACK snooping is to
      be able to update an entry before a timeout happens, to avoid ARP Request
      flooding.
      
      This patch fixes this issue by updating a DAT entry on incoming
      ARP Replies even if a matching DAT entry already exists. While still
      filtering the ARP Reply towards the soft-interface, to avoid duplicate
      messages on the client device side.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Acked-by: NAntonio Quartulli <a@unstable.cc>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      099e6cc1
    • S
      batman-adv: Adjust name for batadv_dat_send_data · c2d8b9a6
      Sven Eckelmann 提交于
      The send functions in batman-adv are expected to consume the skb when
      either the data is queued up for the underlying driver or when some
      precondition failed. batadv_dat_send_data didn't do this and instead
      created a copy of the skb, modified it and queued the copy up for
      transmission. The caller has to take care that the skb is handled correctly
      (for example free'd) when batadv_dat_send_data returns.
      
      This unclear behavior already lead to memory leaks in the recent past.
      Renaming the function to batadv_dat_forward_data should make it easier to
      identify that the data is forwarded but the skb is not actually
      send+consumed.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      c2d8b9a6
    • S
      batman-adv: Warn about sysfs file access · 1392f553
      Sven Eckelmann 提交于
      The sysfs files to read and modify the configuration settings were replaced
      by the batadv generic netlink family. They are also marked as obsolete in
      the ABI documentation. But not all users of this functionality might follow
      changes in the Documentation/ABI/obsolete/ folder. They might benefit from
      a warning messages about the deprecation of the functionality which they
      just tried to access
      
        batman_adv: [Deprecated]: batctl (pid 30381) Use of sysfs file "orig_interval".
        Use batadv genl family instead
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      1392f553
    • S
      batman-adv: Make sysfs support optional · 0fa4c30d
      Sven Eckelmann 提交于
      The sysfs files will be marked as deprecated in the near future. They are
      already replaced by the batadv generic netlink family. Add an Kconfig
      option to disable the sysfs support for users who want to test their tools
      or want to safe some space. This setting should currently still be enabled
      by default to keep backward compatible with legacy tools.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      0fa4c30d
    • S
      batman-adv: Drop license boilerplate · 0d5f20c4
      Sven Eckelmann 提交于
      All files got a SPDX-License-Identifier with commit 7db7d9f3
      ("batman-adv: Add SPDX license identifier above copyright header"). All the
      required information about the license conditions can be found in
      LICENSES/.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      0d5f20c4
  2. 13 2月, 2019 1 次提交
    • E
      batman-adv: fix uninit-value in batadv_interface_tx() · 4ffcbfac
      Eric Dumazet 提交于
      KMSAN reported batadv_interface_tx() was possibly using a
      garbage value [1]
      
      batadv_get_vid() does have a pskb_may_pull() call
      but batadv_interface_tx() does not actually make sure
      this did not fail.
      
      [1]
      BUG: KMSAN: uninit-value in batadv_interface_tx+0x908/0x1e40 net/batman-adv/soft-interface.c:231
      CPU: 0 PID: 10006 Comm: syz-executor469 Not tainted 4.20.0-rc7+ #5
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x173/0x1d0 lib/dump_stack.c:113
       kmsan_report+0x12e/0x2a0 mm/kmsan/kmsan.c:613
       __msan_warning+0x82/0xf0 mm/kmsan/kmsan_instr.c:313
       batadv_interface_tx+0x908/0x1e40 net/batman-adv/soft-interface.c:231
       __netdev_start_xmit include/linux/netdevice.h:4356 [inline]
       netdev_start_xmit include/linux/netdevice.h:4365 [inline]
       xmit_one net/core/dev.c:3257 [inline]
       dev_hard_start_xmit+0x607/0xc40 net/core/dev.c:3273
       __dev_queue_xmit+0x2e42/0x3bc0 net/core/dev.c:3843
       dev_queue_xmit+0x4b/0x60 net/core/dev.c:3876
       packet_snd net/packet/af_packet.c:2928 [inline]
       packet_sendmsg+0x8306/0x8f30 net/packet/af_packet.c:2953
       sock_sendmsg_nosec net/socket.c:621 [inline]
       sock_sendmsg net/socket.c:631 [inline]
       __sys_sendto+0x8c4/0xac0 net/socket.c:1788
       __do_sys_sendto net/socket.c:1800 [inline]
       __se_sys_sendto+0x107/0x130 net/socket.c:1796
       __x64_sys_sendto+0x6e/0x90 net/socket.c:1796
       do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
       entry_SYSCALL_64_after_hwframe+0x63/0xe7
      RIP: 0033:0x441889
      Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 bb 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007ffdda6fd468 EFLAGS: 00000216 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 0000000000441889
      RDX: 000000000000000e RSI: 00000000200000c0 RDI: 0000000000000003
      RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000216 R12: 00007ffdda6fd4c0
      R13: 00007ffdda6fd4b0 R14: 0000000000000000 R15: 0000000000000000
      
      Uninit was created at:
       kmsan_save_stack_with_flags mm/kmsan/kmsan.c:204 [inline]
       kmsan_internal_poison_shadow+0x92/0x150 mm/kmsan/kmsan.c:158
       kmsan_kmalloc+0xa6/0x130 mm/kmsan/kmsan_hooks.c:176
       kmsan_slab_alloc+0xe/0x10 mm/kmsan/kmsan_hooks.c:185
       slab_post_alloc_hook mm/slab.h:446 [inline]
       slab_alloc_node mm/slub.c:2759 [inline]
       __kmalloc_node_track_caller+0xe18/0x1030 mm/slub.c:4383
       __kmalloc_reserve net/core/skbuff.c:137 [inline]
       __alloc_skb+0x309/0xa20 net/core/skbuff.c:205
       alloc_skb include/linux/skbuff.h:998 [inline]
       alloc_skb_with_frags+0x1c7/0xac0 net/core/skbuff.c:5220
       sock_alloc_send_pskb+0xafd/0x10e0 net/core/sock.c:2083
       packet_alloc_skb net/packet/af_packet.c:2781 [inline]
       packet_snd net/packet/af_packet.c:2872 [inline]
       packet_sendmsg+0x661a/0x8f30 net/packet/af_packet.c:2953
       sock_sendmsg_nosec net/socket.c:621 [inline]
       sock_sendmsg net/socket.c:631 [inline]
       __sys_sendto+0x8c4/0xac0 net/socket.c:1788
       __do_sys_sendto net/socket.c:1800 [inline]
       __se_sys_sendto+0x107/0x130 net/socket.c:1796
       __x64_sys_sendto+0x6e/0x90 net/socket.c:1796
       do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
       entry_SYSCALL_64_after_hwframe+0x63/0xe7
      
      Fixes: c6c8fea2 ("net: Add batman-adv meshing protocol")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Cc:	Marek Lindner <mareklindner@neomailbox.ch>
      Cc:	Simon Wunderlich <sw@simonwunderlich.de>
      Cc:	Antonio Quartulli <a@unstable.cc>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4ffcbfac
  3. 09 2月, 2019 19 次提交
    • S
      batman-adv: Trigger genl notification on sysfs config change · 7e6f461e
      Sven Eckelmann 提交于
      The generic netlink code is expected to trigger notification messages when
      configuration might have been changed. But the configuration of batman-adv
      is most of the time still done using sysfs. So the sysfs interface should
      also trigger the corresponding netlink messages via the "config" multicast
      group.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      7e6f461e
    • S
      batman-adv: Add throughput_override hardif genl configuration · 9a182242
      Sven Eckelmann 提交于
      The B.A.T.M.A.N. V implementation tries to estimate the link throughput of
      an interface to an originator using different automatic methods. It is
      still possible to overwrite it the link throughput for all reachable
      originators via this interface.
      
      The BATADV_CMD_SET_HARDIF/BATADV_CMD_GET_HARDIF commands allow to set/get
      the configuration of this feature using the u32
      BATADV_ATTR_THROUGHPUT_OVERRIDE attribute. The used unit is in 100 Kbit/s.
      If the value is set to 0 then batman-adv will try to estimate the
      throughput by itself.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      9a182242
    • S
      batman-adv: Add elp_interval hardif genl configuration · a1080082
      Sven Eckelmann 提交于
      The ELP packets are transmitted every elp_interval milliseconds on an
      slave/hard-interface. This value can be changed using the configuration
      interface.
      
      The BATADV_CMD_SET_HARDIF/BATADV_CMD_GET_HARDIF commands allow to set/get
      the configuration of this feature using the u32 BATADV_ATTR_ELP_INTERVAL
      attribute.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      a1080082
    • S
      batman-adv: Add orig_interval mesh genl configuration · 7b751b39
      Sven Eckelmann 提交于
      The OGM packets are transmitted every orig_interval milliseconds. This
      value can be changed using the configuration interface.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the u32 BATADV_ATTR_ORIG_INTERVAL
      attribute.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      7b751b39
    • S
      batman-adv: Add network_coding mesh genl configuration · 6c57cde6
      Sven Eckelmann 提交于
      The mesh interface can use (in an homogeneous mesh) network coding, a
      mechanism that aims to increase the overall network throughput by fusing
      multiple packets in one transmission.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the BATADV_ATTR_NETWORK_CODING_ENABLED
      attribute. Setting the u8 to zero will disable this feature and setting it
      to something else is enabling this feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      6c57cde6
    • S
      batman-adv: Add multicast forceflood mesh genl configuration · f75b56bc
      Sven Eckelmann 提交于
      The mesh interface can optimize the flooding of multicast packets based on
      the content of the global translation tables. To disable this behavior and
      use the broadcast-like flooding of the packets, forceflood has to be
      enabled.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the
      BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED attribute. Setting the u8 to zero
      will disable this feature (allowing multicast optimizations) and setting it
      to something else is enabling this feature (forcing simple flooding).
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      f75b56bc
    • S
      batman-adv: Add log_level mesh genl configuration · b85bd091
      Sven Eckelmann 提交于
      In contrast to other modules, batman-adv allows to set the debug message
      verbosity per mesh/soft-interface and not per module (via modparam).
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the u32 (bitmask) BATADV_ATTR_LOG_LEVEL
      attribute.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      b85bd091
    • S
      batman-adv: Add hop_penalty mesh genl configuration · bfc7f1be
      Sven Eckelmann 提交于
      The TQ (B.A.T.M.A.N. IV) and throughput values (B.A.T.M.A.N. V) are reduced
      when they are forwarded. One of the reductions is the penalty for
      traversing an additional hop. This hop_penalty (0-255) defines the
      percentage of reduction (0-100%).
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the u8 BATADV_ATTR_HOP_PENALTY
      attribute.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      bfc7f1be
    • S
      batman-adv: Add gateway mesh genl configuration · e2d0d35b
      Sven Eckelmann 提交于
      The mesh/soft-interface can optimize the handling of DHCP packets. Instead
      of flooding them through the whole mesh, it can be forwarded as unicast to
      a specific gateway server. The originator which injects the packets in the
      mesh has to select (based on sel_class thresholds) a responsible gateway
      server. This is done by switching this originator to the gw_mode client.
      The servers announce their forwarding bandwidth (download/upload) when the
      gw_mode server was selected.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the attributes:
      
      * u8 BATADV_ATTR_GW_MODE (0 == off, 1 == client, 2 == server)
      * u32 BATADV_ATTR_GW_BANDWIDTH_DOWN (in 100 kbit/s steps)
      * u32 BATADV_ATTR_GW_BANDWIDTH_UP (in 100 kbit/s steps)
      * u32 BATADV_ATTR_GW_SEL_CLASS
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      e2d0d35b
    • S
      batman-adv: Add fragmentation mesh genl configuration · 3e15b06e
      Sven Eckelmann 提交于
      The mesh interface can fragment unicast packets when the packet size
      exceeds the outgoing slave/hard-interface MTU.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the BATADV_ATTR_FRAGMENTATION_ENABLED
      attribute. Setting the u8 to zero will disable this feature and setting it
      to something else is enabling this feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      3e15b06e
    • S
      batman-adv: Add distributed_arp_table mesh genl configuration · a1c8de80
      Sven Eckelmann 提交于
      The mesh interface can use a distributed hash table to answer ARP requests
      without flooding the request through the whole mesh.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the
      BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED attribute. Setting the u8 to zero
      will disable this feature and setting it to something else is enabling this
      feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      a1c8de80
    • S
      batman-adv: Add bridge_loop_avoidance mesh genl configuration · 43ff6105
      Sven Eckelmann 提交于
      The mesh interface can try to detect loops in the same mesh caused by
      (indirectly) bridged mesh/soft-interfaces of different nodes. Some of the
      loops can also be resolved without breaking the mesh.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the
      BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED attribute. Setting the u8 to zero
      will disable this feature and setting it to something else is enabling this
      feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      43ff6105
    • S
      batman-adv: Add bonding mesh genl configuration · d7e52506
      Sven Eckelmann 提交于
      The mesh interface can use multiple slave/hard-interface ports at the same
      time to transport the traffic to other nodes.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the BATADV_ATTR_BONDING_ENABLED
      attribute. Setting the u8 to zero will disable this feature and setting it
      to something else is enabling this feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      d7e52506
    • S
      batman-adv: Add ap_isolation mesh/vlan genl configuration · e43d16b8
      Sven Eckelmann 提交于
      The mesh interface can drop messages between clients to implement a
      mesh-wide AP isolation.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH and
      BATADV_CMD_SET_VLAN/BATADV_CMD_GET_VLAN commands allow to set/get the
      configuration of this feature using the BATADV_ATTR_AP_ISOLATION_ENABLED
      attribute. Setting the u8 to zero will disable this feature and setting it
      to something else is enabling this feature.
      
      This feature also requires that skbuff which should be handled as isolated
      are marked. The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to
      set/get the mark/mask using the u32 attributes BATADV_ATTR_ISOLATION_MARK
      and BATADV_ATTR_ISOLATION_MASK.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      e43d16b8
    • S
      batman-adv: Add aggregated_ogms mesh genl configuration · 9ab4cee5
      Sven Eckelmann 提交于
      The mesh interface can delay OGM messages to aggregate different ogms
      together in a single OGM packet.
      
      The BATADV_CMD_SET_MESH/BATADV_CMD_GET_MESH commands allow to set/get the
      configuration of this feature using the BATADV_ATTR_AGGREGATED_OGMS_ENABLED
      attribute. Setting the u8 to zero will disable this feature and setting it
      to something else is enabling this feature.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      9ab4cee5
    • S
      batman-adv: Prepare framework for vlan genl config · 49e7e37c
      Sven Eckelmann 提交于
      The batman-adv configuration interface was implemented solely using sysfs.
      This approach was condemned by non-batadv developers as "huge mistake".
      Instead a netlink/genl based implementation was suggested.
      
      Beside the mesh/soft-interface specific configuration, the VLANs on top of
      the mesh/soft-interface have configuration settings. The genl interface
      reflects this by allowing to get/set it using the vlan specific commands
      BATADV_CMD_GET_VLAN/BATADV_CMD_SET_VLAN.
      
      The set command BATADV_CMD_SET_MESH will also notify interested userspace
      listeners of the "config" mcast group using the BATADV_CMD_SET_VLAN command
      message type that settings might have been changed and what the current
      values are.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      49e7e37c
    • S
      batman-adv: Prepare framework for hardif genl config · 5c55a40f
      Sven Eckelmann 提交于
      The batman-adv configuration interface was implemented solely using sysfs.
      This approach was condemned by non-batadv developers as "huge mistake".
      Instead a netlink/genl based implementation was suggested.
      
      Beside the mesh/soft-interface specific configuration, the
      slave/hard-interface have B.A.T.M.A.N. V specific configuration settings.
      The genl interface reflects this by allowing to get/set it using the
      hard-interface specific commands.
      
      The BATADV_CMD_GET_HARDIFS (or short version BATADV_CMD_GET_HARDIF) is
      reused as get command because it already allow sto dump the content of
      other information from the slave/hard-interface which are not yet
      configuration specific.
      
      The set command BATADV_CMD_SET_HARDIF will also notify interested userspace
      listeners of the "config" mcast group using the BATADV_CMD_SET_HARDIF
      command message type that settings might have been changed and what the
      current values are.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      5c55a40f
    • S
      batman-adv: Prepare framework for mesh genl config · 60040513
      Sven Eckelmann 提交于
      The batman-adv configuration interface was implemented solely using sysfs.
      This approach was condemned by non-batadv developers as "huge mistake".
      Instead a netlink/genl based implementation was suggested.
      
      The main objects for this configuration is the mesh/soft-interface object.
      Its actual object in memory already contains most of the available
      configuration settings. The genl interface reflects this by allowing to
      get/set it using the mesh specific commands.
      
      The BATADV_CMD_GET_MESH_INFO (or short version BATADV_CMD_GET_MESH) is
      reused as get command because it already provides the content of other
      information from the mesh/soft-interface which are not yet configuration
      specific.
      
      The set command BATADV_CMD_SET_MESH will also notify interested userspace
      listeners of the "config" mcast group using the BATADV_CMD_SET_MESH command
      message type that settings might have been changed and what the current
      values are.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      60040513
    • S
      batman-adv: Move common genl doit code pre/post hooks · c4a7a8d9
      Sven Eckelmann 提交于
      The commit ff4c92d8 ("genetlink: introduce pre_doit/post_doit hooks")
      intoduced a mechanism to run specific code for doit hooks before/after the
      hooks are run. Since all doit hooks are requiring the batadv softif, it
      should be retrieved/freed in these helpers to simplify the code.
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      c4a7a8d9
  4. 07 2月, 2019 1 次提交
  5. 25 1月, 2019 1 次提交
    • F
      batman-adv: release station info tidstats · 7d652669
      Felix Fietkau 提交于
      With the addition of TXQ stats in the per-tid statistics the struct
      station_info grew significantly. This resulted in stack size warnings
      due to the structure itself being above the limit for the warnings.
      
      To work around this, the TID array was allocated dynamically. Also a
      function to free this content was introduced with commit 7ea3e110
      ("cfg80211: release station info tidstats where needed") but the necessary
      changes were not provided for batman-adv's B.A.T.M.A.N. V implementation.
      Signed-off-by: NFelix Fietkau <nbd@nbd.name>
      Fixes: 8689c051 ("cfg80211: dynamically allocate per-tid stats for station info")
      [sven@narfation.org: add commit message]
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      7d652669
  6. 23 1月, 2019 1 次提交
    • L
      bridge: simplify ip_mc_check_igmp() and ipv6_mc_check_mld() calls · ba5ea614
      Linus Lüssing 提交于
      This patch refactors ip_mc_check_igmp(), ipv6_mc_check_mld() and
      their callers (more precisely, the Linux bridge) to not rely on
      the skb_trimmed parameter anymore.
      
      An skb with its tail trimmed to the IP packet length was initially
      introduced for the following three reasons:
      
      1) To be able to verify the ICMPv6 checksum.
      2) To be able to distinguish the version of an IGMP or MLD query.
         They are distinguishable only by their size.
      3) To avoid parsing data for an IGMPv3 or MLDv2 report that is
         beyond the IP packet but still within the skb.
      
      The first case still uses a cloned and potentially trimmed skb to
      verfiy. However, there is no need to propagate it to the caller.
      For the second and third case explicit IP packet length checks were
      added.
      
      This hopefully makes ip_mc_check_igmp() and ipv6_mc_check_mld() easier
      to read and verfiy, as well as easier to use.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ba5ea614
  7. 04 1月, 2019 2 次提交
    • S
      7a79d717
    • L
      Remove 'type' argument from access_ok() function · 96d4f267
      Linus Torvalds 提交于
      Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
      of the user address range verification function since we got rid of the
      old racy i386-only code to walk page tables by hand.
      
      It existed because the original 80386 would not honor the write protect
      bit when in kernel mode, so you had to do COW by hand before doing any
      user access.  But we haven't supported that in a long time, and these
      days the 'type' argument is a purely historical artifact.
      
      A discussion about extending 'user_access_begin()' to do the range
      checking resulted this patch, because there is no way we're going to
      move the old VERIFY_xyz interface to that model.  And it's best done at
      the end of the merge window when I've done most of my merges, so let's
      just get this done once and for all.
      
      This patch was mostly done with a sed-script, with manual fix-ups for
      the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.
      
      There were a couple of notable cases:
      
       - csky still had the old "verify_area()" name as an alias.
      
       - the iter_iov code had magical hardcoded knowledge of the actual
         values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
         really used it)
      
       - microblaze used the type argument for a debug printout
      
      but other than those oddities this should be a total no-op patch.
      
      I tried to fix up all architectures, did fairly extensive grepping for
      access_ok() uses, and the changes are trivial, but I may have missed
      something.  Any missed conversion should be trivially fixable, though.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96d4f267
  8. 01 1月, 2019 1 次提交
    • S
      batman-adv: Force mac header to start of data on xmit · 9114daa8
      Sven Eckelmann 提交于
      The caller of ndo_start_xmit may not already have called
      skb_reset_mac_header. The returned value of skb_mac_header/eth_hdr
      therefore can be in the wrong position and even outside the current skbuff.
      This for example happens when the user binds to the device using a
      PF_PACKET-SOCK_RAW with enabled qdisc-bypass:
      
        int opt = 4;
        setsockopt(sock, SOL_PACKET, PACKET_QDISC_BYPASS, &opt, sizeof(opt));
      
      Since eth_hdr is used all over the codebase, the batadv_interface_tx
      function must always take care of resetting it.
      
      Fixes: c6c8fea2 ("net: Add batman-adv meshing protocol")
      Reported-by: syzbot+9d7405c7faa390e60b4e@syzkaller.appspotmail.com
      Reported-by: syzbot+7d20bc3f1ddddc0f9079@syzkaller.appspotmail.com
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      9114daa8
  9. 31 12月, 2018 1 次提交
    • L
      batman-adv: Snoop DHCPACKs for DAT · b61ec31c
      Linus Lüssing 提交于
      In a 1000 nodes mesh network (Freifunk Hamburg) we can still see
      30KBit/s of ARP traffic (equalling about 25% of all layer two
      specific overhead, remaining after some filtering) flooded through
      the mesh. These 30KBit/s are mainly ARP Requests from the
      gateways / DHCP servers.
      
      By snooping DHCPACKs we can learn about MAC/IP address pairs
      in the DHCP range without relying on ARP. This patch is in preparation
      to eliminate the need for mesh wide message flooding for IPv4 address
      resolution.
      
      Also this allows to quickly update a MAC/IP pair at least in the DHT when
      DHCP reassigns an IP address to a new host.
      Signed-off-by: NLinus Lüssing <linus.luessing@c0d3.blue>
      Signed-off-by: NSven Eckelmann <sven@narfation.org>
      Signed-off-by: NSimon Wunderlich <sw@simonwunderlich.de>
      b61ec31c
  10. 30 12月, 2018 2 次提交
  11. 12 11月, 2018 5 次提交