.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * INET An implementation of the TCP/IP protocol suite for the LINUX |
---|
3 | 4 | * operating system. INET is implemented using the BSD Socket |
---|
.. | .. |
---|
8 | 9 | * Version: @(#)udp.h 1.0.2 04/28/93 |
---|
9 | 10 | * |
---|
10 | 11 | * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or |
---|
13 | | - * modify it under the terms of the GNU General Public License |
---|
14 | | - * as published by the Free Software Foundation; either version |
---|
15 | | - * 2 of the License, or (at your option) any later version. |
---|
16 | 12 | */ |
---|
17 | 13 | #ifndef _LINUX_UDP_H |
---|
18 | 14 | #define _LINUX_UDP_H |
---|
.. | .. |
---|
49 | 45 | unsigned int corkflag; /* Cork is required */ |
---|
50 | 46 | __u8 encap_type; /* Is this an Encapsulation socket? */ |
---|
51 | 47 | unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */ |
---|
52 | | - no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */ |
---|
| 48 | + no_check6_rx:1,/* Allow zero UDP6 checksums on RX? */ |
---|
| 49 | + encap_enabled:1, /* This socket enabled encap |
---|
| 50 | + * processing; UDP tunnels and |
---|
| 51 | + * different encapsulation layer set |
---|
| 52 | + * this |
---|
| 53 | + */ |
---|
| 54 | + gro_enabled:1, /* Request GRO aggregation */ |
---|
| 55 | + accept_udp_l4:1, |
---|
| 56 | + accept_udp_fraglist:1; |
---|
53 | 57 | /* |
---|
54 | 58 | * Following member retains the information to create a UDP header |
---|
55 | 59 | * when the socket is uncorked. |
---|
.. | .. |
---|
71 | 75 | * For encapsulation sockets. |
---|
72 | 76 | */ |
---|
73 | 77 | int (*encap_rcv)(struct sock *sk, struct sk_buff *skb); |
---|
| 78 | + int (*encap_err_lookup)(struct sock *sk, struct sk_buff *skb); |
---|
74 | 79 | void (*encap_destroy)(struct sock *sk); |
---|
75 | 80 | |
---|
76 | 81 | /* GRO functions for UDP socket */ |
---|
.. | .. |
---|
115 | 120 | return udp_sk(sk)->no_check6_rx; |
---|
116 | 121 | } |
---|
117 | 122 | |
---|
| 123 | +static inline void udp_cmsg_recv(struct msghdr *msg, struct sock *sk, |
---|
| 124 | + struct sk_buff *skb) |
---|
| 125 | +{ |
---|
| 126 | + int gso_size; |
---|
| 127 | + |
---|
| 128 | + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) { |
---|
| 129 | + gso_size = skb_shinfo(skb)->gso_size; |
---|
| 130 | + put_cmsg(msg, SOL_UDP, UDP_GRO, sizeof(gso_size), &gso_size); |
---|
| 131 | + } |
---|
| 132 | +} |
---|
| 133 | + |
---|
| 134 | +static inline bool udp_unexpected_gso(struct sock *sk, struct sk_buff *skb) |
---|
| 135 | +{ |
---|
| 136 | + if (!skb_is_gso(skb)) |
---|
| 137 | + return false; |
---|
| 138 | + |
---|
| 139 | + if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4 && !udp_sk(sk)->accept_udp_l4) |
---|
| 140 | + return true; |
---|
| 141 | + |
---|
| 142 | + if (skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST && !udp_sk(sk)->accept_udp_fraglist) |
---|
| 143 | + return true; |
---|
| 144 | + |
---|
| 145 | + return false; |
---|
| 146 | +} |
---|
| 147 | + |
---|
118 | 148 | #define udp_portaddr_for_each_entry(__sk, list) \ |
---|
119 | 149 | hlist_for_each_entry(__sk, list, __sk_common.skc_portaddr_node) |
---|
120 | 150 | |
---|