Skip to content

Commit 1d4a65a

Browse files
committed
Merge: net: visibility improvements for 10.1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/902 JIRA: https://issues.redhat.com/browse/RHEL-88891 A few patches added to ease backporting visibility patches, none should introduce a change in behavior. Signed-off-by: Antoine Tenart <[email protected]> Approved-by: Guillaume Nault <[email protected]> Merged-by: Julio Faracco <[email protected]>
2 parents c3be80f + ca985d3 commit 1d4a65a

38 files changed

+575
-346
lines changed

Documentation/networking/net_cachelines/snmp.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ unsigned_long LINUX_MIB_TIMEWAITRECYCLED
3535
unsigned_long LINUX_MIB_TIMEWAITKILLED
3636
unsigned_long LINUX_MIB_PAWSACTIVEREJECTED
3737
unsigned_long LINUX_MIB_PAWSESTABREJECTED
38+
unsigned_long LINUX_MIB_PAWS_OLD_ACK
39+
unsigned_long LINUX_MIB_PAWS_TW_REJECTED
3840
unsigned_long LINUX_MIB_DELAYEDACKLOST
3941
unsigned_long LINUX_MIB_LISTENOVERFLOWS
4042
unsigned_long LINUX_MIB_LISTENDROPS

drivers/net/vxlan/vxlan_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,7 +2808,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
28082808
dev_core_stats_tx_dropped_inc(dev);
28092809
vxlan_vnifilter_count(vxlan, vni, NULL,
28102810
VXLAN_VNI_STATS_TX_DROPS, 0);
2811-
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
2811+
kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
28122812
return NETDEV_TX_OK;
28132813
}
28142814
}
@@ -2831,7 +2831,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
28312831
if (fdst)
28322832
vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
28332833
else
2834-
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
2834+
kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
28352835
}
28362836

28372837
return NETDEV_TX_OK;

drivers/net/vxlan/vxlan_mdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
17121712
vxlan_xmit_one(skb, vxlan->dev, src_vni,
17131713
rcu_dereference(fremote->rd), false);
17141714
else
1715-
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
1715+
kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
17161716

17171717
return NETDEV_TX_OK;
17181718
}

include/net/dropreason-core.h

Lines changed: 121 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
#define DEFINE_DROP_REASON(FN, FNe) \
77
FN(NOT_SPECIFIED) \
88
FN(NO_SOCKET) \
9+
FN(SOCKET_CLOSE) \
10+
FN(SOCKET_FILTER) \
11+
FN(SOCKET_RCVBUFF) \
12+
FN(UNIX_DISCONNECT) \
13+
FN(UNIX_SKIP_OOB) \
914
FN(PKT_TOO_SMALL) \
1015
FN(TCP_CSUM) \
11-
FN(SOCKET_FILTER) \
1216
FN(UDP_CSUM) \
1317
FN(NETFILTER_DROP) \
1418
FN(OTHERHOST) \
@@ -18,7 +22,6 @@
1822
FN(UNICAST_IN_L2_MULTICAST) \
1923
FN(XFRM_POLICY) \
2024
FN(IP_NOPROTO) \
21-
FN(SOCKET_RCVBUFF) \
2225
FN(PROTO_MEM) \
2326
FN(TCP_AUTH_HDR) \
2427
FN(TCP_MD5NOTFOUND) \
@@ -36,6 +39,10 @@
3639
FN(TCP_OVERWINDOW) \
3740
FN(TCP_OFOMERGE) \
3841
FN(TCP_RFC7323_PAWS) \
42+
FN(TCP_RFC7323_PAWS_ACK) \
43+
FN(TCP_RFC7323_TW_PAWS) \
44+
FN(TCP_RFC7323_TSECR) \
45+
FN(TCP_LISTEN_OVERFLOW) \
3946
FN(TCP_OLD_SEQUENCE) \
4047
FN(TCP_INVALID_SEQUENCE) \
4148
FN(TCP_INVALID_ACK_SEQUENCE) \
@@ -58,6 +65,12 @@
5865
FN(TC_EGRESS) \
5966
FN(SECURITY_HOOK) \
6067
FN(QDISC_DROP) \
68+
FN(QDISC_OVERLIMIT) \
69+
FN(QDISC_CONGESTED) \
70+
FN(CAKE_FLOOD) \
71+
FN(FQ_BAND_LIMIT) \
72+
FN(FQ_HORIZON_LIMIT) \
73+
FN(FQ_FLOW_LIMIT) \
6174
FN(CPU_BACKLOG) \
6275
FN(XDP) \
6376
FN(TC_INGRESS) \
@@ -76,6 +89,10 @@
7689
FN(INVALID_PROTO) \
7790
FN(IP_INADDRERRORS) \
7891
FN(IP_INNOROUTES) \
92+
FN(IP_LOCAL_SOURCE) \
93+
FN(IP_INVALID_SOURCE) \
94+
FN(IP_LOCALNET) \
95+
FN(IP_INVALID_DEST) \
7996
FN(PKT_TOO_BIG) \
8097
FN(DUP_FRAG) \
8198
FN(FRAG_REASM_TIMEOUT) \
@@ -96,10 +113,13 @@
96113
FN(VXLAN_VNI_NOT_FOUND) \
97114
FN(MAC_INVALID_SOURCE) \
98115
FN(VXLAN_ENTRY_EXISTS) \
99-
FN(VXLAN_NO_REMOTE) \
116+
FN(NO_TX_TARGET) \
100117
FN(IP_TUNNEL_ECN) \
101118
FN(TUNNEL_TXINFO) \
102119
FN(LOCAL_MAC) \
120+
FN(ARP_PVLAN_DISABLE) \
121+
FN(MAC_IEEE_MAC_CONTROL) \
122+
FN(BRIDGE_INGRESS_STP_STATE) \
103123
FNe(MAX)
104124

105125
/**
@@ -124,12 +144,27 @@ enum skb_drop_reason {
124144
* 3) no valid child socket during 3WHS process
125145
*/
126146
SKB_DROP_REASON_NO_SOCKET,
147+
/** @SKB_DROP_REASON_SOCKET_CLOSE: socket is close()d */
148+
SKB_DROP_REASON_SOCKET_CLOSE,
149+
/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
150+
SKB_DROP_REASON_SOCKET_FILTER,
151+
/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
152+
SKB_DROP_REASON_SOCKET_RCVBUFF,
153+
/**
154+
* @SKB_DROP_REASON_UNIX_DISCONNECT: recv queue is purged when SOCK_DGRAM
155+
* or SOCK_SEQPACKET socket re-connect()s to another socket or notices
156+
* during send() that the peer has been close()d.
157+
*/
158+
SKB_DROP_REASON_UNIX_DISCONNECT,
159+
/**
160+
* @SKB_DROP_REASON_UNIX_SKIP_OOB: Out-Of-Band data is skipped by
161+
* recv() without MSG_OOB so dropped.
162+
*/
163+
SKB_DROP_REASON_UNIX_SKIP_OOB,
127164
/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
128165
SKB_DROP_REASON_PKT_TOO_SMALL,
129166
/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
130167
SKB_DROP_REASON_TCP_CSUM,
131-
/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
132-
SKB_DROP_REASON_SOCKET_FILTER,
133168
/** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */
134169
SKB_DROP_REASON_UDP_CSUM,
135170
/** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */
@@ -160,8 +195,6 @@ enum skb_drop_reason {
160195
SKB_DROP_REASON_XFRM_POLICY,
161196
/** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */
162197
SKB_DROP_REASON_IP_NOPROTO,
163-
/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
164-
SKB_DROP_REASON_SOCKET_RCVBUFF,
165198
/**
166199
* @SKB_DROP_REASON_PROTO_MEM: proto memory limitation, such as
167200
* udp packet drop out of udp_memory_allocated.
@@ -246,6 +279,24 @@ enum skb_drop_reason {
246279
* LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
247280
*/
248281
SKB_DROP_REASON_TCP_RFC7323_PAWS,
282+
/**
283+
* @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
284+
* Corresponds to LINUX_MIB_PAWS_OLD_ACK.
285+
*/
286+
SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
287+
/**
288+
* @SKB_DROP_REASON_TCP_RFC7323_TW_PAWS: PAWS check, socket is in
289+
* TIME_WAIT state.
290+
* Corresponds to LINUX_MIB_PAWS_TW_REJECTED.
291+
*/
292+
SKB_DROP_REASON_TCP_RFC7323_TW_PAWS,
293+
/**
294+
* @SKB_DROP_REASON_TCP_RFC7323_TSECR: PAWS check, invalid TSEcr.
295+
* Corresponds to LINUX_MIB_TSECRREJECTED.
296+
*/
297+
SKB_DROP_REASON_TCP_RFC7323_TSECR,
298+
/** @SKB_DROP_REASON_TCP_LISTEN_OVERFLOW: listener queue full. */
299+
SKB_DROP_REASON_TCP_LISTEN_OVERFLOW,
249300
/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
250301
SKB_DROP_REASON_TCP_OLD_SEQUENCE,
251302
/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
@@ -306,6 +357,36 @@ enum skb_drop_reason {
306357
* failed to enqueue to current qdisc)
307358
*/
308359
SKB_DROP_REASON_QDISC_DROP,
360+
/**
361+
* @SKB_DROP_REASON_QDISC_OVERLIMIT: dropped by qdisc when a qdisc
362+
* instance exceeds its total buffer size limit.
363+
*/
364+
SKB_DROP_REASON_QDISC_OVERLIMIT,
365+
/**
366+
* @SKB_DROP_REASON_QDISC_CONGESTED: dropped by a qdisc AQM algorithm
367+
* due to congestion.
368+
*/
369+
SKB_DROP_REASON_QDISC_CONGESTED,
370+
/**
371+
* @SKB_DROP_REASON_CAKE_FLOOD: dropped by the flood protection part of
372+
* CAKE qdisc AQM algorithm (BLUE).
373+
*/
374+
SKB_DROP_REASON_CAKE_FLOOD,
375+
/**
376+
* @SKB_DROP_REASON_FQ_BAND_LIMIT: dropped by fq qdisc when per band
377+
* limit is reached.
378+
*/
379+
SKB_DROP_REASON_FQ_BAND_LIMIT,
380+
/**
381+
* @SKB_DROP_REASON_FQ_HORIZON_LIMIT: dropped by fq qdisc when packet
382+
* timestamp is too far in the future.
383+
*/
384+
SKB_DROP_REASON_FQ_HORIZON_LIMIT,
385+
/**
386+
* @SKB_DROP_REASON_FQ_FLOW_LIMIT: dropped by fq qdisc when a flow
387+
* exceeds its limits.
388+
*/
389+
SKB_DROP_REASON_FQ_FLOW_LIMIT,
309390
/**
310391
* @SKB_DROP_REASON_CPU_BACKLOG: failed to enqueue the skb to the per CPU
311392
* backlog queue. This can be caused by backlog queue full (see
@@ -373,6 +454,21 @@ enum skb_drop_reason {
373454
* IPSTATS_MIB_INADDRERRORS
374455
*/
375456
SKB_DROP_REASON_IP_INNOROUTES,
457+
/** @SKB_DROP_REASON_IP_LOCAL_SOURCE: the source ip is local */
458+
SKB_DROP_REASON_IP_LOCAL_SOURCE,
459+
/**
460+
* @SKB_DROP_REASON_IP_INVALID_SOURCE: the source ip is invalid:
461+
* 1) source ip is multicast or limited broadcast
462+
* 2) source ip is zero and not IGMP
463+
*/
464+
SKB_DROP_REASON_IP_INVALID_SOURCE,
465+
/** @SKB_DROP_REASON_IP_LOCALNET: source or dest ip is local net */
466+
SKB_DROP_REASON_IP_LOCALNET,
467+
/**
468+
* @SKB_DROP_REASON_IP_INVALID_DEST: the dest ip is invalid:
469+
* 1) dest ip is 0
470+
*/
471+
SKB_DROP_REASON_IP_INVALID_DEST,
376472
/**
377473
* @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the
378474
* MTU)
@@ -441,8 +537,8 @@ enum skb_drop_reason {
441537
* entry or an entry pointing to a nexthop.
442538
*/
443539
SKB_DROP_REASON_VXLAN_ENTRY_EXISTS,
444-
/** @SKB_DROP_REASON_VXLAN_NO_REMOTE: no remote found for xmit */
445-
SKB_DROP_REASON_VXLAN_NO_REMOTE,
540+
/** @SKB_DROP_REASON_NO_TX_TARGET: no target found for xmit */
541+
SKB_DROP_REASON_NO_TX_TARGET,
446542
/**
447543
* @SKB_DROP_REASON_IP_TUNNEL_ECN: skb is dropped according to
448544
* RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
@@ -458,6 +554,22 @@ enum skb_drop_reason {
458554
* the MAC address of the local netdev.
459555
*/
460556
SKB_DROP_REASON_LOCAL_MAC,
557+
/**
558+
* @SKB_DROP_REASON_ARP_PVLAN_DISABLE: packet which is not IP is
559+
* forwarded to the in_dev, and the proxy_arp_pvlan is not
560+
* enabled.
561+
*/
562+
SKB_DROP_REASON_ARP_PVLAN_DISABLE,
563+
/**
564+
* @SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL: the destination MAC address
565+
* is an IEEE MAC Control address.
566+
*/
567+
SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL,
568+
/**
569+
* @SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE: the STP state of the
570+
* ingress bridge port does not allow frames to be forwarded.
571+
*/
572+
SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE,
461573
/**
462574
* @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
463575
* shouldn't be used as a real 'reason' - only for tracing code gen

include/net/ip_fib.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,19 @@ bool fib_info_nh_uses_dev(struct fib_info *fi, const struct net_device *dev);
451451
int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
452452
u8 tos, int oif, struct net_device *dev,
453453
struct in_device *idev, u32 *itag);
454+
455+
static inline enum skb_drop_reason
456+
fib_validate_source_reason(struct sk_buff *skb, __be32 src, __be32 dst,
457+
dscp_t dscp, int oif, struct net_device *dev,
458+
struct in_device *idev, u32 *itag)
459+
{
460+
int err = fib_validate_source(skb, src, dst, dscp, oif, dev, idev,
461+
itag);
462+
if (err < 0)
463+
return -err;
464+
return SKB_NOT_DROPPED_YET;
465+
}
466+
454467
#ifdef CONFIG_IP_ROUTE_CLASSID
455468
static inline int fib_num_tclassid_users(struct net *net)
456469
{

include/net/route.h

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,30 +198,35 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
198198
fl4->fl4_gre_key = gre_key;
199199
return ip_route_output_key(net, fl4);
200200
}
201-
int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
202-
u8 tos, struct net_device *dev,
203-
struct in_device *in_dev, u32 *itag);
204-
int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
205-
u8 tos, struct net_device *devin);
206-
int ip_route_use_hint(struct sk_buff *skb, __be32 dst, __be32 src,
207-
u8 tos, struct net_device *devin,
208-
const struct sk_buff *hint);
209-
210-
static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
211-
u8 tos, struct net_device *devin)
201+
202+
enum skb_drop_reason
203+
ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
204+
u8 tos, struct net_device *dev,
205+
struct in_device *in_dev, u32 *itag);
206+
enum skb_drop_reason
207+
ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
208+
u8 tos, struct net_device *dev);
209+
enum skb_drop_reason
210+
ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
211+
u8 tos, struct net_device *dev,
212+
const struct sk_buff *hint);
213+
214+
static inline enum skb_drop_reason
215+
ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, u8 tos,
216+
struct net_device *devin)
212217
{
213-
int err;
218+
enum skb_drop_reason reason;
214219

215220
rcu_read_lock();
216-
err = ip_route_input_noref(skb, dst, src, tos, devin);
217-
if (!err) {
221+
reason = ip_route_input_noref(skb, dst, src, tos, devin);
222+
if (!reason) {
218223
skb_dst_force(skb);
219224
if (!skb_dst(skb))
220-
err = -EINVAL;
225+
reason = SKB_DROP_REASON_NOT_SPECIFIED;
221226
}
222227
rcu_read_unlock();
223228

224-
return err;
229+
return reason;
225230
}
226231

227232
void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif,

include/net/sch_generic.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,14 @@ static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch,
12441244
return NET_XMIT_DROP;
12451245
}
12461246

1247+
static inline int qdisc_drop_reason(struct sk_buff *skb, struct Qdisc *sch,
1248+
struct sk_buff **to_free,
1249+
enum skb_drop_reason reason)
1250+
{
1251+
tcf_set_drop_reason(skb, reason);
1252+
return qdisc_drop(skb, sch, to_free);
1253+
}
1254+
12471255
static inline int qdisc_drop_all(struct sk_buff *skb, struct Qdisc *sch,
12481256
struct sk_buff **to_free)
12491257
{

include/net/tcp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,11 @@ enum tcp_tw_status {
388388
enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
389389
struct sk_buff *skb,
390390
const struct tcphdr *th,
391-
u32 *tw_isn);
391+
u32 *tw_isn,
392+
enum skb_drop_reason *drop_reason);
392393
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
393394
struct request_sock *req, bool fastopen,
394-
bool *lost_race);
395+
bool *lost_race, enum skb_drop_reason *drop_reason);
395396
enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
396397
struct sk_buff *skb);
397398
void tcp_enter_loss(struct sock *sk);

include/uapi/linux/snmp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ enum
186186
LINUX_MIB_TIMEWAITKILLED, /* TimeWaitKilled */
187187
LINUX_MIB_PAWSACTIVEREJECTED, /* PAWSActiveRejected */
188188
LINUX_MIB_PAWSESTABREJECTED, /* PAWSEstabRejected */
189+
LINUX_MIB_PAWS_OLD_ACK, /* PAWSOldAck */
190+
LINUX_MIB_PAWS_TW_REJECTED, /* PAWSTimewait */
189191
LINUX_MIB_DELAYEDACKS, /* DelayedACKs */
190192
LINUX_MIB_DELAYEDACKLOCKED, /* DelayedACKLocked */
191193
LINUX_MIB_DELAYEDACKLOST, /* DelayedACKLost */

0 commit comments

Comments
 (0)