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 */
|
2014-07-14 02:49:37 +00:00
|
|
|
#ifndef __NET_UDP_TUNNEL_H
|
|
|
|
#define __NET_UDP_TUNNEL_H
|
|
|
|
|
2014-09-17 00:31:17 +00:00
|
|
|
#include <net/ip_tunnels.h>
|
|
|
|
#include <net/udp.h>
|
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
#include <net/ipv6.h>
|
2019-03-22 13:06:09 +00:00
|
|
|
#include <net/ipv6_stubs.h>
|
2014-09-17 00:31:17 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-14 02:49:37 +00:00
|
|
|
struct udp_port_cfg {
|
|
|
|
u8 family;
|
|
|
|
|
|
|
|
/* Used only for kernel-created sockets */
|
|
|
|
union {
|
|
|
|
struct in_addr local_ip;
|
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
struct in6_addr local_ip6;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct in_addr peer_ip;
|
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
struct in6_addr peer_ip6;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
__be16 local_udp_port;
|
|
|
|
__be16 peer_udp_port;
|
2018-12-03 09:54:38 +00:00
|
|
|
int bind_ifindex;
|
2014-07-14 02:49:37 +00:00
|
|
|
unsigned int use_udp_checksums:1,
|
|
|
|
use_udp6_tx_checksums:1,
|
2015-08-28 18:48:22 +00:00
|
|
|
use_udp6_rx_checksums:1,
|
|
|
|
ipv6_v6only:1;
|
2014-07-14 02:49:37 +00:00
|
|
|
};
|
|
|
|
|
2014-09-17 00:31:16 +00:00
|
|
|
int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
|
|
|
|
struct socket **sockp);
|
|
|
|
|
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
|
|
|
|
struct socket **sockp);
|
|
|
|
#else
|
|
|
|
static inline int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
|
|
|
|
struct socket **sockp)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline int udp_sock_create(struct net *net,
|
|
|
|
struct udp_port_cfg *cfg,
|
|
|
|
struct socket **sockp)
|
|
|
|
{
|
|
|
|
if (cfg->family == AF_INET)
|
|
|
|
return udp_sock_create4(net, cfg, sockp);
|
|
|
|
|
|
|
|
if (cfg->family == AF_INET6)
|
|
|
|
return udp_sock_create6(net, cfg, sockp);
|
|
|
|
|
|
|
|
return -EPFNOSUPPORT;
|
|
|
|
}
|
2014-07-14 02:49:37 +00:00
|
|
|
|
2014-09-17 00:31:17 +00:00
|
|
|
typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb);
|
udp: Handle ICMP errors for tunnels with same destination port on both endpoints
For both IPv4 and IPv6, if we can't match errors to a socket, try
tunnels before ignoring them. Look up a socket with the original source
and destination ports as found in the UDP packet inside the ICMP payload,
this will work for tunnels that force the same destination port for both
endpoints, i.e. VXLAN and GENEVE.
Actually, lwtunnels could break this assumption if they are configured by
an external control plane to have different destination ports on the
endpoints: in this case, we won't be able to trace ICMP messages back to
them.
For IPv6 redirect messages, call ip6_redirect() directly with the output
interface argument set to the interface we received the packet from (as
it's the very interface we should build the exception on), otherwise the
new nexthop will be rejected. There's no such need for IPv4.
Tunnels can now export an encap_err_lookup() operation that indicates a
match. Pass the packet to the lookup function, and if the tunnel driver
reports a matching association, continue with regular ICMP error handling.
v2:
- Added newline between network and transport header sets in
__udp{4,6}_lib_err_encap() (David Miller)
- Removed redundant skb_reset_network_header(skb); in
__udp4_lib_err_encap()
- Removed redundant reassignment of iph in __udp4_lib_err_encap()
(Sabrina Dubroca)
- Edited comment to __udp{4,6}_lib_err_encap() to reflect the fact this
won't work with lwtunnels configured to use asymmetric ports. By the way,
it's VXLAN, not VxLAN (Jiri Benc)
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-08 11:19:14 +00:00
|
|
|
typedef int (*udp_tunnel_encap_err_lookup_t)(struct sock *sk,
|
|
|
|
struct sk_buff *skb);
|
2014-09-17 00:31:17 +00:00
|
|
|
typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk);
|
2018-06-24 05:13:49 +00:00
|
|
|
typedef struct sk_buff *(*udp_tunnel_gro_receive_t)(struct sock *sk,
|
|
|
|
struct list_head *head,
|
|
|
|
struct sk_buff *skb);
|
2016-04-05 15:22:52 +00:00
|
|
|
typedef int (*udp_tunnel_gro_complete_t)(struct sock *sk, struct sk_buff *skb,
|
|
|
|
int nhoff);
|
2014-09-17 00:31:17 +00:00
|
|
|
|
|
|
|
struct udp_tunnel_sock_cfg {
|
|
|
|
void *sk_user_data; /* user data used by encap_rcv call back */
|
|
|
|
/* Used for setting up udp_sock fields, see udp.h for details */
|
|
|
|
__u8 encap_type;
|
|
|
|
udp_tunnel_encap_rcv_t encap_rcv;
|
udp: Handle ICMP errors for tunnels with same destination port on both endpoints
For both IPv4 and IPv6, if we can't match errors to a socket, try
tunnels before ignoring them. Look up a socket with the original source
and destination ports as found in the UDP packet inside the ICMP payload,
this will work for tunnels that force the same destination port for both
endpoints, i.e. VXLAN and GENEVE.
Actually, lwtunnels could break this assumption if they are configured by
an external control plane to have different destination ports on the
endpoints: in this case, we won't be able to trace ICMP messages back to
them.
For IPv6 redirect messages, call ip6_redirect() directly with the output
interface argument set to the interface we received the packet from (as
it's the very interface we should build the exception on), otherwise the
new nexthop will be rejected. There's no such need for IPv4.
Tunnels can now export an encap_err_lookup() operation that indicates a
match. Pass the packet to the lookup function, and if the tunnel driver
reports a matching association, continue with regular ICMP error handling.
v2:
- Added newline between network and transport header sets in
__udp{4,6}_lib_err_encap() (David Miller)
- Removed redundant skb_reset_network_header(skb); in
__udp4_lib_err_encap()
- Removed redundant reassignment of iph in __udp4_lib_err_encap()
(Sabrina Dubroca)
- Edited comment to __udp{4,6}_lib_err_encap() to reflect the fact this
won't work with lwtunnels configured to use asymmetric ports. By the way,
it's VXLAN, not VxLAN (Jiri Benc)
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-08 11:19:14 +00:00
|
|
|
udp_tunnel_encap_err_lookup_t encap_err_lookup;
|
2014-09-17 00:31:17 +00:00
|
|
|
udp_tunnel_encap_destroy_t encap_destroy;
|
2016-04-05 15:22:52 +00:00
|
|
|
udp_tunnel_gro_receive_t gro_receive;
|
|
|
|
udp_tunnel_gro_complete_t gro_complete;
|
2014-09-17 00:31:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup the given (UDP) sock to receive UDP encapsulated packets */
|
|
|
|
void setup_udp_tunnel_sock(struct net *net, struct socket *sock,
|
|
|
|
struct udp_tunnel_sock_cfg *sock_cfg);
|
|
|
|
|
2016-06-16 19:20:52 +00:00
|
|
|
/* -- List of parsable UDP tunnel types --
|
|
|
|
*
|
|
|
|
* Adding to this list will result in serious debate. The main issue is
|
|
|
|
* that this list is essentially a list of workarounds for either poorly
|
|
|
|
* designed tunnels, or poorly designed device offloads.
|
|
|
|
*
|
|
|
|
* The parsing supported via these types should really be used for Rx
|
|
|
|
* traffic only as the network stack will have already inserted offsets for
|
|
|
|
* the location of the headers in the skb. In addition any ports that are
|
|
|
|
* pushed should be kept within the namespace without leaking to other
|
|
|
|
* devices such as VFs or other ports on the same device.
|
|
|
|
*
|
|
|
|
* It is strongly encouraged to use CHECKSUM_COMPLETE for Rx to avoid the
|
|
|
|
* need to use this for Rx checksum offload. It should not be necessary to
|
|
|
|
* call this function to perform Tx offloads on outgoing traffic.
|
|
|
|
*/
|
|
|
|
enum udp_parsable_tunnel_type {
|
|
|
|
UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */
|
|
|
|
UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */
|
2016-06-16 19:23:19 +00:00
|
|
|
UDP_TUNNEL_TYPE_VXLAN_GPE, /* draft-ietf-nvo3-vxlan-gpe */
|
2016-06-16 19:20:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct udp_tunnel_info {
|
|
|
|
unsigned short type;
|
|
|
|
sa_family_t sa_family;
|
|
|
|
__be16 port;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Notify network devices of offloadable types */
|
|
|
|
void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock,
|
|
|
|
unsigned short type);
|
2017-07-21 10:49:30 +00:00
|
|
|
void udp_tunnel_drop_rx_port(struct net_device *dev, struct socket *sock,
|
|
|
|
unsigned short type);
|
2016-06-16 19:20:52 +00:00
|
|
|
void udp_tunnel_notify_add_rx_port(struct socket *sock, unsigned short type);
|
|
|
|
void udp_tunnel_notify_del_rx_port(struct socket *sock, unsigned short type);
|
|
|
|
|
2016-06-16 19:21:00 +00:00
|
|
|
static inline void udp_tunnel_get_rx_info(struct net_device *dev)
|
|
|
|
{
|
|
|
|
ASSERT_RTNL();
|
|
|
|
call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev);
|
|
|
|
}
|
|
|
|
|
2017-07-21 10:49:30 +00:00
|
|
|
static inline void udp_tunnel_drop_rx_info(struct net_device *dev)
|
|
|
|
{
|
|
|
|
ASSERT_RTNL();
|
|
|
|
call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev);
|
|
|
|
}
|
|
|
|
|
2014-09-17 00:31:17 +00:00
|
|
|
/* Transmit the skb using UDP encapsulation. */
|
2015-12-24 22:34:54 +00:00
|
|
|
void udp_tunnel_xmit_skb(struct rtable *rt, struct sock *sk, struct sk_buff *skb,
|
|
|
|
__be32 src, __be32 dst, __u8 tos, __u8 ttl,
|
|
|
|
__be16 df, __be16 src_port, __be16 dst_port,
|
|
|
|
bool xnet, bool nocheck);
|
2014-09-17 00:31:17 +00:00
|
|
|
|
2015-04-06 02:19:09 +00:00
|
|
|
int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
|
|
|
|
struct sk_buff *skb,
|
2015-01-20 19:23:04 +00:00
|
|
|
struct net_device *dev, struct in6_addr *saddr,
|
|
|
|
struct in6_addr *daddr,
|
2016-03-09 02:00:02 +00:00
|
|
|
__u8 prio, __u8 ttl, __be32 label,
|
|
|
|
__be16 src_port, __be16 dst_port, bool nocheck);
|
2014-09-17 00:31:17 +00:00
|
|
|
|
|
|
|
void udp_tunnel_sock_release(struct socket *sock);
|
|
|
|
|
2015-08-27 06:46:50 +00:00
|
|
|
struct metadata_dst *udp_tun_rx_dst(struct sk_buff *skb, unsigned short family,
|
|
|
|
__be16 flags, __be64 tunnel_id,
|
|
|
|
int md_size);
|
|
|
|
|
2016-06-16 19:20:44 +00:00
|
|
|
#ifdef CONFIG_INET
|
2016-04-14 19:33:37 +00:00
|
|
|
static inline int udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum)
|
2014-09-17 00:31:17 +00:00
|
|
|
{
|
|
|
|
int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
|
|
|
|
|
2016-02-11 21:02:31 +00:00
|
|
|
return iptunnel_handle_offloads(skb, type);
|
2014-09-17 00:31:17 +00:00
|
|
|
}
|
2016-06-16 19:20:44 +00:00
|
|
|
#endif
|
2014-09-17 00:31:17 +00:00
|
|
|
|
|
|
|
static inline void udp_tunnel_encap_enable(struct socket *sock)
|
|
|
|
{
|
2018-11-07 11:38:28 +00:00
|
|
|
struct udp_sock *up = udp_sk(sock->sk);
|
|
|
|
|
|
|
|
if (up->encap_enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
up->encap_enabled = 1;
|
2014-09-17 00:31:17 +00:00
|
|
|
#if IS_ENABLED(CONFIG_IPV6)
|
|
|
|
if (sock->sk->sk_family == PF_INET6)
|
|
|
|
ipv6_stub->udpv6_encap_enable();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
udp_encap_enable();
|
|
|
|
}
|
|
|
|
|
2014-07-14 02:49:37 +00:00
|
|
|
#endif
|