1. 22 7月, 2010 9 次提交
  2. 16 7月, 2010 1 次提交
  3. 15 7月, 2010 1 次提交
    • T
      net: fix problem in reading sock TX queue · b0f77d0e
      Tom Herbert 提交于
      Fix problem in reading the tx_queue recorded in a socket.  In
      dev_pick_tx, the TX queue is read by doing a check with
      sk_tx_queue_recorded on the socket, followed by a sk_tx_queue_get.
      The problem is that there is not mutual exclusion across these
      calls in the socket so it it is possible that the queue in the
      sock can be invalidated after sk_tx_queue_recorded is called so
      that sk_tx_queue get returns -1, which sets 65535 in queue_index
      and thus dev_pick_tx returns 65536 which is a bogus queue and
      can cause crash in dev_queue_xmit.
      
      We fix this by only calling sk_tx_queue_get which does the proper
      checks.  The interface is that sk_tx_queue_get returns the TX queue
      if the sock argument is non-NULL and TX queue is recorded, else it
      returns -1.  sk_tx_queue_recorded is no longer used so it can be
      completely removed.
      Signed-off-by: NTom Herbert <therbert@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0f77d0e
  4. 13 7月, 2010 2 次提交
  5. 03 7月, 2010 2 次提交
  6. 01 7月, 2010 4 次提交
  7. 29 6月, 2010 2 次提交
  8. 27 6月, 2010 1 次提交
  9. 26 6月, 2010 1 次提交
    • E
      snmp: add align parameter to snmp_mib_init() · 1823e4c8
      Eric Dumazet 提交于
      In preparation for 64bit snmp counters for some mibs,
      add an 'align' parameter to snmp_mib_init(), instead
      of assuming mibs only contain 'unsigned long' fields.
      
      Callers can use __alignof__(type) to provide correct
      alignment.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      CC: Vlad Yasevich <vladislav.yasevich@hp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1823e4c8
  10. 25 6月, 2010 2 次提交
  11. 24 6月, 2010 3 次提交
  12. 22 6月, 2010 1 次提交
    • J
      mac80211: Add interface for driver to temporarily disable dynamic ps · f90754c1
      Juuso Oikarinen 提交于
      This mechanism introduced in this patch applies (at least) for hardware
      designs using a single shared antenna for both WLAN and BT. In these designs,
      the antenna must be toggled between WLAN and BT.
      
      In those hardware, managing WLAN co-existence with Bluetooth requires WLAN
      full power save whenever there is Bluetooth activity in order for WLAN to be
      able to periodically relinquish the antenna to be used for BT. This is because
      BT can only access the shared antenna when WLAN is idle or asleep.
      
      Some hardware, for instance the wl1271, are able to indicate to the host
      whenever there is BT traffic. In essence, the hardware will send an indication
      to the host whenever there is, for example, SCO traffic or A2DP traffic, and
      will send another indication when the traffic is over.
      
      The hardware gets information of Bluetooth traffic via hardware co-existence
      control lines - these lines are used to negotiate the shared antenna
      ownership. The hardware will give the antenna to BT whenever WLAN is sleeping.
      
      This patch adds the interface to mac80211 to facilitate temporarily disabling
      of dynamic power save as per request of the WLAN driver. This interface will
      immediately force WLAN to full powersave, hence allowing BT coexistence as
      described above.
      
      In these kind of shared antenna desings, when WLAN powersave is fully disabled,
      Bluetooth will not work simultaneously with WLAN at all. This patch does not
      address that problem. This interface will not change PSM state, so if PSM is
      disabled it will remain so. Solving this problem requires knowledge about BT
      state, and is best done in user-space.
      Signed-off-by: NJuuso Oikarinen <juuso.oikarinen@nokia.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      f90754c1
  13. 21 6月, 2010 3 次提交
  14. 17 6月, 2010 7 次提交
    • P
      netfilter: nf_nat: support user-specified SNAT rules in LOCAL_IN · c68cd6cc
      Patrick McHardy 提交于
      2.6.34 introduced 'conntrack zones' to deal with cases where packets
      from multiple identical networks are handled by conntrack/NAT. Packets
      are looped through veth devices, during which they are NATed to private
      addresses, after which they can continue normally through the stack
      and possibly have NAT rules applied a second time.
      
      This works well, but is needlessly complicated for cases where only
      a single SNAT/DNAT mapping needs to be applied to these packets. In that
      case, all that needs to be done is to assign each network to a seperate
      zone and perform NAT as usual. However this doesn't work for packets
      destined for the machine performing NAT itself since its corrently not
      possible to configure SNAT mappings for the LOCAL_IN chain.
      
      This patch adds a new INPUT chain to the NAT table and changes the
      targets performing SNAT to be usable in that chain.
      
      Example usage with two identical networks (192.168.0.0/24) on eth0/eth1:
      
      iptables -t raw -A PREROUTING -i eth0 -j CT --zone 1
      iptables -t raw -A PREROUTING -i eth0 -j MARK --set-mark 1
      iptables -t raw -A PREROUTING -i eth1 -j CT --zone 2
      iptabels -t raw -A PREROUTING -i eth1 -j MARK --set-mark 2
      
      iptables -t nat -A INPUT       -m mark --mark 1 -j NETMAP --to 10.0.0.0/24
      iptables -t nat -A POSTROUTING -m mark --mark 1 -j NETMAP --to 10.0.0.0/24
      iptables -t nat -A INPUT       -m mark --mark 2 -j NETMAP --to 10.0.1.0/24
      iptables -t nat -A POSTROUTING -m mark --mark 2 -j NETMAP --to 10.0.1.0/24
      
      iptables -t raw -A PREROUTING -d 10.0.0.0/24 -j CT --zone 1
      iptables -t raw -A OUTPUT     -d 10.0.0.0/24 -j CT --zone 1
      iptables -t raw -A PREROUTING -d 10.0.1.0/24 -j CT --zone 2
      iptables -t raw -A OUTPUT     -d 10.0.1.0/24 -j CT --zone 2
      
      iptables -t nat -A PREROUTING -d 10.0.0.0/24 -j NETMAP --to 192.168.0.0/24
      iptables -t nat -A OUTPUT     -d 10.0.0.0/24 -j NETMAP --to 192.168.0.0/24
      iptables -t nat -A PREROUTING -d 10.0.1.0/24 -j NETMAP --to 192.168.0.0/24
      iptables -t nat -A OUTPUT     -d 10.0.1.0/24 -j NETMAP --to 192.168.0.0/24
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      c68cd6cc
    • E
      af_unix: Allow credentials to work across user and pid namespaces. · 7361c36c
      Eric W. Biederman 提交于
      In unix_skb_parms store pointers to struct pid and struct cred instead
      of raw uid, gid, and pid values, then translate the credentials on
      reception into values that are meaningful in the receiving processes
      namespaces.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7361c36c
    • E
      scm: Capture the full credentials of the scm sender. · 257b5358
      Eric W. Biederman 提交于
      Start capturing not only the userspace pid, uid and gid values of the
      sending process but also the struct pid and struct cred of the sending
      process as well.
      
      This is in preparation for properly supporting SCM_CREDENTIALS for
      sockets that have different uid and/or pid namespaces at the different
      ends.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NSerge E. Hallyn <serge@hallyn.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      257b5358
    • E
      af_unix: Allow SO_PEERCRED to work across namespaces. · 109f6e39
      Eric W. Biederman 提交于
      Use struct pid and struct cred to store the peer credentials on struct
      sock.  This gives enough information to convert the peer credential
      information to a value relative to whatever namespace the socket is in
      at the time.
      
      This removes nasty surprises when using SO_PEERCRED on socket
      connetions where the processes on either side are in different pid and
      user namespaces.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NDaniel Lezcano <daniel.lezcano@free.fr>
      Acked-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      109f6e39
    • E
      scm: Reorder scm_cookie. · 812e876e
      Eric W. Biederman 提交于
      Reorder the fields in scm_cookie so they pack better on 64bit.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Acked-by: NPavel Emelyanov <xemul@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      812e876e
    • F
      syncookies: check decoded options against sysctl settings · 8c763681
      Florian Westphal 提交于
      Discard the ACK if we find options that do not match current sysctl
      settings.
      
      Previously it was possible to create a connection with sack, wscale,
      etc. enabled even if the feature was disabled via sysctl.
      
      Also remove an unneeded call to tcp_sack_reset() in
      cookie_check_timestamp: Both call sites (cookie_v4_check,
      cookie_v6_check) zero "struct tcp_options_received", hand it to
      tcp_parse_options() (which does not change tcp_opt->num_sacks/dsack)
      and then call cookie_check_timestamp().
      
      Even if num_sacks/dsacks were changed, the structure is allocated on
      the stack and after cookie_check_timestamp returns only a few selected
      members are copied to the inet_request_sock.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8c763681
    • E
      inetpeer: restore small inet_peer structures · 317fe0e6
      Eric Dumazet 提交于
      Addition of rcu_head to struct inet_peer added 16bytes on 64bit arches.
      
      Thats a bit unfortunate, since old size was exactly 64 bytes.
      
      This can be solved, using an union between this rcu_head an four fields,
      that are normally used only when a refcount is taken on inet_peer.
      rcu_head is used only when refcnt=-1, right before structure freeing.
      
      Add a inet_peer_refcheck() function to check this assertion for a while.
      
      We can bring back SLAB_HWCACHE_ALIGN qualifier in kmem cache creation.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      317fe0e6
  15. 16 6月, 2010 1 次提交
    • E
      inetpeer: RCU conversion · aa1039e7
      Eric Dumazet 提交于
      inetpeer currently uses an AVL tree protected by an rwlock.
      
      It's possible to make most lookups use RCU
      
      1) Add a struct rcu_head to struct inet_peer
      
      2) add a lookup_rcu_bh() helper to perform lockless and opportunistic
      lookup. This is a normal function, not a macro like lookup().
      
      3) Add a limit to number of links followed by lookup_rcu_bh(). This is
      needed in case we fall in a loop.
      
      4) add an smp_wmb() in link_to_pool() right before node insert.
      
      5) make unlink_from_pool() use atomic_cmpxchg() to make sure it can take
      last reference to an inet_peer, since lockless readers could increase
      refcount, even while we hold peers.lock.
      
      6) Delay struct inet_peer freeing after rcu grace period so that
      lookup_rcu_bh() cannot crash.
      
      7) inet_getpeer() first attempts lockless lookup.
         Note this lookup can fail even if target is in AVL tree, but a
      concurrent writer can let tree in a non correct form.
         If this attemps fails, lock is taken a regular lookup is performed
      again.
      
      8) convert peers.lock from rwlock to a spinlock
      
      9) Remove SLAB_HWCACHE_ALIGN when peer_cachep is created, because
      rcu_head adds 16 bytes on 64bit arches, doubling effective size (64 ->
      128 bytes)
      In a future patch, this is probably possible to revert this part, if rcu
      field is put in an union to share space with rid, ip_id_count, tcp_ts &
      tcp_ts_stamp. These fields being manipulated only with refcnt > 0.
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa1039e7