1. 23 9月, 2008 1 次提交
    • H
      ipsec: Fix xfrm_state_walk race · 5c182458
      Herbert Xu 提交于
      As discovered by Timo Teräs, the currently xfrm_state_walk scheme
      is racy because if a second dump finishes before the first, we
      may free xfrm states that the first dump would walk over later.
      
      This patch fixes this by storing the dumps in a list in order
      to calculate the correct completion counter which cures this
      problem.
      
      I've expanded netlink_cb in order to accomodate the extra state
      related to this.  It shouldn't be a big deal since netlink_cb
      is kmalloced for each dump and we're just increasing it by 4 or
      8 bytes.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5c182458
  2. 10 9月, 2008 1 次提交
  3. 04 5月, 2008 1 次提交
    • M
      xfrm: convert empty xfrm_audit_* macros to functions · 41fef0ee
      Marcin Slusarz 提交于
      it removes these warnings when CONFIG_AUDITSYSCALL is unset:
      
      net/xfrm/xfrm_user.c: In function 'xfrm_add_sa':
      net/xfrm/xfrm_user.c:412: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:411: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:410: warning: unused variable 'loginuid'
      net/xfrm/xfrm_user.c: In function 'xfrm_del_sa':
      net/xfrm/xfrm_user.c:485: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:484: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:483: warning: unused variable 'loginuid'
      net/xfrm/xfrm_user.c: In function 'xfrm_add_policy':
      net/xfrm/xfrm_user.c:1132: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:1131: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:1130: warning: unused variable 'loginuid'
      net/xfrm/xfrm_user.c: In function 'xfrm_get_policy':
      net/xfrm/xfrm_user.c:1382: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:1381: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:1380: warning: unused variable 'loginuid'
      net/xfrm/xfrm_user.c: In function 'xfrm_add_pol_expire':
      net/xfrm/xfrm_user.c:1620: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:1619: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:1618: warning: unused variable 'loginuid'
      net/xfrm/xfrm_user.c: In function 'xfrm_add_sa_expire':
      net/xfrm/xfrm_user.c:1658: warning: unused variable 'sid'
      net/xfrm/xfrm_user.c:1657: warning: unused variable 'sessionid'
      net/xfrm/xfrm_user.c:1656: warning: unused variable 'loginuid'
      Signed-off-by: NMarcin Slusarz <marcin.slusarz@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      41fef0ee
  4. 28 4月, 2008 1 次提交
  5. 22 4月, 2008 1 次提交
    • H
      [IPSEC]: Fix catch-22 with algorithm IDs above 31 · c5d18e98
      Herbert Xu 提交于
      As it stands it's impossible to use any authentication algorithms
      with an ID above 31 portably.  It just happens to work on x86 but
      fails miserably on ppc64.
      
      The reason is that we're using a bit mask to check the algorithm
      ID but the mask is only 32 bits wide.
      
      After looking at how this is used in the field, I have concluded
      that in the long term we should phase out state matching by IDs
      because this is made superfluous by the reqid feature.  For current
      applications, the best solution IMHO is to allow all algorithms when
      the bit masks are all ~0.
      
      The following patch does exactly that.
      
      This bug was identified by IBM when testing on the ppc64 platform
      using the NULL authentication algorithm which has an ID of 251.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c5d18e98
  6. 27 3月, 2008 1 次提交
    • H
      [IPSEC]: Fix BEET output · 732c8bd5
      Herbert Xu 提交于
      The IPv6 BEET output function is incorrectly including the inner
      header in the payload to be protected.  This causes a crash as
      the packet doesn't actually have that many bytes for a second
      header.
      
      The IPv4 BEET output on the other hand is broken when it comes
      to handling an inner IPv6 header since it always assumes an
      inner IPv4 header.
      
      This patch fixes both by making sure that neither BEET output
      function touches the inner header at all.  All access is now
      done through the protocol-independent cb structure.  Two new
      attributes are added to make this work, the IP header length
      and the IPv4 option length.  They're filled in by the inner
      mode's output function.
      
      Thanks to Joakim Koskela for finding this problem.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      732c8bd5
  7. 25 3月, 2008 2 次提交
  8. 18 3月, 2008 1 次提交
  9. 29 2月, 2008 1 次提交
    • T
      [XFRM]: Speed up xfrm_policy and xfrm_state walking · 4c563f76
      Timo Teras 提交于
      Change xfrm_policy and xfrm_state walking algorithm from O(n^2) to O(n).
      This is achieved adding the entries to one more list which is used
      solely for walking the entries.
      
      This also fixes some races where the dump can have duplicate or missing
      entries when the SPD/SADB is modified during an ongoing dump.
      
      Dumping SADB with 20000 entries using "time ip xfrm state" the sys
      time dropped from 1.012s to 0.080s.
      Signed-off-by: NTimo Teras <timo.teras@iki.fi>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c563f76
  10. 13 2月, 2008 1 次提交
  11. 01 2月, 2008 2 次提交
  12. 29 1月, 2008 23 次提交
  13. 09 1月, 2008 1 次提交
  14. 24 10月, 2007 1 次提交
  15. 18 10月, 2007 2 次提交
    • 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