1. 07 9月, 2020 1 次提交
  2. 25 7月, 2020 1 次提交
  3. 21 7月, 2020 1 次提交
    • S
      xfrm: Fix crash when the hold queue is used. · 101dde42
      Steffen Klassert 提交于
      The commits "xfrm: Move dst->path into struct xfrm_dst"
      and "net: Create and use new helper xfrm_dst_child()."
      changed xfrm bundle handling under the assumption
      that xdst->path and dst->child are not a NULL pointer
      only if dst->xfrm is not a NULL pointer. That is true
      with one exception. If the xfrm hold queue is used
      to wait until a SA is installed by the key manager,
      we create a dummy bundle without a valid dst->xfrm
      pointer. The current xfrm bundle handling crashes
      in that case. Fix this by extending the NULL check
      of dst->xfrm with a test of the DST_XFRM_QUEUE flag.
      
      Fixes: 0f6c480f ("xfrm: Move dst->path into struct xfrm_dst")
      Fixes: b92cf4aa ("net: Create and use new helper xfrm_dst_child().")
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      101dde42
  4. 09 7月, 2020 3 次提交
    • X
      tunnel6: add tunnel6_input_afinfo for ipip and ipv6 tunnels · 86afc703
      Xin Long 提交于
      This patch is to register a callback function tunnel6_rcv_cb with
      is_ipip set in a xfrm_input_afinfo object for tunnel6 and tunnel46.
      
      It will be called by xfrm_rcv_cb() from xfrm_input() when family
      is AF_INET6 and proto is IPPROTO_IPIP or IPPROTO_IPV6.
      
      v1->v2:
        - Fix a sparse warning caused by the missing "__rcu", as Jakub
          noticed.
        - Handle the err returned by xfrm_input_register_afinfo() in
          tunnel6_init/fini(), as Sabrina noticed.
      v2->v3:
        - Add "#if IS_ENABLED(CONFIG_INET6_XFRM_TUNNEL)" to fix the build error
          when xfrm is disabled, reported by kbuild test robot
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      86afc703
    • X
      tunnel4: add cb_handler to struct xfrm_tunnel · 6df2db5d
      Xin Long 提交于
      This patch is to register a callback function tunnel4_rcv_cb with
      is_ipip set in a xfrm_input_afinfo object for tunnel4 and tunnel64.
      
      It will be called by xfrm_rcv_cb() from xfrm_input() when family
      is AF_INET and proto is IPPROTO_IPIP or IPPROTO_IPV6.
      
      v1->v2:
        - Fix a sparse warning caused by the missing "__rcu", as Jakub
          noticed.
        - Handle the err returned by xfrm_input_register_afinfo() in
          tunnel4_init/fini(), as Sabrina noticed.
      v2->v3:
        - Add "#if IS_ENABLED(CONFIG_INET_XFRM_TUNNEL)" to fix the build error
          when xfrm is disabled, reported by kbuild test robot.
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      6df2db5d
    • X
      xfrm: add is_ipip to struct xfrm_input_afinfo · 1475ee0a
      Xin Long 提交于
      This patch is to add a new member is_ipip to struct xfrm_input_afinfo,
      to allow another group family of callback functions to be registered
      with is_ipip set.
      
      This will be used for doing a callback for struct xfrm(6)_tunnel of
      ipip/ipv6 tunnels in xfrm_input() by calling xfrm_rcv_cb(), which is
      needed by ipip/ipv6 tunnels' support in ip(6)_vti and xfrm interface
      in the next patches.
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      1475ee0a
  5. 24 6月, 2020 2 次提交
    • X
      xfrm: policy: match with both mark and mask on user interfaces · 4f47e8ab
      Xin Long 提交于
      In commit ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list"),
      it would take 'priority' to make a policy unique, and allow duplicated
      policies with different 'priority' to be added, which is not expected
      by userland, as Tobias reported in strongswan.
      
      To fix this duplicated policies issue, and also fix the issue in
      commit ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list"),
      when doing add/del/get/update on user interfaces, this patch is to change
      to look up a policy with both mark and mask by doing:
      
        mark.v == pol->mark.v && mark.m == pol->mark.m
      
      and leave the check:
      
        (mark & pol->mark.m) == pol->mark.v
      
      for tx/rx path only.
      
      As the userland expects an exact mark and mask match to manage policies.
      
      v1->v2:
        - make xfrm_policy_mark_match inline and fix the changelog as
          Tobias suggested.
      
      Fixes: 295fae56 ("xfrm: Allow user space manipulation of SPD mark")
      Fixes: ed17b8d3 ("xfrm: fix a warning in xfrm_policy_insert_list")
      Reported-by: NTobias Brunner <tobias@strongswan.org>
      Tested-by: NTobias Brunner <tobias@strongswan.org>
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4f47e8ab
    • J
      bonding/xfrm: use real_dev instead of slave_dev · bdfd2d1f
      Jarod Wilson 提交于
      Rather than requiring every hw crypto capable NIC driver to do a check for
      slave_dev being set, set real_dev in the xfrm layer and xso init time, and
      then override it in the bonding driver as needed. Then NIC drivers can
      always use real_dev, and at the same time, we eliminate the use of a
      variable name that probably shouldn't have been used in the first place,
      particularly given recent current events.
      
      CC: Boris Pismenny <borisp@mellanox.com>
      CC: Saeed Mahameed <saeedm@mellanox.com>
      CC: Leon Romanovsky <leon@kernel.org>
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      Suggested-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bdfd2d1f
  6. 23 6月, 2020 1 次提交
    • J
      xfrm: bail early on slave pass over skb · 272c2330
      Jarod Wilson 提交于
      This is prep work for initial support of bonding hardware encryption
      pass-through support. The bonding driver will fill in the slave_dev
      pointer, and we use that to know not to skb_push() again on a given
      skb that was already processed on the bond device.
      
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      CC: Jakub Kicinski <kuba@kernel.org>
      CC: Steffen Klassert <steffen.klassert@secunet.com>
      CC: Herbert Xu <herbert@gondor.apana.org.au>
      CC: netdev@vger.kernel.org
      CC: intel-wired-lan@lists.osuosl.org
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      272c2330
  7. 04 6月, 2020 1 次提交
  8. 06 5月, 2020 7 次提交
  9. 28 4月, 2020 1 次提交
  10. 09 12月, 2019 2 次提交
  11. 09 10月, 2019 1 次提交
  12. 17 7月, 2019 2 次提交
  13. 01 7月, 2019 1 次提交
  14. 06 6月, 2019 3 次提交
  15. 05 6月, 2019 3 次提交
  16. 23 4月, 2019 4 次提交
  17. 08 4月, 2019 6 次提交
    • F
      xfrm: store xfrm_mode directly, not its address · c9500d7b
      Florian Westphal 提交于
      This structure is now only 4 bytes, so its more efficient
      to cache a copy rather than its address.
      
      No significant size difference in allmodconfig vmlinux.
      
      With non-modular kernel that has all XFRM options enabled, this
      series reduces vmlinux image size by ~11kb. All xfrm_mode
      indirections are gone and all modes are built-in.
      
      before (ipsec-next master):
          text      data      bss         dec   filename
      21071494   7233140 11104324    39408958   vmlinux.master
      
      after this series:
      21066448   7226772 11104324    39397544   vmlinux.patched
      
      With allmodconfig kernel, the size increase is only 362 bytes,
      even all the xfrm config options removed in this series are
      modular.
      
      before:
          text      data     bss      dec   filename
      15731286   6936912 4046908 26715106   vmlinux.master
      
      after this series:
      15731492   6937068  4046908  26715468 vmlinux
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      c9500d7b
    • F
      xfrm: make xfrm modes builtin · 4c145dce
      Florian Westphal 提交于
      after previous changes, xfrm_mode contains no function pointers anymore
      and all modules defining such struct contain no code except an init/exit
      functions to register the xfrm_mode struct with the xfrm core.
      
      Just place the xfrm modes core and remove the modules,
      the run-time xfrm_mode register/unregister functionality is removed.
      
      Before:
      
          text    data     bss      dec filename
          7523     200    2364    10087 net/xfrm/xfrm_input.o
         40003     628     440    41071 net/xfrm/xfrm_state.o
      15730338 6937080 4046908 26714326 vmlinux
      
          7389     200    2364    9953  net/xfrm/xfrm_input.o
         40574     656     440   41670  net/xfrm/xfrm_state.o
      15730084 6937068 4046908 26714060 vmlinux
      
      The xfrm*_mode_{transport,tunnel,beet} modules are gone.
      
      v2: replace CONFIG_INET6_XFRM_MODE_* IS_ENABLED guards with CONFIG_IPV6
          ones rather than removing them.
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      4c145dce
    • F
      xfrm: remove afinfo pointer from xfrm_mode · 733a5fac
      Florian Westphal 提交于
      Adds an EXPORT_SYMBOL for afinfo_get_rcu, as it will now be called from
      ipv6 in case of CONFIG_IPV6=m.
      
      This change has virtually no effect on vmlinux size, but it reduces
      afinfo size and allows followup patch to make xfrm modes const.
      
      v2: mark if (afinfo) tests as likely (Sabrina)
          re-fetch afinfo according to inner_mode in xfrm_prepare_input().
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      733a5fac
    • F
      xfrm: remove output2 indirection from xfrm_mode · 1de70830
      Florian Westphal 提交于
      similar to previous patch: no external module dependencies,
      so we can avoid the indirection by placing this in the core.
      
      This change removes the last indirection from xfrm_mode and the
      xfrm4|6_mode_{beet,tunnel}.c modules contain (almost) no code anymore.
      
      Before:
         text    data     bss     dec     hex filename
         3957     136       0    4093     ffd net/xfrm/xfrm_output.o
          587      44       0     631     277 net/ipv4/xfrm4_mode_beet.o
          649      32       0     681     2a9 net/ipv4/xfrm4_mode_tunnel.o
          625      44       0     669     29d net/ipv6/xfrm6_mode_beet.o
          599      32       0     631     277 net/ipv6/xfrm6_mode_tunnel.o
      After:
         text    data     bss     dec     hex filename
         5359     184       0    5543    15a7 net/xfrm/xfrm_output.o
          171      24       0     195      c3 net/ipv4/xfrm4_mode_beet.o
          171      24       0     195      c3 net/ipv4/xfrm4_mode_tunnel.o
          172      24       0     196      c4 net/ipv6/xfrm6_mode_beet.o
          172      24       0     196      c4 net/ipv6/xfrm6_mode_tunnel.o
      
      v2: fold the *encap_add functions into xfrm*_prepare_output
          preserve (move) output2 comment (Sabrina)
          use x->outer_mode->encap, not inner
          fix a build breakage on ppc (kbuild robot)
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      1de70830
    • F
      xfrm: remove input2 indirection from xfrm_mode · b3284df1
      Florian Westphal 提交于
      No external dependencies on any module, place this in the core.
      Increase is about 1800 byte for xfrm_input.o.
      
      The beet helpers get added to internal header, as they can be reused
      from xfrm_output.c in the next patch (kernel contains several
      copies of them in the xfrm{4,6}_mode_beet.c files).
      
      Before:
         text    data     bss     dec filename
         5578     176    2364    8118 net/xfrm/xfrm_input.o
         1180      64       0    1244 net/ipv4/xfrm4_mode_beet.o
          171      40       0     211 net/ipv4/xfrm4_mode_transport.o
         1163      40       0    1203 net/ipv4/xfrm4_mode_tunnel.o
         1083      52       0    1135 net/ipv6/xfrm6_mode_beet.o
          172      40       0     212 net/ipv6/xfrm6_mode_ro.o
          172      40       0     212 net/ipv6/xfrm6_mode_transport.o
         1056      40       0    1096 net/ipv6/xfrm6_mode_tunnel.o
      
      After:
         text    data     bss     dec filename
         7373     200    2364    9937 net/xfrm/xfrm_input.o
          587      44       0     631 net/ipv4/xfrm4_mode_beet.o
          171      32       0     203 net/ipv4/xfrm4_mode_transport.o
          649      32       0     681 net/ipv4/xfrm4_mode_tunnel.o
          625      44       0     669 net/ipv6/xfrm6_mode_beet.o
          172      32       0     204 net/ipv6/xfrm6_mode_ro.o
          172      32       0     204 net/ipv6/xfrm6_mode_transport.o
          599      32       0     631 net/ipv6/xfrm6_mode_tunnel.o
      
      v2: pass inner_mode to xfrm_inner_mode_encap_remove to fix
          AF_UNSPEC selector breakage (bisected by Benedict Wong)
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      b3284df1
    • F
      xfrm: remove gso_segment indirection from xfrm_mode · 7613b92b
      Florian Westphal 提交于
      These functions are small and we only have versions for tunnel
      and transport mode for ipv4 and ipv6 respectively.
      
      Just place the 'transport or tunnel' conditional in the protocol
      specific function instead of using an indirection.
      
      Before:
          3226       12       0     3238   net/ipv4/esp4_offload.o
          7004      492       0     7496   net/ipv4/ip_vti.o
          3339       12       0     3351   net/ipv6/esp6_offload.o
         11294      460       0    11754   net/ipv6/ip6_vti.o
          1180       72       0     1252   net/ipv4/xfrm4_mode_beet.o
           428       48       0      476   net/ipv4/xfrm4_mode_transport.o
          1271       48       0     1319   net/ipv4/xfrm4_mode_tunnel.o
          1083       60       0     1143   net/ipv6/xfrm6_mode_beet.o
           172       48       0      220   net/ipv6/xfrm6_mode_ro.o
           429       48       0      477   net/ipv6/xfrm6_mode_transport.o
          1164       48       0     1212   net/ipv6/xfrm6_mode_tunnel.o
      15730428  6937008 4046908 26714344   vmlinux
      
      After:
          3461       12       0     3473   net/ipv4/esp4_offload.o
          7000      492       0     7492   net/ipv4/ip_vti.o
          3574       12       0     3586   net/ipv6/esp6_offload.o
         11295      460       0    11755   net/ipv6/ip6_vti.o
          1180       64       0     1244   net/ipv4/xfrm4_mode_beet.o
           171       40       0      211   net/ipv4/xfrm4_mode_transport.o
          1163       40       0     1203   net/ipv4/xfrm4_mode_tunnel.o
          1083       52       0     1135   net/ipv6/xfrm6_mode_beet.o
           172       40       0      212   net/ipv6/xfrm6_mode_ro.o
           172       40       0      212   net/ipv6/xfrm6_mode_transport.o
          1056       40       0     1096   net/ipv6/xfrm6_mode_tunnel.o
      15730424  6937008 4046908 26714340   vmlinux
      Signed-off-by: NFlorian Westphal <fw@strlen.de>
      Reviewed-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NSteffen Klassert <steffen.klassert@secunet.com>
      7613b92b