1. 18 9月, 2015 1 次提交
  2. 08 4月, 2015 1 次提交
    • D
      netfilter: Pass socket pointer down through okfn(). · 7026b1dd
      David Miller 提交于
      On the output paths in particular, we have to sometimes deal with two
      socket contexts.  First, and usually skb->sk, is the local socket that
      generated the frame.
      
      And second, is potentially the socket used to control a tunneling
      socket, such as one the encapsulates using UDP.
      
      We do not want to disassociate skb->sk when encapsulating in order
      to fix this, because that would break socket memory accounting.
      
      The most extreme case where this can cause huge problems is an
      AF_PACKET socket transmitting over a vxlan device.  We hit code
      paths doing checks that assume they are dealing with an ipv4
      socket, but are actually operating upon the AF_PACKET one.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7026b1dd
  3. 09 2月, 2015 1 次提交
  4. 25 8月, 2014 1 次提交
  5. 13 5月, 2014 1 次提交
  6. 16 4月, 2014 1 次提交
  7. 07 4月, 2014 1 次提交
  8. 26 8月, 2013 1 次提交
  9. 19 8月, 2013 1 次提交
  10. 14 8月, 2013 2 次提交
  11. 01 2月, 2012 1 次提交
    • D
      xfrm6: remove unneeded NULL check in __xfrm6_output() · 5b11b2e4
      Dan Carpenter 提交于
      We don't check for NULL consistently in __xfrm6_output().  If "x" were
      NULL here it would lead to an OOPs later.  I asked Steffen Klassert
      about this and he suggested that we remove the NULL check.
      
      On 10/29/11, Steffen Klassert <steffen.klassert@secunet.com> wrote:
      >> net/ipv6/xfrm6_output.c
      >>    148
      >>    149		if ((x && x->props.mode == XFRM_MODE_TUNNEL) &&
      >>                           ^
      >
      > x can't be null here. It would be a bug if __xfrm6_output() is called
      > without a xfrm_state attached to the skb. I think we can just remove
      > this null check.
      
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5b11b2e4
  12. 23 11月, 2011 1 次提交
  13. 19 10月, 2011 1 次提交
  14. 11 5月, 2011 1 次提交
    • S
      xfrm: Assign the inner mode output function to the dst entry · 43a4dea4
      Steffen Klassert 提交于
      As it is, we assign the outer modes output function to the dst entry
      when we create the xfrm bundle. This leads to two problems on interfamily
      scenarios. We might insert ipv4 packets into ip6_fragment when called
      from xfrm6_output. The system crashes if we try to fragment an ipv4
      packet with ip6_fragment. This issue was introduced with git commit
      ad0081e4 (ipv6: Fragment locally generated tunnel-mode IPSec6 packets
      as needed). The second issue is, that we might insert ipv4 packets in
      netfilter6 and vice versa on interfamily scenarios.
      
      With this patch we assign the inner mode output function to the dst entry
      when we create the xfrm bundle. So xfrm4_output/xfrm6_output from the inner
      mode is used and the right fragmentation and netfilter functions are called.
      We switch then to outer mode with the output_finish functions.
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43a4dea4
  15. 20 12月, 2010 1 次提交
  16. 25 3月, 2010 1 次提交
  17. 19 2月, 2010 1 次提交
  18. 03 6月, 2009 1 次提交
  19. 07 4月, 2009 1 次提交
    • S
      xfrm: fix fragmentation on inter family tunnels · d1d88e5d
      Steffen Klassert 提交于
      If an ipv4 packet (not locally generated with IP_DF flag not set) bigger
      than mtu size is supposed to go via a xfrm ipv6 tunnel, the packetsize
      check in xfrm4_tunnel_check_size() is omited and ipv6 drops the packet
      without sending a notice to the original sender of the ipv4 packet.
      
      Another issue is that ipv4 connection tracking does reassembling of
      incomming fragmented packets. If such a reassembled packet is supposed to
      go via a xfrm ipv6 tunnel it will be droped, even if the original sender
      did proper fragmentation.
      
      According to RFC 2473 (section 7) tunnel ipv6 packets resulting from the
      encapsulation of an original packet are considered as locally generated
      packets. If such a packet passed the checks in xfrm{4,6}_tunnel_check_size()
      fragmentation is allowed according to RFC 2473 (section 7.1/7.2).
      
      This patch sets skb->local_df in xfrm6_prepare_output() to achieve
      fragmentation in this case.
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1d88e5d
  20. 25 3月, 2008 1 次提交
  21. 13 2月, 2008 1 次提交
    • H
      [IPV6]: Fix IPsec datagram fragmentation · 28a89453
      Herbert Xu 提交于
      This is a long-standing bug in the IPsec IPv6 code that breaks
      when we emit a IPsec tunnel-mode datagram packet.  The problem
      is that the code the emits the packet assumes the IPv6 stack
      will fragment it later, but the IPv6 stack assumes that whoever
      is emitting the packet is going to pre-fragment the packet.
      
      In the long term we need to fix both sides, e.g., to get the
      datagram code to pre-fragment as well as to get the IPv6 stack
      to fragment locally generated tunnel-mode packet.
      
      For now this patch does the second part which should make it
      work for the IPsec host case.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      28a89453
  22. 29 1月, 2008 6 次提交
    • P
      [NETFILTER]: Introduce NF_INET_ hook values · 6e23ae2a
      Patrick McHardy 提交于
      The IPv4 and IPv6 hook values are identical, yet some code tries to figure
      out the "correct" value by looking at the address family. Introduce NF_INET_*
      values for both IPv4 and IPv6. The old values are kept in a #ifndef __KERNEL__
      section for userspace compatibility.
      Signed-off-by: NPatrick McHardy <kaber@trash.net>
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6e23ae2a
    • H
      [IPSEC]: Remove nhoff from xfrm_input · 60d5fcfb
      Herbert Xu 提交于
      The nhoff field isn't actually necessary in xfrm_input.  For tunnel
      mode transforms we now throw away the output IP header so it makes no
      sense to fill in the nexthdr field.  For transport mode we can now let
      the function transport_finish do the setting and it knows where the
      nexthdr field is.
      
      The only other thing that needs the nexthdr field to be set is the
      header extraction code.  However, we can simply move the protocol
      extraction out of the generic header extraction.
      
      We want to minimise the amount of info we have to carry around between
      transforms as this simplifies the resumption process for async crypto.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      60d5fcfb
    • H
      [IPSEC]: Merge most of the output path · 862b82c6
      Herbert Xu 提交于
      As part of the work on asynchrnous cryptographic operations, we need
      to be able to resume from the spot where they occur.  As such, it
      helps if we isolate them to one spot.
      
      This patch moves most of the remaining family-specific processing into
      the common output code.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      862b82c6
    • H
      [IPV6]: Add ip6_local_out · ef76bc23
      Herbert Xu 提交于
      Most callers of the LOCAL_OUT chain will set the IP packet length
      before doing so.  They also share the same output function dst_output.
      
      This patch creates a new function called ip6_local_out which does all
      of that and converts the appropriate users over to it.
      
      Apart from removing duplicate code, it will also help in merging the
      IPsec output path.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ef76bc23
    • H
      [IPSEC]: Separate inner/outer mode processing on input · 227620e2
      Herbert Xu 提交于
      With inter-family transforms the inner mode differs from the outer
      mode.  Attempting to handle both sides from the same function means
      that it needs to handle both IPv4 and IPv6 which creates duplication
      and confusion.
      
      This patch separates the two parts on the input path so that each
      function deals with one family only.
      
      In particular, the functions xfrm4_extract_inut/xfrm6_extract_inut
      moves the pertinent fields from the IPv4/IPv6 IP headers into a
      neutral format stored in skb->cb.  This is then used by the inner mode
      input functions to modify the inner IP header.  In this way the input
      function no longer has to know about the outer address family.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      227620e2
    • H
      [IPSEC]: Separate inner/outer mode processing on output · 36cf9acf
      Herbert Xu 提交于
      With inter-family transforms the inner mode differs from the outer
      mode.  Attempting to handle both sides from the same function means
      that it needs to handle both IPv4 and IPv6 which creates duplication
      and confusion.
      
      This patch separates the two parts on the output path so that each
      function deals with one family only.
      
      In particular, the functions xfrm4_extract_output/xfrm6_extract_output
      moves the pertinent fields from the IPv4/IPv6 IP headers into a
      neutral format stored in skb->cb.  This is then used by the outer mode
      output functions to write the outer IP header.  In this way the output
      function no longer has to know about the inner address family.
      
      Since the extract functions are only called by tunnel modes (the only
      modes that can support inter-family transforms), I've also moved the
      xfrm*_tunnel_check_size calls into them.  This allows the correct ICMP
      message to be sent as opposed to now where you might call icmp_send
      with an IPv6 packet and vice versa.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36cf9acf
  23. 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]: 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
  24. 16 10月, 2007 1 次提交
  25. 11 10月, 2007 2 次提交
  26. 26 4月, 2007 3 次提交
  27. 11 2月, 2007 1 次提交
  28. 23 9月, 2006 3 次提交