• Herbert Xu's avatar
    xfrm: Forbid state updates from changing encap type · 257a4b01
    Herbert Xu authored
    Currently we allow state updates to competely replace the contents
    of x->encap.  This is bad because on the user side ESP only sets up
    header lengths depending on encap_type once when the state is first
    created.  This could result in the header lengths getting out of
    sync with the actual state configuration.
    
    In practice key managers will never do a state update to change the
    encapsulation type.  Only the port numbers need to be changed as the
    peer NAT entry is updated.
    
    Therefore this patch adds a check in xfrm_state_update to forbid
    any changes to the encap_type.
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
    257a4b01
xfrm_state.c 59.5 KB