1. 08 11月, 2013 1 次提交
  2. 23 10月, 2013 1 次提交
    • J
      macvlan: resolve ENOENT errors on creation · 47d4ab91
      John Fastabend 提交于
      After the commit below attempting to create macvlan devices was
      resulting in ENOENT errors,
      
      # ip link add link p3p2 type macvlan
      RTNETLINK answers: Invalid argument
      
      This happens because netdev_upper_dev_link() is called before
      register_netdevice() in the macvlan code. Through a call chain
      this results in a call to __netdev_adjacent_dev_insert() and
      finally a sysfs_create_link(). This requires the kobject of
      the macvlan to be registered which is done in register_netdevice().
      If there is no kobject which is the case here the ENOENT error
      is seen on the command line.
      
      To resolve this move the netdev_upper_dev_link() call below
      the register_netdevice() call. This aligns with vlan driver
      flow.
      
      Regression introduced here,
      
      commit 5831d66e
      Author: Veaceslav Falico <vfalico@redhat.com>
      Date:   Wed Sep 25 09:20:32 2013 +0200
      
          net: create sysfs symlinks for neighbour devices
      
      CC: Veaceslav Falico <vfalico@redhat.com>
      CC: Neil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NVeaceslav Falico <vfalico@redhat.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      47d4ab91
  3. 12 9月, 2013 1 次提交
  4. 04 9月, 2013 1 次提交
  5. 31 8月, 2013 1 次提交
  6. 06 8月, 2013 1 次提交
    • M
      macvlan: validate flags · 15127478
      Michael S. Tsirkin 提交于
      commit df8ef8f3
          macvlan: add FDB bridge ops and macvlan flags
      added a flags field to macvlan, which can be
      controlled from userspace.
      The idea is to make the interface future-proof
      so we can add flags and not new fields.
      
      However, flags value isn't validated, as a result,
      userspace can't detect which flags are supported.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: John Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      15127478
  7. 02 8月, 2013 2 次提交
  8. 24 7月, 2013 1 次提交
  9. 26 6月, 2013 1 次提交
  10. 13 6月, 2013 1 次提交
    • M
      macvlan: don't touch promisc without passthrough · 99ffc3e7
      Michael S. Tsirkin 提交于
      commit df8ef8f3
      "macvlan: add FDB bridge ops and macvlan flags"
      added a way to control NOPROMISC macvlan flag through netlink.
      
      However, with a non passthrough device we never set promisc on open,
      even if NOPROMISC is off.  As a result:
      
      If userspace clears NOPROMISC on open, then does not clear it on a
      netlink command, promisc counter is not decremented on stop and there
      will be no way to clear it once macvlan is detached.
      
      If userspace does not clear NOPROMISC on open, then sets NOPROMISC on a
      netlink command, promisc counter will be decremented from 0 and overflow
      to fffffffff with no way to clear promisc.
      
      To fix, simply ignore NOPROMISC flag in a netlink command for
      non-passthrough devices, same as we do at open/close.
      
      Since we touch this code anyway - check dev_set_promiscuity return code
      and pass it to users (though an error here is unlikely).
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Reviewed-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      99ffc3e7
  11. 29 5月, 2013 1 次提交
  12. 12 5月, 2013 1 次提交
    • J
      macvlan: fix passthru mode race between dev removal and rx path · 233c7df0
      Jiri Pirko 提交于
      Currently, if macvlan in passthru mode is created and data are rxed and
      you remove this device, following panic happens:
      
      NULL pointer dereference at 0000000000000198
      IP: [<ffffffffa0196058>] macvlan_handle_frame+0x153/0x1f7 [macvlan]
      
      I'm using following script to trigger this:
      <script>
      while [ 1 ]
      do
      	ip link add link e1 name macvtap0 type macvtap mode passthru
      	ip link set e1 up
      	ip link set macvtap0 up
      	IFINDEX=`ip link |grep macvtap0 | cut -f 1 -d ':'`
      	cat /dev/tap$IFINDEX  >/dev/null &
      	ip link del dev macvtap0
      done
      </script>
      
      I run this script while "ping -f" is running on another machine to send
      packets to e1 rx.
      
      Reason of the panic is that list_first_entry() is blindly called in
      macvlan_handle_frame() even if the list was empty. vlan is set to
      incorrect pointer which leads to the crash.
      
      I'm fixing this by protecting port->vlans list by rcu and by preventing
      from getting incorrect pointer in case the list is empty.
      
      Introduced by: commit eb06acdc "macvlan: Introduce 'passthru' mode to takeover the underlying device"
      Signed-off-by: NJiri Pirko <jiri@resnulli.us>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      233c7df0
  13. 20 4月, 2013 3 次提交
  14. 31 3月, 2013 1 次提交
    • E
      macvlan: use the right RCU api · e052f7e6
      Eric Dumazet 提交于
      Make sure we use proper API to fetch dev->rx_handler_data,
      instead of ugly casts.
      
      Rename macvlan_port_get() to macvlan_port_get_rtnl() to document fact
      that we hold RTNL when needed, with lockdep support.
      
      This removes sparse warnings as well (CONFIG_SPARSE_RCU_POINTER=y)
      
      CHECK   drivers/net/macvlan.c
      drivers/net/macvlan.c:706:37: warning: cast removes address space of expression
      drivers/net/macvlan.c:775:16: warning: cast removes address space of expression
      drivers/net/macvlan.c:924:16: warning: cast removes address space of expression
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e052f7e6
  15. 08 3月, 2013 1 次提交
  16. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      I'm not sure why, but the hlist for each entry iterators were conceived
      
              list_for_each_entry(pos, head, member)
      
      The hlist ones were greedy and wanted an extra parameter:
      
              hlist_for_each_entry(tpos, pos, head, member)
      
      Why did they need an extra pos parameter? I'm not quite sure. Not only
      they don't really need it, it also prevents the iterator from looking
      exactly like the list iterator, which is unfortunate.
      
      Besides the semantic patch, there was some manual work required:
      
       - Fix up the actual hlist iterators in linux/list.h
       - Fix up the declaration of other iterators based on the hlist ones.
       - A very small amount of places were using the 'node' parameter, this
       was modified to use 'obj->member' instead.
       - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
       properly, so those had to be fixed up manually.
      
      The semantic patch which is mostly the work of Peter Senna Tschudin is here:
      
      @@
      iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
      
      type T;
      expression a,c,d,e;
      identifier b;
      statement S;
      @@
      
      -T b;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
      [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
      [akpm@linux-foundation.org: checkpatch fixes]
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foudnation.org: redo intrusive kvm changes]
      Tested-by: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  17. 14 2月, 2013 1 次提交
  18. 09 2月, 2013 2 次提交
  19. 07 2月, 2013 1 次提交
  20. 18 1月, 2013 1 次提交
  21. 07 1月, 2013 1 次提交
  22. 05 1月, 2013 1 次提交
  23. 04 1月, 2013 1 次提交
  24. 02 10月, 2012 1 次提交
  25. 20 9月, 2012 1 次提交
  26. 11 5月, 2012 2 次提交
    • J
      net, drivers/net: Convert compare_ether_addr_64bits to ether_addr_equal_64bits · a6700db1
      Joe Perches 提交于
      Use the new bool function ether_addr_equal_64bits to add
      some clarity and reduce the likelihood for misuse of
      compare_ether_addr_64bits for sorting.
      
      Done via cocci script:
      
      $ cat compare_ether_addr_64bits.cocci
      @@
      expression a,b;
      @@
      -	!compare_ether_addr_64bits(a, b)
      +	ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	compare_ether_addr_64bits(a, b)
      +	!ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal_64bits(a, b) == 0
      +	ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	!ether_addr_equal_64bits(a, b) != 0
      +	!ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal_64bits(a, b) == 0
      +	!ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	ether_addr_equal_64bits(a, b) != 0
      +	ether_addr_equal_64bits(a, b)
      
      @@
      expression a,b;
      @@
      -	!!ether_addr_equal_64bits(a, b)
      +	ether_addr_equal_64bits(a, b)
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6700db1
    • D
      Revert "net: maintain namespace isolation between vlan and real device" · 59b9997b
      David S. Miller 提交于
      This reverts commit 8a83a00b.
      
      It causes regressions for S390 devices, because it does an
      unconditional DST drop on SKBs for vlans and the QETH device
      needs the neighbour entry hung off the DST for certain things
      on transmit.
      
      Arnd can't remember exactly why he even needed this change.
      
      Conflicts:
      
      	drivers/net/macvlan.c
      	net/8021q/vlan_dev.c
      	net/core/dev.c
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      59b9997b
  27. 16 4月, 2012 1 次提交
    • J
      macvlan: add FDB bridge ops and macvlan flags · df8ef8f3
      John Fastabend 提交于
      This adds FDB bridge ops to the macvlan device passthru mode.
      Additionally a flags field was added and a NOPROMISC bit to
      allow users to use passthru mode without the driver calling
      dev_set_promiscuity(). The flags field is a u16 placed in a
      4 byte hole (consuming 2 bytes) of the macvlan_dev struct.
      
      We want to do this so that the macvlan driver or stack
      above the macvlan driver does not have to process every
      packet. For the use case where we know all the MAC addresses
      of the endstations above us this works well.
      
      This patch is a result of Roopa Prabhu's work. Follow up
      patches are needed for VEPA and VEB macvlan modes.
      
      v2: Change from distinct nopromisc mode to a flags field to
          configure this. This avoids the tendency to add a new
          mode every time we need some slightly different behavior.
      v3: fix error in dev_set_promiscuity and add change and get
          link attributes for flags.
      
      CC: Roopa Prabhu <roprabhu@cisco.com>
      CC: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      df8ef8f3
  28. 02 4月, 2012 1 次提交
  29. 16 2月, 2012 1 次提交
  30. 24 1月, 2012 1 次提交
  31. 09 12月, 2011 2 次提交
  32. 05 11月, 2011 1 次提交
    • S
      macvlan: receive multicast with local address · 729e72a1
      stephen hemminger 提交于
      When implementing VRRP v2 using macvlan several problems were
      discovered.  VRRP is weird in that all routers participating
      in a redundant group use the same virtual MAC address.
      Macvlan is a natural driver to use for this but it doesn't
      work.  The problem is that packets with a macvlan device's
      source address are not received.
      
      The problem is actually a regression that date back almost 2 years now.
      The original problems started with:
      
      commit 618e1b74
      Author: Arnd Bergmann <arnd@arndb.de>
      Date:   Thu Nov 26 06:07:10 2009 +0000
      
          macvlan: implement bridge, VEPA and private mode
      
      This patches restores the original 2.6.32 behavior. Allowing multicast
      packets received with the VRRP source address to be received.
      Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      729e72a1
  33. 19 10月, 2011 1 次提交
  34. 05 10月, 2011 1 次提交