Skip to content

Commit b57f037

Browse files
committed
Merge: net: visibility improvements for 9.7
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7024 JIRA: https://issues.redhat.com/browse/RHEL-88890 A few patches added to ease backporting visibility patches, none should introduce a change in behavior. Signed-off-by: Antoine Tenart <atenart@redhat.com> Approved-by: Sabrina Dubroca <sdubroca@redhat.com> Approved-by: Florian Westphal <fwestpha@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents e457eba + 0e74942 commit b57f037

File tree

28 files changed

+466
-308
lines changed

28 files changed

+466
-308
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
@@ -2793,7 +2793,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
27932793
dev_core_stats_tx_dropped_inc(dev);
27942794
vxlan_vnifilter_count(vxlan, vni, NULL,
27952795
VXLAN_VNI_STATS_TX_DROPS, 0);
2796-
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
2796+
kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
27972797
return NETDEV_TX_OK;
27982798
}
27992799
}
@@ -2816,7 +2816,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
28162816
if (fdst)
28172817
vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
28182818
else
2819-
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
2819+
kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
28202820
}
28212821

28222822
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: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
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) \
913
FN(PKT_TOO_SMALL) \
1014
FN(TCP_CSUM) \
11-
FN(SOCKET_FILTER) \
1215
FN(UDP_CSUM) \
1316
FN(NETFILTER_DROP) \
1417
FN(OTHERHOST) \
@@ -18,7 +21,6 @@
1821
FN(UNICAST_IN_L2_MULTICAST) \
1922
FN(XFRM_POLICY) \
2023
FN(IP_NOPROTO) \
21-
FN(SOCKET_RCVBUFF) \
2224
FN(PROTO_MEM) \
2325
FN(TCP_MD5NOTFOUND) \
2426
FN(TCP_MD5UNEXPECTED) \
@@ -31,6 +33,10 @@
3133
FN(TCP_OVERWINDOW) \
3234
FN(TCP_OFOMERGE) \
3335
FN(TCP_RFC7323_PAWS) \
36+
FN(TCP_RFC7323_PAWS_ACK) \
37+
FN(TCP_RFC7323_TW_PAWS) \
38+
FN(TCP_RFC7323_TSECR) \
39+
FN(TCP_LISTEN_OVERFLOW) \
3440
FN(TCP_OLD_SEQUENCE) \
3541
FN(TCP_INVALID_SEQUENCE) \
3642
FN(TCP_INVALID_ACK_SEQUENCE) \
@@ -77,6 +83,10 @@
7783
FN(INVALID_PROTO) \
7884
FN(IP_INADDRERRORS) \
7985
FN(IP_INNOROUTES) \
86+
FN(IP_LOCAL_SOURCE) \
87+
FN(IP_INVALID_SOURCE) \
88+
FN(IP_LOCALNET) \
89+
FN(IP_INVALID_DEST) \
8090
FN(PKT_TOO_BIG) \
8191
FN(DUP_FRAG) \
8292
FN(FRAG_REASM_TIMEOUT) \
@@ -97,10 +107,13 @@
97107
FN(VXLAN_VNI_NOT_FOUND) \
98108
FN(MAC_INVALID_SOURCE) \
99109
FN(VXLAN_ENTRY_EXISTS) \
100-
FN(VXLAN_NO_REMOTE) \
110+
FN(NO_TX_TARGET) \
101111
FN(IP_TUNNEL_ECN) \
102112
FN(TUNNEL_TXINFO) \
103113
FN(LOCAL_MAC) \
114+
FN(ARP_PVLAN_DISABLE) \
115+
FN(MAC_IEEE_MAC_CONTROL) \
116+
FN(BRIDGE_INGRESS_STP_STATE) \
104117
FNe(MAX)
105118

106119
/**
@@ -125,12 +138,22 @@ enum skb_drop_reason {
125138
* 3) no valid child socket during 3WHS process
126139
*/
127140
SKB_DROP_REASON_NO_SOCKET,
141+
/** @SKB_DROP_REASON_SOCKET_CLOSE: socket is close()d */
142+
SKB_DROP_REASON_SOCKET_CLOSE,
143+
/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
144+
SKB_DROP_REASON_SOCKET_FILTER,
145+
/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
146+
SKB_DROP_REASON_SOCKET_RCVBUFF,
147+
/**
148+
* @SKB_DROP_REASON_UNIX_DISCONNECT: recv queue is purged when SOCK_DGRAM
149+
* or SOCK_SEQPACKET socket re-connect()s to another socket or notices
150+
* during send() that the peer has been close()d.
151+
*/
152+
SKB_DROP_REASON_UNIX_DISCONNECT,
128153
/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */
129154
SKB_DROP_REASON_PKT_TOO_SMALL,
130155
/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
131156
SKB_DROP_REASON_TCP_CSUM,
132-
/** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */
133-
SKB_DROP_REASON_SOCKET_FILTER,
134157
/** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */
135158
SKB_DROP_REASON_UDP_CSUM,
136159
/** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */
@@ -161,8 +184,6 @@ enum skb_drop_reason {
161184
SKB_DROP_REASON_XFRM_POLICY,
162185
/** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */
163186
SKB_DROP_REASON_IP_NOPROTO,
164-
/** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */
165-
SKB_DROP_REASON_SOCKET_RCVBUFF,
166187
/**
167188
* @SKB_DROP_REASON_PROTO_MEM: proto memory limition, such as udp packet
168189
* drop out of udp_memory_allocated.
@@ -222,6 +243,24 @@ enum skb_drop_reason {
222243
* LINUX_MIB_PAWSESTABREJECTED, LINUX_MIB_PAWSACTIVEREJECTED
223244
*/
224245
SKB_DROP_REASON_TCP_RFC7323_PAWS,
246+
/**
247+
* @SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK: PAWS check, old ACK packet.
248+
* Corresponds to LINUX_MIB_PAWS_OLD_ACK.
249+
*/
250+
SKB_DROP_REASON_TCP_RFC7323_PAWS_ACK,
251+
/**
252+
* @SKB_DROP_REASON_TCP_RFC7323_TW_PAWS: PAWS check, socket is in
253+
* TIME_WAIT state.
254+
* Corresponds to LINUX_MIB_PAWS_TW_REJECTED.
255+
*/
256+
SKB_DROP_REASON_TCP_RFC7323_TW_PAWS,
257+
/**
258+
* @SKB_DROP_REASON_TCP_RFC7323_TSECR: PAWS check, invalid TSEcr.
259+
* Corresponds to LINUX_MIB_TSECRREJECTED.
260+
*/
261+
SKB_DROP_REASON_TCP_RFC7323_TSECR,
262+
/** @SKB_DROP_REASON_TCP_LISTEN_OVERFLOW: listener queue full. */
263+
SKB_DROP_REASON_TCP_LISTEN_OVERFLOW,
225264
/** @SKB_DROP_REASON_TCP_OLD_SEQUENCE: Old SEQ field (duplicate packet) */
226265
SKB_DROP_REASON_TCP_OLD_SEQUENCE,
227266
/** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */
@@ -379,6 +418,21 @@ enum skb_drop_reason {
379418
* IPSTATS_MIB_INADDRERRORS
380419
*/
381420
SKB_DROP_REASON_IP_INNOROUTES,
421+
/** @SKB_DROP_REASON_IP_LOCAL_SOURCE: the source ip is local */
422+
SKB_DROP_REASON_IP_LOCAL_SOURCE,
423+
/**
424+
* @SKB_DROP_REASON_IP_INVALID_SOURCE: the source ip is invalid:
425+
* 1) source ip is multicast or limited broadcast
426+
* 2) source ip is zero and not IGMP
427+
*/
428+
SKB_DROP_REASON_IP_INVALID_SOURCE,
429+
/** @SKB_DROP_REASON_IP_LOCALNET: source or dest ip is local net */
430+
SKB_DROP_REASON_IP_LOCALNET,
431+
/**
432+
* @SKB_DROP_REASON_IP_INVALID_DEST: the dest ip is invalid:
433+
* 1) dest ip is 0
434+
*/
435+
SKB_DROP_REASON_IP_INVALID_DEST,
382436
/**
383437
* @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the
384438
* MTU)
@@ -447,8 +501,8 @@ enum skb_drop_reason {
447501
* entry or an entry pointing to a nexthop.
448502
*/
449503
SKB_DROP_REASON_VXLAN_ENTRY_EXISTS,
450-
/** @SKB_DROP_REASON_VXLAN_NO_REMOTE: no remote found for xmit */
451-
SKB_DROP_REASON_VXLAN_NO_REMOTE,
504+
/** @SKB_DROP_REASON_NO_TX_TARGET: no target found for xmit */
505+
SKB_DROP_REASON_NO_TX_TARGET,
452506
/**
453507
* @SKB_DROP_REASON_IP_TUNNEL_ECN: skb is dropped according to
454508
* RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
@@ -464,6 +518,22 @@ enum skb_drop_reason {
464518
* the MAC address of the local netdev.
465519
*/
466520
SKB_DROP_REASON_LOCAL_MAC,
521+
/**
522+
* @SKB_DROP_REASON_ARP_PVLAN_DISABLE: packet which is not IP is
523+
* forwarded to the in_dev, and the proxy_arp_pvlan is not
524+
* enabled.
525+
*/
526+
SKB_DROP_REASON_ARP_PVLAN_DISABLE,
527+
/**
528+
* @SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL: the destination MAC address
529+
* is an IEEE MAC Control address.
530+
*/
531+
SKB_DROP_REASON_MAC_IEEE_MAC_CONTROL,
532+
/**
533+
* @SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE: the STP state of the
534+
* ingress bridge port does not allow frames to be forwarded.
535+
*/
536+
SKB_DROP_REASON_BRIDGE_INGRESS_STP_STATE,
467537
/**
468538
* @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
469539
* 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
@@ -456,6 +456,19 @@ bool fib_info_nh_uses_dev(struct fib_info *fi, const struct net_device *dev);
456456
int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
457457
u8 tos, int oif, struct net_device *dev,
458458
struct in_device *idev, u32 *itag);
459+
460+
static inline enum skb_drop_reason
461+
fib_validate_source_reason(struct sk_buff *skb, __be32 src, __be32 dst,
462+
dscp_t dscp, int oif, struct net_device *dev,
463+
struct in_device *idev, u32 *itag)
464+
{
465+
int err = fib_validate_source(skb, src, dst, dscp, oif, dev, idev,
466+
itag);
467+
if (err < 0)
468+
return -err;
469+
return SKB_NOT_DROPPED_YET;
470+
}
471+
459472
#ifdef CONFIG_IP_ROUTE_CLASSID
460473
static inline int fib_num_tclassid_users(struct net *net)
461474
{

include/net/route.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,34 +178,35 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
178178
fl4->fl4_gre_key = gre_key;
179179
return ip_route_output_key(net, fl4);
180180
}
181-
int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
182-
u8 tos, struct net_device *dev,
183-
struct in_device *in_dev, u32 *itag);
184-
int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
185-
u8 tos, struct net_device *devin);
186-
int ip_route_input_rcu(struct sk_buff *skb, __be32 dst, __be32 src,
187-
u8 tos, struct net_device *devin,
188-
struct fib_result *res);
189-
190-
int ip_route_use_hint(struct sk_buff *skb, __be32 dst, __be32 src,
191-
u8 tos, struct net_device *devin,
192-
const struct sk_buff *hint);
193-
194-
static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
195-
u8 tos, struct net_device *devin)
181+
182+
enum skb_drop_reason
183+
ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
184+
u8 tos, struct net_device *dev,
185+
struct in_device *in_dev, u32 *itag);
186+
enum skb_drop_reason
187+
ip_route_input_noref(struct sk_buff *skb, __be32 daddr, __be32 saddr,
188+
u8 tos, struct net_device *dev);
189+
enum skb_drop_reason
190+
ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
191+
u8 tos, struct net_device *dev,
192+
const struct sk_buff *hint);
193+
194+
static inline enum skb_drop_reason
195+
ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, u8 tos,
196+
struct net_device *devin)
196197
{
197-
int err;
198+
enum skb_drop_reason reason;
198199

199200
rcu_read_lock();
200-
err = ip_route_input_noref(skb, dst, src, tos, devin);
201-
if (!err) {
201+
reason = ip_route_input_noref(skb, dst, src, tos, devin);
202+
if (!reason) {
202203
skb_dst_force(skb);
203204
if (!skb_dst(skb))
204-
err = -EINVAL;
205+
reason = SKB_DROP_REASON_NOT_SPECIFIED;
205206
}
206207
rcu_read_unlock();
207208

208-
return err;
209+
return reason;
209210
}
210211

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

include/net/tcp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,11 @@ enum tcp_tw_status {
392392
enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
393393
struct sk_buff *skb,
394394
const struct tcphdr *th,
395-
u32 *tw_isn);
395+
u32 *tw_isn,
396+
enum skb_drop_reason *drop_reason);
396397
struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
397398
struct request_sock *req, bool fastopen,
398-
bool *lost_race);
399+
bool *lost_race, enum skb_drop_reason *drop_reason);
399400
enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
400401
struct sk_buff *skb);
401402
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 */

net/bridge/br_forward.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,
201201
enum br_pkt_type pkt_type, bool local_rcv, bool local_orig,
202202
u16 vid)
203203
{
204+
enum skb_drop_reason reason = SKB_DROP_REASON_NO_TX_TARGET;
204205
struct net_bridge_port *prev = NULL;
205206
struct net_bridge_port *p;
206207

@@ -234,8 +235,11 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,
234235
continue;
235236

236237
prev = maybe_deliver(prev, p, skb, local_orig);
237-
if (IS_ERR(prev))
238+
if (IS_ERR(prev)) {
239+
reason = PTR_ERR(prev) == -ENOMEM ? SKB_DROP_REASON_NOMEM :
240+
SKB_DROP_REASON_NOT_SPECIFIED;
238241
goto out;
242+
}
239243
}
240244

241245
if (!prev)
@@ -249,7 +253,7 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,
249253

250254
out:
251255
if (!local_rcv)
252-
kfree_skb(skb);
256+
kfree_skb_reason(skb, reason);
253257
}
254258

255259
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
@@ -289,6 +293,7 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
289293
struct net_bridge_mcast *brmctx,
290294
bool local_rcv, bool local_orig)
291295
{
296+
enum skb_drop_reason reason = SKB_DROP_REASON_NO_TX_TARGET;
292297
struct net_bridge_port *prev = NULL;
293298
struct net_bridge_port_group *p;
294299
bool allow_mode_include = true;
@@ -329,8 +334,11 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
329334
}
330335

331336
prev = maybe_deliver(prev, port, skb, local_orig);
332-
if (IS_ERR(prev))
337+
if (IS_ERR(prev)) {
338+
reason = PTR_ERR(prev) == -ENOMEM ? SKB_DROP_REASON_NOMEM :
339+
SKB_DROP_REASON_NOT_SPECIFIED;
333340
goto out;
341+
}
334342
delivered:
335343
if ((unsigned long)lport >= (unsigned long)port)
336344
p = rcu_dereference(p->next);
@@ -349,6 +357,6 @@ void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
349357

350358
out:
351359
if (!local_rcv)
352-
kfree_skb(skb);
360+
kfree_skb_reason(skb, reason);
353361
}
354362
#endif

0 commit comments

Comments
 (0)