]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - net/ipv4/ip_output.c
net: ipv4: split skbuff into fragments transformer
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 29 May 2019 11:25:33 +0000 (13:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 21:18:17 +0000 (14:18 -0700)
commit065ff79f8881e6267f4c29abb476d697eb87bfba
tree3ded1be28c4de752d7ecff4134c2fb236d4d450f
parent0feca6190f88a1b7c9a9b9cdf41824e3ea4ba02c
net: ipv4: split skbuff into fragments transformer

This patch exposes a new API to refragment a skbuff. This allows you to
split either a linear skbuff or to force the refragmentation of an
existing fraglist using a different mtu. The API consists of:

* ip_frag_init(), that initializes the internal state of the transformer.
* ip_frag_next(), that allows you to fetch the next fragment. This function
  internally allocates the skbuff that represents the fragment, it pushes
  the IPv4 header, and it also copies the payload for each fragment.

The ip_frag_state object stores the internal state of the splitter.

This code has been extracted from ip_do_fragment(). Symbols are also
exported to allow to reuse this iterator from the bridge codepath to
build its own refragmentation routine by reusing the existing codebase.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
net/ipv4/ip_output.c