1. 24 5月, 2018 1 次提交
    • M
      ipv6: sr: Add seg6local action End.BPF · 004d4b27
      Mathieu Xhonneux 提交于
      This patch adds the End.BPF action to the LWT seg6local infrastructure.
      This action works like any other seg6local End action, meaning that an IPv6
      header with SRH is needed, whose DA has to be equal to the SID of the
      action. It will also advance the SRH to the next segment, the BPF program
      does not have to take care of this.
      
      Since the BPF program may not be a source of instability in the kernel, it
      is important to ensure that the integrity of the packet is maintained
      before yielding it back to the IPv6 layer. The hook hence keeps track if
      the SRH has been altered through the helpers, and re-validates its
      content if needed with seg6_validate_srh. The state kept for validation is
      stored in a per-CPU buffer. The BPF program is not allowed to directly
      write into the packet, and only some fields of the SRH can be altered
      through the helper bpf_lwt_seg6_store_bytes.
      
      Performances profiling has shown that the SRH re-validation does not induce
      a significant overhead. If the altered SRH is deemed as invalid, the packet
      is dropped.
      
      This validation is also done before executing any action through
      bpf_lwt_seg6_action, and will not be performed again if the SRH is not
      modified after calling the action.
      
      The BPF program may return 3 types of return codes:
          - BPF_OK: the End.BPF action will look up the next destination through
                   seg6_lookup_nexthop.
          - BPF_REDIRECT: if an action has been executed through the
                bpf_lwt_seg6_action helper, the BPF program should return this
                value, as the skb's destination is already set and the default
                lookup should not be performed.
          - BPF_DROP : the packet will be dropped.
      Signed-off-by: NMathieu Xhonneux <m.xhonneux@gmail.com>
      Acked-by: NDavid Lebrun <dlebrun@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      004d4b27
  2. 08 8月, 2017 1 次提交
    • D
      ipv6: sr: define core operations for seg6local lightweight tunnel · d1df6fd8
      David Lebrun 提交于
      This patch implements a new type of lightweight tunnel named seg6local.
      A seg6local lwt is defined by a type of action and a set of parameters.
      The action represents the operation to perform on the packets matching the
      lwt's route, and is not necessarily an encapsulation. The set of parameters
      are arguments for the processing function.
      
      Each action is defined in a struct seg6_action_desc within
      seg6_action_table[]. This structure contains the action, mandatory
      attributes, the processing function, and a static headroom size required by
      the action. The mandatory attributes are encoded as a bitmask field. The
      static headroom is set to a non-zero value when the processing function
      always add a constant number of bytes to the skb (e.g. the header size for
      encapsulations).
      
      To facilitate rtnetlink-related operations such as parsing, fill_encap,
      and cmp_encap, each type of action parameter is associated to three
      function pointers, in seg6_action_params[].
      
      All actions defined in seg6_local.h are detailed in [1].
      
      [1] https://tools.ietf.org/html/draft-filsfils-spring-srv6-network-programming-01Signed-off-by: NDavid Lebrun <david.lebrun@uclouvain.be>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d1df6fd8