License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
/*
|
2006-11-29 01:35:06 +00:00
|
|
|
* Header for use in defining a given L4 protocol for connection tracking.
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
*
|
|
|
|
* 16 Dec 2003: Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
|
|
|
|
* - generalized L3 protocol dependent part.
|
|
|
|
*
|
|
|
|
* Derived from include/linux/netfiter_ipv4/ip_conntrack_protcol.h
|
|
|
|
*/
|
|
|
|
|
2006-11-29 01:35:06 +00:00
|
|
|
#ifndef _NF_CONNTRACK_L4PROTO_H
|
|
|
|
#define _NF_CONNTRACK_L4PROTO_H
|
2007-09-28 21:37:03 +00:00
|
|
|
#include <linux/netlink.h>
|
2007-09-28 21:39:55 +00:00
|
|
|
#include <net/netlink.h>
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
#include <net/netfilter/nf_conntrack.h>
|
2012-05-28 21:04:09 +00:00
|
|
|
#include <net/netns/generic.h>
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
|
|
|
|
struct seq_file;
|
|
|
|
|
2009-11-03 03:26:03 +00:00
|
|
|
struct nf_conntrack_l4proto {
|
2006-11-29 01:35:06 +00:00
|
|
|
/* L4 Protocol number. */
|
|
|
|
u_int8_t l4proto;
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
|
2016-04-30 22:28:40 +00:00
|
|
|
/* Resolve clashes on insertion races. */
|
|
|
|
bool allow_clash;
|
|
|
|
|
2017-11-07 06:20:07 +00:00
|
|
|
/* protoinfo nlattr size, closes a hole */
|
|
|
|
u16 nlattr_size;
|
|
|
|
|
2017-04-16 20:08:53 +00:00
|
|
|
/* called by gc worker if table is full */
|
|
|
|
bool (*can_early_drop)(const struct nf_conn *ct);
|
|
|
|
|
2006-01-05 20:19:05 +00:00
|
|
|
/* convert protoinfo to nfnetink attributes */
|
2007-09-28 21:37:41 +00:00
|
|
|
int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
|
2020-12-10 13:43:23 +00:00
|
|
|
struct nf_conn *ct, bool destroy);
|
2006-01-05 20:19:05 +00:00
|
|
|
|
|
|
|
/* convert nfnetlink attributes to protoinfo */
|
2007-09-28 21:37:41 +00:00
|
|
|
int (*from_nlattr)(struct nlattr *tb[], struct nf_conn *ct);
|
2006-01-05 20:19:05 +00:00
|
|
|
|
2007-09-28 21:37:41 +00:00
|
|
|
int (*tuple_to_nlattr)(struct sk_buff *skb,
|
2006-01-05 20:19:05 +00:00
|
|
|
const struct nf_conntrack_tuple *t);
|
2009-03-25 17:24:48 +00:00
|
|
|
/* Calculate tuple nlattr size */
|
2017-11-02 18:41:09 +00:00
|
|
|
unsigned int (*nlattr_tuple_size)(void);
|
2007-09-28 21:37:41 +00:00
|
|
|
int (*nlattr_to_tuple)(struct nlattr *tb[],
|
2020-05-04 19:34:29 +00:00
|
|
|
struct nf_conntrack_tuple *t,
|
|
|
|
u_int32_t flags);
|
2007-09-28 21:39:55 +00:00
|
|
|
const struct nla_policy *nla_policy;
|
2006-01-05 20:19:05 +00:00
|
|
|
|
2012-02-28 18:13:48 +00:00
|
|
|
struct {
|
2012-05-28 21:04:23 +00:00
|
|
|
int (*nlattr_to_obj)(struct nlattr *tb[],
|
|
|
|
struct net *net, void *data);
|
2012-02-28 18:13:48 +00:00
|
|
|
int (*obj_to_nlattr)(struct sk_buff *skb, const void *data);
|
|
|
|
|
2017-08-11 22:57:05 +00:00
|
|
|
u16 obj_size;
|
|
|
|
u16 nlattr_max;
|
2012-02-28 18:13:48 +00:00
|
|
|
const struct nla_policy *nla_policy;
|
|
|
|
} ctnl_timeout;
|
2017-08-11 22:57:07 +00:00
|
|
|
#ifdef CONFIG_NF_CONNTRACK_PROCFS
|
|
|
|
/* Print out the private part of the conntrack. */
|
|
|
|
void (*print_conntrack)(struct seq_file *s, struct nf_conn *);
|
2006-11-29 01:35:20 +00:00
|
|
|
#endif
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
};
|
|
|
|
|
2019-01-15 21:03:33 +00:00
|
|
|
bool icmp_pkt_to_tuple(const struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
struct net *net,
|
|
|
|
struct nf_conntrack_tuple *tuple);
|
|
|
|
|
|
|
|
bool icmpv6_pkt_to_tuple(const struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
struct net *net,
|
|
|
|
struct nf_conntrack_tuple *tuple);
|
|
|
|
|
2019-01-15 21:03:38 +00:00
|
|
|
bool nf_conntrack_invert_icmp_tuple(struct nf_conntrack_tuple *tuple,
|
|
|
|
const struct nf_conntrack_tuple *orig);
|
|
|
|
bool nf_conntrack_invert_icmpv6_tuple(struct nf_conntrack_tuple *tuple,
|
|
|
|
const struct nf_conntrack_tuple *orig);
|
|
|
|
|
2019-03-25 22:11:54 +00:00
|
|
|
int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
const struct nf_hook_state *state,
|
|
|
|
u8 l4proto,
|
|
|
|
union nf_inet_addr *outer_daddr);
|
|
|
|
|
2018-09-12 13:19:11 +00:00
|
|
|
int nf_conntrack_icmpv4_error(struct nf_conn *tmpl,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
|
|
|
|
int nf_conntrack_icmpv6_error(struct nf_conn *tmpl,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
const struct nf_hook_state *state);
|
2019-01-15 21:03:32 +00:00
|
|
|
|
|
|
|
int nf_conntrack_icmp_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
|
|
|
|
int nf_conntrack_icmpv6_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
|
|
|
|
int nf_conntrack_udp_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
int nf_conntrack_udplite_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
int nf_conntrack_tcp_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
int nf_conntrack_dccp_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
|
|
|
int nf_conntrack_sctp_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
2019-01-15 21:03:40 +00:00
|
|
|
int nf_conntrack_gre_packet(struct nf_conn *ct,
|
|
|
|
struct sk_buff *skb,
|
|
|
|
unsigned int dataoff,
|
|
|
|
enum ip_conntrack_info ctinfo,
|
|
|
|
const struct nf_hook_state *state);
|
2019-01-15 21:03:32 +00:00
|
|
|
|
2019-01-15 21:03:45 +00:00
|
|
|
void nf_conntrack_generic_init_net(struct net *net);
|
|
|
|
void nf_conntrack_tcp_init_net(struct net *net);
|
|
|
|
void nf_conntrack_udp_init_net(struct net *net);
|
|
|
|
void nf_conntrack_gre_init_net(struct net *net);
|
|
|
|
void nf_conntrack_dccp_init_net(struct net *net);
|
|
|
|
void nf_conntrack_sctp_init_net(struct net *net);
|
|
|
|
void nf_conntrack_icmp_init_net(struct net *net);
|
|
|
|
void nf_conntrack_icmpv6_init_net(struct net *net);
|
|
|
|
|
2009-03-16 14:15:35 +00:00
|
|
|
/* Existing built-in generic protocol */
|
2017-11-07 06:20:09 +00:00
|
|
|
extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
|
2018-09-12 13:19:14 +00:00
|
|
|
#define MAX_NF_CT_PROTO IPPROTO_UDPLITE
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
|
2019-01-15 21:03:47 +00:00
|
|
|
const struct nf_conntrack_l4proto *nf_ct_l4proto_find(u8 l4proto);
|
2013-01-23 11:51:10 +00:00
|
|
|
|
2006-01-05 20:19:05 +00:00
|
|
|
/* Generic netlink helpers */
|
2013-09-23 18:37:48 +00:00
|
|
|
int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
|
|
|
|
const struct nf_conntrack_tuple *tuple);
|
|
|
|
int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
|
2020-05-04 19:34:29 +00:00
|
|
|
struct nf_conntrack_tuple *t,
|
|
|
|
u_int32_t flags);
|
2017-11-02 18:41:09 +00:00
|
|
|
unsigned int nf_ct_port_nlattr_tuple_size(void);
|
2007-09-28 21:39:55 +00:00
|
|
|
extern const struct nla_policy nf_ct_port_nla_policy[];
|
2006-01-05 20:19:05 +00:00
|
|
|
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
#ifdef CONFIG_SYSCTL
|
2021-06-16 20:06:19 +00:00
|
|
|
__printf(4, 5) __cold
|
2017-10-11 08:47:41 +00:00
|
|
|
void nf_ct_l4proto_log_invalid(const struct sk_buff *skb,
|
|
|
|
const struct nf_conn *ct,
|
2021-06-16 20:06:19 +00:00
|
|
|
const struct nf_hook_state *state,
|
2017-10-11 08:47:41 +00:00
|
|
|
const char *fmt, ...);
|
2021-06-16 20:06:19 +00:00
|
|
|
__printf(4, 5) __cold
|
2017-10-11 08:47:40 +00:00
|
|
|
void nf_l4proto_log_invalid(const struct sk_buff *skb,
|
2021-06-16 20:06:19 +00:00
|
|
|
const struct nf_hook_state *state,
|
|
|
|
u8 protonum,
|
2017-10-11 08:47:40 +00:00
|
|
|
const char *fmt, ...);
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
#else
|
2021-06-16 20:06:19 +00:00
|
|
|
static inline __printf(4, 5) __cold
|
|
|
|
void nf_l4proto_log_invalid(const struct sk_buff *skb,
|
|
|
|
const struct nf_hook_state *state,
|
|
|
|
u8 protonum,
|
|
|
|
const char *fmt, ...) {}
|
|
|
|
static inline __printf(4, 5) __cold
|
2017-10-11 08:47:41 +00:00
|
|
|
void nf_ct_l4proto_log_invalid(const struct sk_buff *skb,
|
|
|
|
const struct nf_conn *ct,
|
2021-06-16 20:06:19 +00:00
|
|
|
const struct nf_hook_state *state,
|
2017-10-11 08:47:41 +00:00
|
|
|
const char *fmt, ...) { }
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
#endif /* CONFIG_SYSCTL */
|
|
|
|
|
2019-08-07 14:17:02 +00:00
|
|
|
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
|
2018-11-01 23:11:34 +00:00
|
|
|
static inline struct nf_generic_net *nf_generic_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.generic;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct nf_tcp_net *nf_tcp_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.tcp;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct nf_udp_net *nf_udp_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.udp;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct nf_icmp_net *nf_icmp_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.icmp;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct nf_icmp_net *nf_icmpv6_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.icmpv6;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
2020-11-16 13:01:26 +00:00
|
|
|
|
|
|
|
/* Caller must check nf_ct_protonum(ct) is IPPROTO_TCP before calling. */
|
|
|
|
static inline void nf_ct_set_tcp_be_liberal(struct nf_conn *ct)
|
|
|
|
{
|
|
|
|
ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
|
|
|
ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Caller must check nf_ct_protonum(ct) is IPPROTO_TCP before calling. */
|
|
|
|
static inline bool nf_conntrack_tcp_established(const struct nf_conn *ct)
|
|
|
|
{
|
|
|
|
return ct->proto.tcp.state == TCP_CONNTRACK_ESTABLISHED &&
|
|
|
|
test_bit(IPS_ASSURED_BIT, &ct->status);
|
|
|
|
}
|
2019-08-07 14:17:02 +00:00
|
|
|
#endif
|
2018-11-01 23:11:34 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_NF_CT_PROTO_DCCP
|
|
|
|
static inline struct nf_dccp_net *nf_dccp_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.dccp;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_NF_CT_PROTO_SCTP
|
|
|
|
static inline struct nf_sctp_net *nf_sctp_pernet(struct net *net)
|
|
|
|
{
|
2019-09-13 08:13:02 +00:00
|
|
|
return &net->ct.nf_ct_proto.sctp;
|
2018-11-01 23:11:34 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-01-15 21:03:35 +00:00
|
|
|
#ifdef CONFIG_NF_CT_PROTO_GRE
|
|
|
|
static inline struct nf_gre_net *nf_gre_pernet(struct net *net)
|
|
|
|
{
|
|
|
|
return &net->ct.nf_ct_proto.gre;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[NETFILTER]: Add nf_conntrack subsystem.
The existing connection tracking subsystem in netfilter can only
handle ipv4. There were basically two choices present to add
connection tracking support for ipv6. We could either duplicate all
of the ipv4 connection tracking code into an ipv6 counterpart, or (the
choice taken by these patches) we could design a generic layer that
could handle both ipv4 and ipv6 and thus requiring only one sub-protocol
(TCP, UDP, etc.) connection tracking helper module to be written.
In fact nf_conntrack is capable of working with any layer 3
protocol.
The existing ipv4 specific conntrack code could also not deal
with the pecularities of doing connection tracking on ipv6,
which is also cured here. For example, these issues include:
1) ICMPv6 handling, which is used for neighbour discovery in
ipv6 thus some messages such as these should not participate
in connection tracking since effectively they are like ARP
messages
2) fragmentation must be handled differently in ipv6, because
the simplistic "defrag, connection track and NAT, refrag"
(which the existing ipv4 connection tracking does) approach simply
isn't feasible in ipv6
3) ipv6 extension header parsing must occur at the correct spots
before and after connection tracking decisions, and there were
no provisions for this in the existing connection tracking
design
4) ipv6 has no need for stateful NAT
The ipv4 specific conntrack layer is kept around, until all of
the ipv4 specific conntrack helpers are ported over to nf_conntrack
and it is feature complete. Once that occurs, the old conntrack
stuff will get placed into the feature-removal-schedule and we will
fully kill it off 6 months later.
Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Harald Welte <laforge@netfilter.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
2005-11-10 00:38:16 +00:00
|
|
|
#endif /*_NF_CONNTRACK_PROTOCOL_H*/
|