1. 28 2月, 2006 1 次提交
    • H
      [IPSEC]: Kill post_input hook and do NAT-T in esp_input directly · 752c1f4c
      Herbert Xu 提交于
      The only reason post_input exists at all is that it gives us the
      potential to adjust the checksums incrementally in future which
      we ought to do.
      
      However, after thinking about it for a bit we can adjust the
      checksums without using this post_input stuff at all.  The crucial
      point is that only the inner-most NAT-T SA needs to be considered
      when adjusting checksums.  What's more, the checksum adjustment
      comes down to a single u32 due to the linearity of IP checksums.
      
      We just happen to have a spare u32 lying around in our skb structure :)
      When ip_summed is set to CHECKSUM_NONE on input, the value of skb->csum
      is currently unused.  All we have to do is to make that the checksum
      adjustment and voila, there goes all the post_input and decap structures!
      
      I've left in the decap data structures for now since it's intricately
      woven into the sec_path stuff.  We can kill them later too.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      752c1f4c
  2. 24 2月, 2006 1 次提交
  3. 20 2月, 2006 1 次提交
    • P
      [XFRM]: Fix policy double put · 99511014
      Patrick McHardy 提交于
      The policy is put once immediately and once at the error label, which results
      in the following Oops:
      
      kernel BUG at net/xfrm/xfrm_policy.c:250!
      invalid opcode: 0000 [#2]
      PREEMPT
      [...]
      CPU:    0
      EIP:    0060:[<c028caf7>]    Not tainted VLI
      EFLAGS: 00210246   (2.6.16-rc3 #39)
      EIP is at __xfrm_policy_destroy+0xf/0x46
      eax: d49f2000   ebx: d49f2000   ecx: f74bd880   edx: f74bd280
      esi: d49f2000   edi: 00000001   ebp: cd506dcc   esp: cd506dc8
      ds: 007b   es: 007b   ss: 0068
      Process ssh (pid: 31970, threadinfo=cd506000 task=cfb04a70)
      Stack: <0>cd506000 cd506e34 c028e92b ebde7280 cd506e58 cd506ec0 f74bd280 00000000
             00000214 0000000a 0000000a 00000000 00000002 f7ae6000 00000000 cd506e58
             cd506e14 c0299e36 f74bd280 e873fe00 c02943fd cd506ec0 ebde7280 f271f440
      Call Trace:
       [<c0103a44>] show_stack_log_lvl+0xaa/0xb5
       [<c0103b75>] show_registers+0x126/0x18c
       [<c0103e68>] die+0x14e/0x1db
       [<c02b6809>] do_trap+0x7c/0x96
       [<c0104237>] do_invalid_op+0x89/0x93
       [<c01035af>] error_code+0x4f/0x54
       [<c028e92b>] xfrm_lookup+0x349/0x3c2
       [<c02b0b0d>] ip6_datagram_connect+0x317/0x452
       [<c0281749>] inet_dgram_connect+0x49/0x54
       [<c02404d2>] sys_connect+0x51/0x68
       [<c0240928>] sys_socketcall+0x6f/0x166
       [<c0102aa1>] syscall_call+0x7/0xb
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      99511014
  4. 14 2月, 2006 1 次提交
    • H
      [IPSEC]: Fix strange IPsec freeze. · 00de651d
      Herbert Xu 提交于
      Problem discovered and initial patch by Olaf Kirch:
      
      	there's a problem with IPsec that has been bugging some of our users
      	for the last couple of kernel revs. Every now and then, IPsec will
      	freeze the machine completely. This is with openswan user land,
      	and with kernels up to and including 2.6.16-rc2.
      
      	I managed to debug this a little, and what happens is that we end
      	up looping in xfrm_lookup, and never get out. With a bit of debug
      	printks added, I can this happening:
      
      		ip_route_output_flow calls xfrm_lookup
      
      		xfrm_find_bundle returns NULL (apparently we're in the
      			middle of negotiating a new SA or something)
      
      		We therefore call xfrm_tmpl_resolve. This returns EAGAIN
      			We go to sleep, waiting for a policy update.
      			Then we loop back to the top
      
      		Apparently, the dst_orig that was passed into xfrm_lookup
      			has been dropped from the routing table (obsolete=2)
      			This leads to the endless loop, because we now create
      			a new bundle, check the new bundle and find it's stale
      			(stale_bundle -> xfrm_bundle_ok -> dst_check() return 0)
      
      	People have been testing with the patch below, which seems to fix the
      	problem partially. They still see connection hangs however (things
      	only clear up when they start a new ping or new ssh). So the patch
      	is obvsiouly not sufficient, and something else seems to go wrong.
      
      	I'm grateful for any hints you may have...
      
      I suggest that we simply bail out always.  If the dst decides to die
      on us later on, the packet will be dropped anyway.  So there is no
      great urgency to retry here.  Once we have the proper resolution
      queueing, we can then do the retry again.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: NOlaf Kirch <okir@suse.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      00de651d
  5. 08 2月, 2006 1 次提交
  6. 10 1月, 2006 1 次提交
  7. 08 1月, 2006 2 次提交
  8. 04 1月, 2006 1 次提交
    • T
      [LSM-IPSec]: Security association restriction. · df71837d
      Trent Jaeger 提交于
      This patch series implements per packet access control via the
      extension of the Linux Security Modules (LSM) interface by hooks in
      the XFRM and pfkey subsystems that leverage IPSec security
      associations to label packets.  Extensions to the SELinux LSM are
      included that leverage the patch for this purpose.
      
      This patch implements the changes necessary to the XFRM subsystem,
      pfkey interface, ipv4/ipv6, and xfrm_user interface to restrict a
      socket to use only authorized security associations (or no security
      association) to send/receive network packets.
      
      Patch purpose:
      
      The patch is designed to enable access control per packets based on
      the strongly authenticated IPSec security association.  Such access
      controls augment the existing ones based on network interface and IP
      address.  The former are very coarse-grained, and the latter can be
      spoofed.  By using IPSec, the system can control access to remote
      hosts based on cryptographic keys generated using the IPSec mechanism.
      This enables access control on a per-machine basis or per-application
      if the remote machine is running the same mechanism and trusted to
      enforce the access control policy.
      
      Patch design approach:
      
      The overall approach is that policy (xfrm_policy) entries set by
      user-level programs (e.g., setkey for ipsec-tools) are extended with a
      security context that is used at policy selection time in the XFRM
      subsystem to restrict the sockets that can send/receive packets via
      security associations (xfrm_states) that are built from those
      policies.
      
      A presentation available at
      www.selinux-symposium.org/2005/presentations/session2/2-3-jaeger.pdf
      from the SELinux symposium describes the overall approach.
      
      Patch implementation details:
      
      On output, the policy retrieved (via xfrm_policy_lookup or
      xfrm_sk_policy_lookup) must be authorized for the security context of
      the socket and the same security context is required for resultant
      security association (retrieved or negotiated via racoon in
      ipsec-tools).  This is enforced in xfrm_state_find.
      
      On input, the policy retrieved must also be authorized for the socket
      (at __xfrm_policy_check), and the security context of the policy must
      also match the security association being used.
      
      The patch has virtually no impact on packets that do not use IPSec.
      The existing Netfilter (outgoing) and LSM rcv_skb hooks are used as
      before.
      
      Also, if IPSec is used without security contexts, the impact is
      minimal.  The LSM must allow such policies to be selected for the
      combination of socket and remote machine, but subsequent IPSec
      processing proceeds as in the original case.
      
      Testing:
      
      The pfkey interface is tested using the ipsec-tools.  ipsec-tools have
      been modified (a separate ipsec-tools patch is available for version
      0.5) that supports assignment of xfrm_policy entries and security
      associations with security contexts via setkey and the negotiation
      using the security contexts via racoon.
      
      The xfrm_user interface is tested via ad hoc programs that set
      security contexts.  These programs are also available from me, and
      contain programs for setting, getting, and deleting policy for testing
      this interface.  Testing of sa functions was done by tracing kernel
      behavior.
      Signed-off-by: NTrent Jaeger <tjaeger@cse.psu.edu>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      df71837d
  9. 22 12月, 2005 1 次提交
    • D
      [IPSEC]: Fix policy updates missed by sockets · 9b78a82c
      David S. Miller 提交于
      The problem is that when new policies are inserted, sockets do not see
      the update (but all new route lookups do).
      
      This bug is related to the SA insertion stale route issue solved
      recently, and this policy visibility problem can be fixed in a similar
      way.
      
      The fix is to flush out the bundles of all policies deeper than the
      policy being inserted.  Consider beginning state of "outgoing"
      direction policy list:
      
      	policy A --> policy B --> policy C --> policy D
      
      First, realize that inserting a policy into a list only potentially
      changes IPSEC routes for that direction.  Therefore we need not bother
      considering the policies for other directions.  We need only consider
      the existing policies in the list we are doing the inserting.
      
      Consider new policy "B'", inserted after B.
      
      	policy A --> policy B --> policy B' --> policy C --> policy D
      
      Two rules:
      
      1) If policy A or policy B matched before the insertion, they
         appear before B' and thus would still match after inserting
         B'
      
      2) Policy C and D, now "shadowed" and after policy B', potentially
         contain stale routes because policy B' might be selected
         instead of them.
      
      Therefore we only need flush routes assosciated with policies
      appearing after a newly inserted policy, if any.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9b78a82c
  10. 20 12月, 2005 1 次提交
  11. 26 10月, 2005 1 次提交
  12. 09 10月, 2005 1 次提交
  13. 06 10月, 2005 1 次提交
  14. 05 10月, 2005 1 次提交
  15. 09 9月, 2005 1 次提交
  16. 30 8月, 2005 1 次提交
  17. 21 6月, 2005 1 次提交
  18. 19 6月, 2005 1 次提交
    • H
      [IPSEC] Kill spurious hard expire messages · 4666faab
      Herbert Xu 提交于
      This patch ensures that the hard state/policy expire notifications are
      only sent when the state/policy is successfully removed from their
      respective tables.
      
      As it is, it's possible for a state/policy to both expire through
      reaching a hard limit, as well as being deleted by the user.
      
      Note that this behaviour isn't actually forbidden by RFC 2367.
      However, it is a quality of implementation issue.
      
      As an added bonus, the restructuring in this patch will help
      eventually in moving the expire notifications from softirq
      context into process context, thus improving their reliability.
      
      One important side-effect from this change is that SAs reaching
      their hard byte/packet limits are now deleted immediately, just
      like SAs that have reached their hard time limits.
      
      Previously they were announced immediately but only deleted after
      30 seconds.
      
      This is bad because it prevents the system from issuing an ACQUIRE
      command until the existing state was deleted by the user or expires
      after the time is up.
      
      In the scenario where the expire notification was lost this introduces
      a 30 second delay into the system for no good reason.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4666faab
  19. 27 5月, 2005 1 次提交
  20. 04 5月, 2005 1 次提交
    • H
      [IPSEC]: Store idev entries · aabc9761
      Herbert Xu 提交于
      I found a bug that stopped IPsec/IPv6 from working.  About
      a month ago IPv6 started using rt6i_idev->dev on the cached socket dst
      entries.  If the cached socket dst entry is IPsec, then rt6i_idev will
      be NULL.
      
      Since we want to look at the rt6i_idev of the original route in this
      case, the easiest fix is to store rt6i_idev in the IPsec dst entry just
      as we do for a number of other IPv6 route attributes.  Unfortunately
      this means that we need some new code to handle the references to
      rt6i_idev.  That's why this patch is bigger than it would otherwise be.
      
      I've also done the same thing for IPv4 since it is conceivable that
      once these idev attributes start getting used for accounting, we
      probably need to dereference them for IPv4 IPsec entries too.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aabc9761
  21. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4