1. 29 1月, 2008 12 次提交
  2. 09 1月, 2008 1 次提交
  3. 04 1月, 2008 1 次提交
  4. 20 12月, 2007 1 次提交
  5. 15 12月, 2007 1 次提交
  6. 11 12月, 2007 1 次提交
  7. 29 11月, 2007 1 次提交
    • H
      [IPSEC]: Fix uninitialised dst warning in __xfrm_lookup · 5e5234ff
      Herbert Xu 提交于
      Andrew Morton reported that __xfrm_lookup generates this warning:
      
      net/xfrm/xfrm_policy.c: In function '__xfrm_lookup':
      net/xfrm/xfrm_policy.c:1449: warning: 'dst' may be used uninitialized in this function
      
      This is because if policy->action is of an unexpected value then dst will
      not be initialised.  Of course, in practice this should never happen since
      the input layer xfrm_user/af_key will filter out all illegal values.  But
      the compiler doesn't know that of course.
      
      So this patch fixes this by taking the conservative approach and treat all
      unknown actions the same as a blocking action.
      
      Thanks to Andrew for finding this and providing an initial fix.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5e5234ff
  8. 27 11月, 2007 1 次提交
  9. 26 11月, 2007 1 次提交
    • H
      [IPSEC]: Temporarily remove locks around copying of non-atomic fields · 8053fc3d
      Herbert Xu 提交于
      The change 050f009e
      
      	[IPSEC]: Lock state when copying non-atomic fields to user-space
      
      caused a regression.
      
      Ingo Molnar reports that it causes a potential dead-lock found by the
      lock validator as it tries to take x->lock within xfrm_state_lock while
      numerous other sites take the locks in opposite order.
      
      For 2.6.24, the best fix is to simply remove the added locks as that puts
      us back in the same state as we've been in for years.  For later kernels
      a proper fix would be to reverse the locking order for every xfrm state
      user such that if x->lock is taken together with xfrm_state_lock then
      it is to be taken within it.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      8053fc3d
  10. 02 11月, 2007 1 次提交
  11. 26 10月, 2007 1 次提交
  12. 24 10月, 2007 1 次提交
  13. 23 10月, 2007 2 次提交
  14. 18 10月, 2007 5 次提交
    • H
      [IPSEC]: Rename mode to outer_mode and add inner_mode · 13996378
      Herbert Xu 提交于
      This patch adds a new field to xfrm states called inner_mode.  The existing
      mode object is renamed to outer_mode.
      
      This is the first part of an attempt to fix inter-family transforms.  As it
      is we always use the outer family when determining which mode to use.  As a
      result we may end up shoving IPv4 packets into netfilter6 and vice versa.
      
      What we really want is to use the inner family for the first part of outbound
      processing and the outer family for the second part.  For inbound processing
      we'd use the opposite pairing.
      
      I've also added a check to prevent silly combinations such as transport mode
      with inter-family transforms.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      13996378
    • H
      [IPSEC]: Store afinfo pointer in xfrm_mode · 17c2a42a
      Herbert Xu 提交于
      It is convenient to have a pointer from xfrm_state to address-specific
      functions such as the output function for a family.  Currently the
      address-specific policy code calls out to the xfrm state code to get
      those pointers when we could get it in an easier way via the state
      itself.
      
      This patch adds an xfrm_state_afinfo to xfrm_mode (since they're
      address-specific) and changes the policy code to use it.  I've also
      added an owner field to do reference counting on the module providing
      the afinfo even though it isn't strictly necessary today since IPv6
      can't be unloaded yet.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      17c2a42a
    • H
      [IPSEC]: Add missing BEET checks · 1bfcb10f
      Herbert Xu 提交于
      Currently BEET mode does not reinject the packet back into the stack
      like tunnel mode does.  Since BEET should behave just like tunnel mode
      this is incorrect.
      
      This patch fixes this by introducing a flags field to xfrm_mode that
      tells the IPsec code whether it should terminate and reinject the packet
      back into the stack.
      
      It then sets the flag for BEET and tunnel mode.
      
      I've also added a number of missing BEET checks elsewhere where we check
      whether a given mode is a tunnel or not.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1bfcb10f
    • H
      [IPSEC]: Move type and mode map into xfrm_state.c · aa5d62cc
      Herbert Xu 提交于
      The type and mode maps are only used by SAs, not policies.  So it makes
      sense to move them from xfrm_policy.c into xfrm_state.c.  This also allows
      us to mark xfrm_get_type/xfrm_put_type/xfrm_get_mode/xfrm_put_mode as
      static.
      
      The only other change I've made in the move is to get rid of the casts
      on the request_module call for types.  They're unnecessary because C
      will promote them to ints anyway.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa5d62cc
    • H
      [IPSEC]: Fix length check in xfrm_parse_spi · 44072500
      Herbert Xu 提交于
      Currently xfrm_parse_spi requires there to be 16 bytes for AH and ESP.
      In contrived cases there may not actually be 16 bytes there since the
      respective header sizes are less than that (8 and 12 currently).
      
      This patch changes the test to use the actual header length instead of 16.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      44072500
  15. 11 10月, 2007 10 次提交
    • D
      [NET]: make netlink user -> kernel interface synchronious · cd40b7d3
      Denis V. Lunev 提交于
      This patch make processing netlink user -> kernel messages synchronious.
      This change was inspired by the talk with Alexey Kuznetsov about current
      netlink messages processing. He says that he was badly wrong when introduced 
      asynchronious user -> kernel communication.
      
      The call netlink_unicast is the only path to send message to the kernel
      netlink socket. But, unfortunately, it is also used to send data to the
      user.
      
      Before this change the user message has been attached to the socket queue
      and sk->sk_data_ready was called. The process has been blocked until all
      pending messages were processed. The bad thing is that this processing
      may occur in the arbitrary process context.
      
      This patch changes nlk->data_ready callback to get 1 skb and force packet
      processing right in the netlink_unicast.
      
      Kernel -> user path in netlink_unicast remains untouched.
      
      EINTR processing for in netlink_run_queue was changed. It forces rtnl_lock
      drop, but the process remains in the cycle until the message will be fully
      processed. So, there is no need to use this kludges now.
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      Acked-by: NAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cd40b7d3
    • H
      [IPSEC]: Move state lock into x->type->output · b7c6538c
      Herbert Xu 提交于
      This patch releases the lock on the state before calling x->type->output.
      It also adds the lock to the spots where they're currently needed.
      
      Most of those places (all except mip6) are expected to disappear with
      async crypto.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b7c6538c
    • H
      [IPSEC]: Lock state when copying non-atomic fields to user-space · 050f009e
      Herbert Xu 提交于
      This patch adds locking so that when we're copying non-atomic fields such as
      life-time or coaddr to user-space we don't get a partial result.
      
      For af_key I've changed every instance of pfkey_xfrm_state2msg apart from
      expiration notification to include the keys and life-times.  This is in-line
      with XFRM behaviour.
      
      The actual cases affected are:
      
      * pfkey_getspi: No change as we don't have any keys to copy.
      * key_notify_sa:
      	+ ADD/UPD: This wouldn't work otherwise.
      	+ DEL: It can't hurt.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      050f009e
    • H
      [XFRM] user: Move attribute copying code into copy_to_user_state_extra · 68325d3b
      Herbert Xu 提交于
      Here's a good example of code duplication leading to code rot.  The
      notification patch did its own netlink message creation for xfrm states.
      It duplicated code that was already in dump_one_state.  Guess what, the
      next time (and the time after) when someone updated dump_one_state the
      notification path got zilch.
      
      This patch moves that code from dump_one_state to copy_to_user_state_extra
      and uses it in xfrm_notify_sa too.  Unfortunately whoever updates this
      still needs to update xfrm_sa_len since the notification path wants to
      know the exact size for allocation.
      
      At least I've added a comment saying so and if someone still forgest, we'll
      have a WARN_ON telling us so.
      
      I also changed the security size calculation to use xfrm_user_sec_ctx since
      that's what we actually put into the skb.  However it makes no practical
      difference since it has the same size as xfrm_sec_ctx.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      68325d3b
    • H
      [IPSEC]: Move common code into xfrm_alloc_spi · 658b219e
      Herbert Xu 提交于
      This patch moves some common code that conceptually belongs to the xfrm core
      from af_key/xfrm_user into xfrm_alloc_spi.
      
      In particular, the spin lock on the state is now taken inside xfrm_alloc_spi.
      Previously it also protected the construction of the response PF_KEY/XFRM
      messages to user-space.  This is inconsistent as other identical constructions
      are not protected by the state lock.  This is bad because they in fact should
      be protected but only in certain spots (so as not to hold the lock for too
      long which may cause packet drops).
      
      The SPI byte order conversion has also been moved.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      658b219e
    • H
      [IPSEC]: Remove gratuitous km wake-up events on ACQUIRE · 75ba28c6
      Herbert Xu 提交于
      There is no point in waking people up when creating/updating larval states
      because they'll just go back to sleep again as larval states by definition
      cannot be found by xfrm_state_find.
      
      We should only wake them up when the larvals mature or die.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      75ba28c6
    • H
      [IPSEC]: Store IPv6 nh pointer in mac_header on output · 007f0211
      Herbert Xu 提交于
      Current the x->mode->output functions store the IPv6 nh pointer in the
      skb network header.  This is inconvenient because the network header then
      has to be fixed up before the packet can leave the IPsec stack.  The mac
      header field is unused on output so we can use that to store this instead.
      
      This patch does that and removes the network header fix-up in xfrm_output.
      
      It also uses ipv6_hdr where appropriate in the x->type->output functions.
      
      There is also a minor clean-up in esp4 to make it use the same code as
      esp6 to help any subsequent effort to merge the two.
      
      Lastly it kills two redundant skb_set_* statements in BEET that were
      simply copied over from transport mode.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      007f0211
    • H
      [IPSEC]: Remove bogus ref count in xfrm_secpath_reject · 1ecafede
      Herbert Xu 提交于
      Constructs of the form
      
      	xfrm_state_hold(x);
      	foo(x);
      	xfrm_state_put(x);
      
      tend to be broken because foo is either synchronous where this is totally
      unnecessary or if foo is asynchronous then the reference count is in the
      wrong spot.
      
      In the case of xfrm_secpath_reject, the function is synchronous and therefore
      we should just kill the reference count.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1ecafede
    • H
      [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c · 45b17f48
      Herbert Xu 提交于
      The lastused update check in xfrm_output can be done just as well in
      the mode output function which is specific to RO.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      45b17f48
    • H
      [IPSEC]: Unexport xfrm_replay_notify · cdf7e668
      Herbert Xu 提交于
      Now that the only callers of xfrm_replay_notify are in xfrm, we can remove
      the export.
      
      This patch also removes xfrm_aevent_doreplay since it's now called in just
      one spot.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cdf7e668