13 Nov, 2011

1 commit

  • When the ahash driver returns -EBUSY, AH4/6 input functions return
    NET_XMIT_DROP, presumably copied from the output code path. But
    returning transmit codes on input doesn't make a lot of sense.
    Since NET_XMIT_DROP is a positive int, this gets interpreted as
    the next header type (i.e., success). As that can only end badly,
    remove the check.

    Signed-off-by: Nick Bowler
    Signed-off-by: David S. Miller

    Nick Bowler
     

10 Nov, 2011

2 commits

  • The AH4/6 ahash input callbacks read out the nexthdr field from the AH
    header *after* they overwrite that header. This is obviously not going
    to end well. Fix it up.

    Signed-off-by: Nick Bowler
    Signed-off-by: David S. Miller

    Nick Bowler
     
  • The AH4/6 ahash output callbacks pass nexthdr to xfrm_output_resume
    instead of the error code. This appears to be a copy+paste error from
    the input case, where nexthdr is expected. This causes the driver to
    continuously add AH headers to the datagram until either an allocation
    fails and the packet is dropped or the ahash driver hits a synchronous
    fallback and the resulting monstrosity is transmitted.

    Correct this issue by simply passing the error code unadulterated.

    Signed-off-by: Nick Bowler
    Signed-off-by: David S. Miller

    Nick Bowler
     

23 Apr, 2011

1 commit


14 Mar, 2011

1 commit


09 Feb, 2011

1 commit

  • The Linux IPv4 AH stack aligns the AH header on a 64 bit boundary
    (like in IPv6). This is not RFC compliant (see RFC4302, Section
    3.3.3.2.1), it should be aligned on 32 bits.

    For most of the authentication algorithms, the ICV size is 96 bits.
    The AH header alignment on 32 or 64 bits gives the same results.

    However for SHA-256-128 for instance, the wrong 64 bit alignment results
    in adding useless padding in IPv4 AH, which is forbidden by the RFC.

    To avoid breaking backward compatibility, we use a new flag
    (XFRM_STATE_ALIGN4) do change original behavior.

    Initial patch from Dang Hongwu and
    Christophe Gouault .

    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

12 Jan, 2011

1 commit


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

23 Feb, 2010

1 commit


26 Nov, 2009

1 commit


19 Oct, 2009

1 commit


15 Sep, 2009

1 commit


26 Nov, 2008

2 commits


25 Nov, 2008

1 commit


03 Nov, 2008

1 commit


13 Feb, 2008

1 commit


01 Feb, 2008

1 commit


29 Jan, 2008

4 commits

  • Let's nip the code duplication in the bud :)

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch adds a number of new IPsec audit events to meet the auditing
    requirements of RFC4303. This includes audit hooks for the following events:

    * Could not find a valid SA [sections 2.1, 3.4.2]
    . xfrm_audit_state_notfound()
    . xfrm_audit_state_notfound_simple()

    * Sequence number overflow [section 3.3.3]
    . xfrm_audit_state_replay_overflow()

    * Replayed packet [section 3.4.3]
    . xfrm_audit_state_replay()

    * Integrity check failure [sections 3.4.4.1, 3.4.4.2]
    . xfrm_audit_state_icvfail()

    While RFC4304 deals only with ESP most of the changes in this patch apply to
    IPsec in general, i.e. both AH and ESP. The one case, integrity check
    failure, where ESP specific code had to be modified the same was done to the
    AH code for the sake of consistency.

    Signed-off-by: Paul Moore
    Acked-by: James Morris
    Signed-off-by: David S. Miller

    Paul Moore
     
  • This patch releases the lock on the state before calling
    x->type->input. 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: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • Similar to the moving out of the replay processing on the output, this
    patch moves the integrity stat collectin from x->type->input into
    xfrm_input.

    This would eventually allow transforms such as AH/ESP to be lockless.

    The error value EBADMSG (currently unused in the crypto layer) is used
    to indicate a failed integrity check. In future this error can be
    directly returned by the crypto layer once we switch to aead
    algorithms.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

02 Nov, 2007

1 commit


11 Oct, 2007

8 commits

  • This patch makes the IPv4 x->type->input functions return the next protocol
    instead of setting it directly. This is identical to how we do things in
    IPv6 and will help us merge common code on the input path.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch moves the setting of the IP length and checksum fields out of
    the transforms and into the xfrmX_output functions. This would help future
    efforts in merging the transforms themselves.

    It also adds an optimisation to ipcomp due to the fact that the transport
    offset is guaranteed to be zero.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch removes the duplicate ipv6_{auth,esp,comp}_hdr structures since
    they're identical to the IPv4 versions. Duplicating them would only create
    problems for ourselves later when we need to add things like extended
    sequence numbers.

    I've also added transport header type conversion headers for these types
    which are now used by the transforms.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The IPv6 calling convention for x->mode->output is more general and could
    help an eventual protocol-generic x->type->output implementation. This
    patch adopts it for IPv4 as well and modifies the IPv4 type output functions
    accordingly.

    It also rewrites the IPv6 mac/transport header calculation to be based off
    the network header where practical.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • This patch changes the calling convention so that on entry from
    x->mode->output and before entry into x->type->output skb->data
    will point to the payload instead of the IP header.

    This is essentially a redistribution of skb_push/skb_pull calls
    with the aim of minimising them on the common path of tunnel +
    ESP.

    It'll also let us use the same calling convention between IPv4
    and IPv6 with the next patch.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    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: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The replay counter is one of only two remaining things in the output code
    that requires a lock on the xfrm state (the other being the crypto). This
    patch moves it into the generic xfrm_output so we can remove the lock from
    the transforms themselves.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     
  • The keys are only used during initialisation so we don't need to carry them
    in esp_data. Since we don't have to allocate them again, there is no need
    to place a limit on the authentication key length anymore.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

27 Aug, 2007

1 commit

  • In testing our ESP/AH offload hardware, I discovered an issue with how
    AH handles mutable fields in IPv4. RFC 4302 (AH) states the following
    on the subject:

    For IPv4, the entire option is viewed as a unit; so even
    though the type and length fields within most options are immutable
    in transit, if an option is classified as mutable, the entire option
    is zeroed for ICV computation purposes.

    The current implementation does not zero the type and length fields,
    resulting in authentication failures when communicating with hosts
    that do (i.e. FreeBSD).

    I have tested record route and timestamp options (ping -R and ping -T)
    on a small network involving Windows XP, FreeBSD 6.2, and Linux hosts,
    with one router. In the presence of these options, the FreeBSD and
    Linux hosts (with the patch or with the hardware) can communicate.
    The Windows XP host simply fails to accept these packets with or
    without the patch.

    I have also been trying to test source routing options (using
    traceroute -g), but haven't had much luck getting this option to work
    *without* AH, let alone with.

    Signed-off-by: Nick Bowler
    Signed-off-by: David S. Miller

    Nick Bowler
     

11 Jul, 2007

1 commit

  • It is clean-up for XFRM type modules and adds aliases with its
    protocol:
    ESP, AH, IPCOMP, IPIP and IPv6 for IPsec
    ROUTING and DSTOPTS for MIPv6

    It is almost the same thing as XFRM mode alias, but it is added
    new defines XFRM_PROTO_XXX for preprocessing since some protocols
    are defined as enum.

    Signed-off-by: Masahide NAKAMURA
    Acked-by: Ingo Oeser
    Signed-off-by: David S. Miller

    Masahide NAKAMURA
     

26 Apr, 2007

5 commits


11 Feb, 2007

1 commit


03 Dec, 2006

1 commit