/usr/src/linux-headers-5.15.0-181/include/net
NameSizeModeActions
9p/-0755rm
bluetooth/-0755rm
caif/-0755rm
iucv/-0755rm
netfilter/-0755rm
netns/-0755rm
nfc/-0755rm
phonet/-0755rm
sctp/-0755rm
tc_act/-0755rm
6lowpan.h102700644editdlrm
act_api.h86470644editdlrm
addrconf.h145940644editdlrm
af_ieee802154.h12200644editdlrm
af_rxrpc.h27980644editdlrm
af_unix.h33750644editdlrm
af_vsock.h75920644editdlrm
ah.h3820644editdlrm
arp.h21410644editdlrm
atmclip.h15150644editdlrm
ax25.h154430644editdlrm
ax88796.h14400644editdlrm
bareudp.h5720644editdlrm
bonding.h202630644editdlrm
bond_3ad.h97060644editdlrm
bond_alb.h62510644editdlrm
bond_options.h38760644editdlrm
bpf_sk_storage.h17800644editdlrm
busy_poll.h39590644editdlrm
calipso.h15900644editdlrm
cfg80211-wext.h18540644editdlrm
cfg80211.h3013170644editdlrm
cfg802154.h107790644editdlrm
checksum.h48690644editdlrm
cipso_ipv4.h75480644editdlrm
cls_cgroup.h20860644editdlrm
codel.h57820644editdlrm
codel_impl.h81670644editdlrm
codel_qdisc.h29730644editdlrm
compat.h25860644editdlrm
datalink.h6190644editdlrm
dcbevent.h7420644editdlrm
dcbnl.h43170644editdlrm
devlink.h635930644editdlrm
dsa.h362310644editdlrm
dsfield.h11470644editdlrm
dst.h151530644editdlrm
dst_cache.h30310644editdlrm
dst_metadata.h55210644editdlrm
dst_ops.h21250644editdlrm
erspan.h91800644editdlrm
esp.h11900644editdlrm
espintcp.h9660644editdlrm
ethoc.h3910644editdlrm
failover.h11780644editdlrm
fib_notifier.h13840644editdlrm
fib_rules.h64500644editdlrm
firewire.h6360644editdlrm
flow.h51190644editdlrm
flow_dissector.h105170644editdlrm
flow_offload.h159380644editdlrm
fou.h5490644editdlrm
fq.h25280644editdlrm
fq_impl.h80760644editdlrm
garp.h26780644editdlrm
genetlink.h138540644editdlrm
geneve.h18980644editdlrm
gen_stats.h28890644editdlrm
gre.h33690644editdlrm
gro.h7830644editdlrm
gro_cells.h4430644editdlrm
gtp.h6330644editdlrm
gue.h33130644editdlrm
hwbm.h9690644editdlrm
icmp.h19180644editdlrm
ieee80211_radiotap.h135180644editdlrm
ieee802154_netdev.h100950644editdlrm
ife.h10570644editdlrm
if_inet6.h66920644editdlrm
ila.h2910644editdlrm
inet6_connection_sock.h7650644editdlrm
inet6_hashtables.h42590644editdlrm
inetpeer.h33720644editdlrm
inet_common.h26140644editdlrm
inet_connection_sock.h115190644editdlrm
inet_ecn.h76250644editdlrm
inet_frag.h50460644editdlrm
inet_hashtables.h125320644editdlrm
inet_sock.h99940644editdlrm
inet_timewait_sock.h37350644editdlrm
ioam6.h11990644editdlrm
ip.h227590644editdlrm
ip6_checksum.h27700644editdlrm
ip6_fib.h162800644editdlrm
ip6_route.h102300644editdlrm
ip6_tunnel.h50960644editdlrm
ipcomp.h6590644editdlrm
ipconfig.h8110644editdlrm
ipv6.h361820644editdlrm
ipv6_frag.h33610644editdlrm
ipv6_stubs.h34820644editdlrm
ip_fib.h163460644editdlrm
ip_tunnels.h159490644editdlrm
ip_vs.h505880644editdlrm
iw_handler.h214130644editdlrm
kcm.h49610644editdlrm
l3mdev.h72020644editdlrm
lag.h4090644editdlrm
lapb.h49380644editdlrm
lib80211.h40170644editdlrm
llc.h45140644editdlrm
llc_conn.h41550644editdlrm
llc_c_ac.h95370644editdlrm
llc_c_ev.h109400644editdlrm
llc_c_st.h17620644editdlrm
llc_if.h22100644editdlrm
llc_pdu.h146970644editdlrm
llc_sap.h11080644editdlrm
llc_s_ac.h15910644editdlrm
llc_s_ev.h22550644editdlrm
llc_s_st.h9470644editdlrm
lwtunnel.h68060644editdlrm
mac80211.h2739720644editdlrm
mac802154.h152350644editdlrm
macsec.h70840644editdlrm
mctp.h61550644editdlrm
mctpdevice.h8410644editdlrm
mip6.h10160644editdlrm
mld.h29180644editdlrm
mpls.h9430644editdlrm
mpls_iptunnel.h4290644editdlrm
mptcp.h67760644editdlrm
mrp.h31190644editdlrm
ncsi.h19640644editdlrm
ndisc.h151500644editdlrm
neighbour.h160990644editdlrm
netevent.h10440644editdlrm
netlabel.h206760644editdlrm
netlink.h616560644editdlrm
netprio_cgroup.h10470644editdlrm
netrom.h78950644editdlrm
net_failover.h10230644editdlrm
net_namespace.h127950644editdlrm
net_ratelimit.h2200644editdlrm
nexthop.h125650644editdlrm
nl802154.h123840644editdlrm
nsh.h126020644editdlrm
p8022.h4470644editdlrm
page_pool.h86460644editdlrm
pie.h36840644editdlrm
ping.h29700644editdlrm
pkt_cls.h244310644editdlrm
pkt_sched.h60420644editdlrm
pptp.h5570644editdlrm
protocol.h39000644editdlrm
psample.h10830644editdlrm
psnap.h3510644editdlrm
raw.h21360644editdlrm
rawv6.h8540644editdlrm
red.h116540644editdlrm
regulatory.h109010644editdlrm
request_sock.h66600644editdlrm
rose.h78020644editdlrm
route.h115820644editdlrm
rpl.h8390644editdlrm
rsi_91x.h17100644editdlrm
rtnetlink.h76380644editdlrm
rtnh.h8590644editdlrm
sch_generic.h347200644editdlrm
scm.h38770644editdlrm
secure_seq.h8550644editdlrm
seg6.h22370644editdlrm
seg6_hmac.h14730644editdlrm
seg6_local.h6440644editdlrm
selftests.h5820644editdlrm
slhc_vj.h68310644editdlrm
smc.h25130644editdlrm
snmp.h52680644editdlrm
sock.h863510644editdlrm
sock_reuseport.h18730644editdlrm
Space.h7370644editdlrm
stp.h3830644editdlrm
strparser.h42500644editdlrm
switchdev.h146140644editdlrm
tcp.h752460644editdlrm
tcp_states.h12250644editdlrm
timewait_sock.h9250644editdlrm
tipc.h24050644editdlrm
tls.h214650644editdlrm
tls_toe.h30060644editdlrm
transp_v6.h19960644editdlrm
tso.h5660644editdlrm
tun_proto.h9880644editdlrm
udp.h170350644editdlrm
udplite.h37620644editdlrm
udp_tunnel.h122010644editdlrm
vsock_addr.h6620644editdlrm
vxlan.h144240644editdlrm
wext.h15100644editdlrm
x25.h97180644editdlrm
x25device.h3870644editdlrm
xdp.h88290644editdlrm
xdp_priv.h4460644editdlrm
xdp_sock.h20940644editdlrm
xdp_sock_drv.h56070644editdlrm
xfrm.h563040644editdlrm
xsk_buff_pool.h51380644editdlrm
Edit: /usr/src/linux-headers-5.15.0-181/include/net/udp_tunnel.h (12201B)
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __NET_UDP_TUNNEL_H #define __NET_UDP_TUNNEL_H #include #include #if IS_ENABLED(CONFIG_IPV6) #include #include #endif 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; int bind_ifindex; unsigned int use_udp_checksums:1, use_udp6_tx_checksums:1, use_udp6_rx_checksums:1, ipv6_v6only:1; }; 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; } typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb); typedef int (*udp_tunnel_encap_err_lookup_t)(struct sock *sk, struct sk_buff *skb); typedef void (*udp_tunnel_encap_err_rcv_t)(struct sock *sk, struct sk_buff *skb, unsigned int udp_offset); typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk); typedef struct sk_buff *(*udp_tunnel_gro_receive_t)(struct sock *sk, struct list_head *head, struct sk_buff *skb); typedef int (*udp_tunnel_gro_complete_t)(struct sock *sk, struct sk_buff *skb, int nhoff); 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_tunnel_encap_err_lookup_t encap_err_lookup; udp_tunnel_encap_err_rcv_t encap_err_rcv; udp_tunnel_encap_destroy_t encap_destroy; udp_tunnel_gro_receive_t gro_receive; udp_tunnel_gro_complete_t gro_complete; }; /* 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); /* -- 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 = BIT(0), /* RFC 7348 */ UDP_TUNNEL_TYPE_GENEVE = BIT(1), /* draft-ietf-nvo3-geneve */ UDP_TUNNEL_TYPE_VXLAN_GPE = BIT(2), /* draft-ietf-nvo3-vxlan-gpe */ }; struct udp_tunnel_info { unsigned short type; sa_family_t sa_family; __be16 port; u8 hw_priv; }; /* Notify network devices of offloadable types */ void udp_tunnel_push_rx_port(struct net_device *dev, struct socket *sock, unsigned short type); void udp_tunnel_drop_rx_port(struct net_device *dev, struct socket *sock, unsigned short type); 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); static inline void udp_tunnel_get_rx_info(struct net_device *dev) { ASSERT_RTNL(); if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_PUSH_INFO, dev); } static inline void udp_tunnel_drop_rx_info(struct net_device *dev) { ASSERT_RTNL(); if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) return; call_netdevice_notifiers(NETDEV_UDP_TUNNEL_DROP_INFO, dev); } /* Transmit the skb using UDP encapsulation. */ 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); int udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk, struct sk_buff *skb, struct net_device *dev, struct in6_addr *saddr, struct in6_addr *daddr, __u8 prio, __u8 ttl, __be32 label, __be16 src_port, __be16 dst_port, bool nocheck); void udp_tunnel_sock_release(struct socket *sock); struct metadata_dst *udp_tun_rx_dst(struct sk_buff *skb, unsigned short family, __be16 flags, __be64 tunnel_id, int md_size); #ifdef CONFIG_INET static inline int udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum) { int type = udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; return iptunnel_handle_offloads(skb, type); } #endif static inline void udp_tunnel_encap_enable(struct socket *sock) { struct udp_sock *up = udp_sk(sock->sk); if (up->encap_enabled) return; up->encap_enabled = 1; #if IS_ENABLED(CONFIG_IPV6) if (sock->sk->sk_family == PF_INET6) ipv6_stub->udpv6_encap_enable(); #endif udp_encap_enable(); } #define UDP_TUNNEL_NIC_MAX_TABLES 4 enum udp_tunnel_nic_info_flags { /* Device callbacks may sleep */ UDP_TUNNEL_NIC_INFO_MAY_SLEEP = BIT(0), /* Device only supports offloads when it's open, all ports * will be removed before close and re-added after open. */ UDP_TUNNEL_NIC_INFO_OPEN_ONLY = BIT(1), /* Device supports only IPv4 tunnels */ UDP_TUNNEL_NIC_INFO_IPV4_ONLY = BIT(2), /* Device has hard-coded the IANA VXLAN port (4789) as VXLAN. * This port must not be counted towards n_entries of any table. * Driver will not receive any callback associated with port 4789. */ UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN = BIT(3), }; struct udp_tunnel_nic; #define UDP_TUNNEL_NIC_MAX_SHARING_DEVICES (U16_MAX / 2) struct udp_tunnel_nic_shared { struct udp_tunnel_nic *udp_tunnel_nic_info; struct list_head devices; }; struct udp_tunnel_nic_shared_node { struct net_device *dev; struct list_head list; }; /** * struct udp_tunnel_nic_info - driver UDP tunnel offload information * @set_port: callback for adding a new port * @unset_port: callback for removing a port * @sync_table: callback for syncing the entire port table at once * @shared: reference to device global state (optional) * @flags: device flags from enum udp_tunnel_nic_info_flags * @tables: UDP port tables this device has * @tables.n_entries: number of entries in this table * @tables.tunnel_types: types of tunnels this table accepts * * Drivers are expected to provide either @set_port and @unset_port callbacks * or the @sync_table callback. Callbacks are invoked with rtnl lock held. * * Devices which (misguidedly) share the UDP tunnel port table across multiple * netdevs should allocate an instance of struct udp_tunnel_nic_shared and * point @shared at it. * There must never be more than %UDP_TUNNEL_NIC_MAX_SHARING_DEVICES devices * sharing a table. * * Known limitations: * - UDP tunnel port notifications are fundamentally best-effort - * it is likely the driver will both see skbs which use a UDP tunnel port, * while not being a tunneled skb, and tunnel skbs from other ports - * drivers should only use these ports for non-critical RX-side offloads, * e.g. the checksum offload; * - none of the devices care about the socket family at present, so we don't * track it. Please extend this code if you care. */ struct udp_tunnel_nic_info { /* one-by-one */ int (*set_port)(struct net_device *dev, unsigned int table, unsigned int entry, struct udp_tunnel_info *ti); int (*unset_port)(struct net_device *dev, unsigned int table, unsigned int entry, struct udp_tunnel_info *ti); /* all at once */ int (*sync_table)(struct net_device *dev, unsigned int table); struct udp_tunnel_nic_shared *shared; unsigned int flags; struct udp_tunnel_nic_table_info { unsigned int n_entries; unsigned int tunnel_types; } tables[UDP_TUNNEL_NIC_MAX_TABLES]; }; /* UDP tunnel module dependencies * * Tunnel drivers are expected to have a hard dependency on the udp_tunnel * module. NIC drivers are not, they just attach their * struct udp_tunnel_nic_info to the netdev and wait for callbacks to come. * Loading a tunnel driver will cause the udp_tunnel module to be loaded * and only then will all the required state structures be allocated. * Since we want a weak dependency from the drivers and the core to udp_tunnel * we call things through the following stubs. */ struct udp_tunnel_nic_ops { void (*get_port)(struct net_device *dev, unsigned int table, unsigned int idx, struct udp_tunnel_info *ti); void (*set_port_priv)(struct net_device *dev, unsigned int table, unsigned int idx, u8 priv); void (*add_port)(struct net_device *dev, struct udp_tunnel_info *ti); void (*del_port)(struct net_device *dev, struct udp_tunnel_info *ti); void (*reset_ntf)(struct net_device *dev); size_t (*dump_size)(struct net_device *dev, unsigned int table); int (*dump_write)(struct net_device *dev, unsigned int table, struct sk_buff *skb); }; #ifdef CONFIG_INET extern const struct udp_tunnel_nic_ops *udp_tunnel_nic_ops; #else #define udp_tunnel_nic_ops ((struct udp_tunnel_nic_ops *)NULL) #endif static inline void udp_tunnel_nic_get_port(struct net_device *dev, unsigned int table, unsigned int idx, struct udp_tunnel_info *ti) { /* This helper is used from .sync_table, we indicate empty entries * by zero'ed @ti. Drivers which need to know the details of a port * when it gets deleted should use the .set_port / .unset_port * callbacks. * Zero out here, otherwise !CONFIG_INET causes uninitilized warnings. */ memset(ti, 0, sizeof(*ti)); if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->get_port(dev, table, idx, ti); } static inline void udp_tunnel_nic_set_port_priv(struct net_device *dev, unsigned int table, unsigned int idx, u8 priv) { if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->set_port_priv(dev, table, idx, priv); } static inline void udp_tunnel_nic_add_port(struct net_device *dev, struct udp_tunnel_info *ti) { if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->add_port(dev, ti); } static inline void udp_tunnel_nic_del_port(struct net_device *dev, struct udp_tunnel_info *ti) { if (!(dev->features & NETIF_F_RX_UDP_TUNNEL_PORT)) return; if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->del_port(dev, ti); } /** * udp_tunnel_nic_reset_ntf() - device-originating reset notification * @dev: network interface device structure * * Called by the driver to inform the core that the entire UDP tunnel port * state has been lost, usually due to device reset. Core will assume device * forgot all the ports and issue .set_port and .sync_table callbacks as * necessary. * * This function must be called with rtnl lock held, and will issue all * the callbacks before returning. */ static inline void udp_tunnel_nic_reset_ntf(struct net_device *dev) { if (udp_tunnel_nic_ops) udp_tunnel_nic_ops->reset_ntf(dev); } static inline size_t udp_tunnel_nic_dump_size(struct net_device *dev, unsigned int table) { if (!udp_tunnel_nic_ops) return 0; return udp_tunnel_nic_ops->dump_size(dev, table); } static inline int udp_tunnel_nic_dump_write(struct net_device *dev, unsigned int table, struct sk_buff *skb) { if (!udp_tunnel_nic_ops) return 0; return udp_tunnel_nic_ops->dump_write(dev, table, skb); } #endif