1. 16 9月, 2013 1 次提交
  2. 28 8月, 2013 1 次提交
  3. 19 8月, 2013 2 次提交
  4. 16 8月, 2013 1 次提交
  5. 14 8月, 2013 1 次提交
    • H
      xfrm: make local error reporting more robust · 628e341f
      Hannes Frederic Sowa 提交于
      In xfrm4 and xfrm6 we need to take care about sockets of the other
      address family. This could happen because a 6in4 or 4in6 tunnel could
      get protected by ipsec.
      
      Because we don't want to have a run-time dependency on ipv6 when only
      using ipv4 xfrm we have to embed a pointer to the correct local_error
      function in xfrm_state_afinet and look it up when returning an error
      depending on the socket address family.
      
      Thanks to vi0ss for the great bug report:
      <https://bugzilla.kernel.org/show_bug.cgi?id=58691>
      
      v2:
      a) fix two more unsafe interpretations of skb->sk as ipv6 socket
         (xfrm6_local_dontfrag and __xfrm6_output)
      v3:
      a) add an EXPORT_SYMBOL_GPL(xfrm_local_error) to fix a link error when
         building ipv6 as a module (thanks to Steffen Klassert)
      
      Reported-by: <vi0oss@gmail.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      628e341f
  6. 06 8月, 2013 1 次提交
  7. 05 8月, 2013 1 次提交
  8. 01 8月, 2013 1 次提交
  9. 06 6月, 2013 1 次提交
    • F
      xfrm: add LINUX_MIB_XFRMACQUIREERROR statistic counter · 4c4d41f2
      Fan Du 提交于
      When host ping its peer, ICMP echo request packet triggers IPsec
      policy, then host negotiates SA secret with its peer. After IKE
      installed SA for OUT direction, but before SA for IN direction
      installed, host get ICMP echo reply from its peer. At the time
      being, the SA state for IN direction could be XFRM_STATE_ACQ,
      then the received packet will be dropped after adding
      LINUX_MIB_XFRMINSTATEINVALID statistic.
      
      Adding a LINUX_MIB_XFRMACQUIREERROR statistic counter for such
      scenario when SA in larval state is much clearer for user than
      LINUX_MIB_XFRMINSTATEINVALID which indicates the SA is totally
      bad.
      Signed-off-by: NFan Du <fan.du@windriver.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4c4d41f2
  10. 05 6月, 2013 1 次提交
  11. 01 6月, 2013 1 次提交
  12. 29 5月, 2013 1 次提交
  13. 23 5月, 2013 1 次提交
  14. 25 4月, 2013 1 次提交
  15. 25 3月, 2013 1 次提交
  16. 20 3月, 2013 1 次提交
  17. 19 3月, 2013 1 次提交
    • B
      xfrm: use xfrm direction when lookup policy · b5fb82c4
      Baker Zhang 提交于
      because xfrm policy direction has same value with corresponding
      flow direction, so this problem is covered.
      
      In xfrm_lookup and __xfrm_policy_check, flow_cache_lookup is used to
      accelerate the lookup.
      
      Flow direction is given to flow_cache_lookup by policy_to_flow_dir.
      
      When the flow cache is mismatched, callback 'resolver' is called.
      
      'resolver' requires xfrm direction,
      so convert direction back to xfrm direction.
      Signed-off-by: NBaker Zhang <baker.zhang@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b5fb82c4
  18. 06 3月, 2013 2 次提交
  19. 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
  20. 19 2月, 2013 2 次提交
  21. 11 2月, 2013 1 次提交
  22. 06 2月, 2013 1 次提交
    • S
      xfrm: Add a state resolution packet queue · a0073fe1
      Steffen Klassert 提交于
      As the default, we blackhole packets until the key manager resolves
      the states. This patch implements a packet queue where IPsec packets
      are queued until the states are resolved. We generate a dummy xfrm
      bundle, the output routine of the returned route enqueues the packet
      to a per policy queue and arms a timer that checks for state resolution
      when dst_output() is called. Once the states are resolved, the packets
      are sent out of the queue. If the states are not resolved after some
      time, the queue is flushed.
      
      This patch keeps the defaut behaviour to blackhole packets as long
      as we have no states. To enable the packet queue the sysctl
      xfrm_larval_drop must be switched off.
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      a0073fe1
  23. 01 2月, 2013 2 次提交
  24. 30 1月, 2013 1 次提交
  25. 21 1月, 2013 1 次提交
  26. 18 1月, 2013 1 次提交
    • N
      net/xfrm/xfrm_replay: avoid division by zero · e2f67259
      Nickolai Zeldovich 提交于
      All of the xfrm_replay->advance functions in xfrm_replay.c check if
      x->replay_esn->replay_window is zero (and return if so).  However,
      one of them, xfrm_replay_advance_bmp(), divides by that value (in the
      '%' operator) before doing the check, which can potentially trigger
      a divide-by-zero exception.  Some compilers will also assume that the
      earlier division means the value cannot be zero later, and thus will
      eliminate the subsequent zero check as dead code.
      
      This patch moves the division to after the check.
      Signed-off-by: NNickolai Zeldovich <nickolai@csail.mit.edu>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      e2f67259
  27. 17 1月, 2013 1 次提交
  28. 16 1月, 2013 2 次提交
  29. 12 1月, 2013 1 次提交
  30. 08 1月, 2013 1 次提交
  31. 07 1月, 2013 1 次提交
  32. 19 11月, 2012 2 次提交
    • E
      net: Allow userns root to control llc, netfilter, netlink, packet, and xfrm · df008c91
      Eric W. Biederman 提交于
      Allow an unpriviled user who has created a user namespace, and then
      created a network namespace to effectively use the new network
      namespace, by reducing capable(CAP_NET_ADMIN) and
      capable(CAP_NET_RAW) calls to be ns_capable(net->user_ns,
      CAP_NET_ADMIN), or capable(net->user_ns, CAP_NET_RAW) calls.
      
      Allow creation of af_key sockets.
      Allow creation of llc sockets.
      Allow creation of af_packet sockets.
      
      Allow sending xfrm netlink control messages.
      
      Allow binding to netlink multicast groups.
      Allow sending to netlink multicast groups.
      Allow adding and dropping netlink multicast groups.
      Allow sending to all netlink multicast groups and port ids.
      
      Allow reading the netfilter SO_IP_SET socket option.
      Allow sending netfilter netlink messages.
      Allow setting and getting ip_vs netfilter socket options.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      df008c91
    • E
      net: Don't export sysctls to unprivileged users · 464dc801
      Eric W. Biederman 提交于
      In preparation for supporting the creation of network namespaces
      by unprivileged users, modify all of the per net sysctl exports
      and refuse to allow them to unprivileged users.
      
      This makes it safe for unprivileged users in general to access
      per net sysctls, and allows sysctls to be exported to unprivileged
      users on an individual basis as they are deemed safe.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      464dc801
  33. 13 11月, 2012 1 次提交
    • S
      net: xfrm: use __this_cpu_read per-cpu helper · f7c83bcb
      Shan Wei 提交于
      this_cpu_ptr/this_cpu_read is faster than per_cpu_ptr(p, smp_processor_id())
      and can reduce  memory accesses.
      The latter helper needs to find the offset for current cpu,
      and needs more assembler instructions which objdump shows in following.
      
      this_cpu_ptr relocates and address. this_cpu_read() relocates the address
      and performs the fetch. this_cpu_read() saves you more instructions
      since it can do the relocation and the fetch in one instruction.
      
      per_cpu_ptr(p, smp_processor_id()):
        1e:   65 8b 04 25 00 00 00 00         mov    %gs:0x0,%eax
        26:   48 98                           cltq
        28:   31 f6                           xor    %esi,%esi
        2a:   48 c7 c7 00 00 00 00            mov    $0x0,%rdi
        31:   48 8b 04 c5 00 00 00 00         mov    0x0(,%rax,8),%rax
        39:   c7 44 10 04 14 00 00 00         movl   $0x14,0x4(%rax,%rdx,1)
      
      this_cpu_ptr(p)
        1e:   65 48 03 14 25 00 00 00 00      add    %gs:0x0,%rdx
        27:   31 f6                           xor    %esi,%esi
        29:   c7 42 04 14 00 00 00            movl   $0x14,0x4(%rdx)
        30:   48 c7 c7 00 00 00 00            mov    $0x0,%rdi
      Signed-off-by: NShan Wei <davidshan@tencent.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      f7c83bcb
  34. 08 11月, 2012 1 次提交