1*5b8285ccSJohannes Berg /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*5b8285ccSJohannes Berg 3*5b8285ccSJohannes Berg #ifndef _LINUX_DROPREASON_CORE_H 4*5b8285ccSJohannes Berg #define _LINUX_DROPREASON_CORE_H 5*5b8285ccSJohannes Berg 6*5b8285ccSJohannes Berg #define DEFINE_DROP_REASON(FN, FNe) \ 7*5b8285ccSJohannes Berg FN(NOT_SPECIFIED) \ 8*5b8285ccSJohannes Berg FN(NO_SOCKET) \ 9*5b8285ccSJohannes Berg FN(PKT_TOO_SMALL) \ 10*5b8285ccSJohannes Berg FN(TCP_CSUM) \ 11*5b8285ccSJohannes Berg FN(SOCKET_FILTER) \ 12*5b8285ccSJohannes Berg FN(UDP_CSUM) \ 13*5b8285ccSJohannes Berg FN(NETFILTER_DROP) \ 14*5b8285ccSJohannes Berg FN(OTHERHOST) \ 15*5b8285ccSJohannes Berg FN(IP_CSUM) \ 16*5b8285ccSJohannes Berg FN(IP_INHDR) \ 17*5b8285ccSJohannes Berg FN(IP_RPFILTER) \ 18*5b8285ccSJohannes Berg FN(UNICAST_IN_L2_MULTICAST) \ 19*5b8285ccSJohannes Berg FN(XFRM_POLICY) \ 20*5b8285ccSJohannes Berg FN(IP_NOPROTO) \ 21*5b8285ccSJohannes Berg FN(SOCKET_RCVBUFF) \ 22*5b8285ccSJohannes Berg FN(PROTO_MEM) \ 23*5b8285ccSJohannes Berg FN(TCP_MD5NOTFOUND) \ 24*5b8285ccSJohannes Berg FN(TCP_MD5UNEXPECTED) \ 25*5b8285ccSJohannes Berg FN(TCP_MD5FAILURE) \ 26*5b8285ccSJohannes Berg FN(SOCKET_BACKLOG) \ 27*5b8285ccSJohannes Berg FN(TCP_FLAGS) \ 28*5b8285ccSJohannes Berg FN(TCP_ZEROWINDOW) \ 29*5b8285ccSJohannes Berg FN(TCP_OLD_DATA) \ 30*5b8285ccSJohannes Berg FN(TCP_OVERWINDOW) \ 31*5b8285ccSJohannes Berg FN(TCP_OFOMERGE) \ 32*5b8285ccSJohannes Berg FN(TCP_RFC7323_PAWS) \ 33*5b8285ccSJohannes Berg FN(TCP_INVALID_SEQUENCE) \ 34*5b8285ccSJohannes Berg FN(TCP_RESET) \ 35*5b8285ccSJohannes Berg FN(TCP_INVALID_SYN) \ 36*5b8285ccSJohannes Berg FN(TCP_CLOSE) \ 37*5b8285ccSJohannes Berg FN(TCP_FASTOPEN) \ 38*5b8285ccSJohannes Berg FN(TCP_OLD_ACK) \ 39*5b8285ccSJohannes Berg FN(TCP_TOO_OLD_ACK) \ 40*5b8285ccSJohannes Berg FN(TCP_ACK_UNSENT_DATA) \ 41*5b8285ccSJohannes Berg FN(TCP_OFO_QUEUE_PRUNE) \ 42*5b8285ccSJohannes Berg FN(TCP_OFO_DROP) \ 43*5b8285ccSJohannes Berg FN(IP_OUTNOROUTES) \ 44*5b8285ccSJohannes Berg FN(BPF_CGROUP_EGRESS) \ 45*5b8285ccSJohannes Berg FN(IPV6DISABLED) \ 46*5b8285ccSJohannes Berg FN(NEIGH_CREATEFAIL) \ 47*5b8285ccSJohannes Berg FN(NEIGH_FAILED) \ 48*5b8285ccSJohannes Berg FN(NEIGH_QUEUEFULL) \ 49*5b8285ccSJohannes Berg FN(NEIGH_DEAD) \ 50*5b8285ccSJohannes Berg FN(TC_EGRESS) \ 51*5b8285ccSJohannes Berg FN(QDISC_DROP) \ 52*5b8285ccSJohannes Berg FN(CPU_BACKLOG) \ 53*5b8285ccSJohannes Berg FN(XDP) \ 54*5b8285ccSJohannes Berg FN(TC_INGRESS) \ 55*5b8285ccSJohannes Berg FN(UNHANDLED_PROTO) \ 56*5b8285ccSJohannes Berg FN(SKB_CSUM) \ 57*5b8285ccSJohannes Berg FN(SKB_GSO_SEG) \ 58*5b8285ccSJohannes Berg FN(SKB_UCOPY_FAULT) \ 59*5b8285ccSJohannes Berg FN(DEV_HDR) \ 60*5b8285ccSJohannes Berg FN(DEV_READY) \ 61*5b8285ccSJohannes Berg FN(FULL_RING) \ 62*5b8285ccSJohannes Berg FN(NOMEM) \ 63*5b8285ccSJohannes Berg FN(HDR_TRUNC) \ 64*5b8285ccSJohannes Berg FN(TAP_FILTER) \ 65*5b8285ccSJohannes Berg FN(TAP_TXFILTER) \ 66*5b8285ccSJohannes Berg FN(ICMP_CSUM) \ 67*5b8285ccSJohannes Berg FN(INVALID_PROTO) \ 68*5b8285ccSJohannes Berg FN(IP_INADDRERRORS) \ 69*5b8285ccSJohannes Berg FN(IP_INNOROUTES) \ 70*5b8285ccSJohannes Berg FN(PKT_TOO_BIG) \ 71*5b8285ccSJohannes Berg FN(DUP_FRAG) \ 72*5b8285ccSJohannes Berg FN(FRAG_REASM_TIMEOUT) \ 73*5b8285ccSJohannes Berg FN(FRAG_TOO_FAR) \ 74*5b8285ccSJohannes Berg FN(TCP_MINTTL) \ 75*5b8285ccSJohannes Berg FN(IPV6_BAD_EXTHDR) \ 76*5b8285ccSJohannes Berg FN(IPV6_NDISC_FRAG) \ 77*5b8285ccSJohannes Berg FN(IPV6_NDISC_HOP_LIMIT) \ 78*5b8285ccSJohannes Berg FN(IPV6_NDISC_BAD_CODE) \ 79*5b8285ccSJohannes Berg FN(IPV6_NDISC_BAD_OPTIONS) \ 80*5b8285ccSJohannes Berg FN(IPV6_NDISC_NS_OTHERHOST) \ 81*5b8285ccSJohannes Berg FNe(MAX) 82*5b8285ccSJohannes Berg 83*5b8285ccSJohannes Berg /** 84*5b8285ccSJohannes Berg * enum skb_drop_reason - the reasons of skb drops 85*5b8285ccSJohannes Berg * 86*5b8285ccSJohannes Berg * The reason of skb drop, which is used in kfree_skb_reason(). 87*5b8285ccSJohannes Berg */ 88*5b8285ccSJohannes Berg enum skb_drop_reason { 89*5b8285ccSJohannes Berg /** 90*5b8285ccSJohannes Berg * @SKB_NOT_DROPPED_YET: skb is not dropped yet (used for no-drop case) 91*5b8285ccSJohannes Berg */ 92*5b8285ccSJohannes Berg SKB_NOT_DROPPED_YET = 0, 93*5b8285ccSJohannes Berg /** @SKB_CONSUMED: packet has been consumed */ 94*5b8285ccSJohannes Berg SKB_CONSUMED, 95*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NOT_SPECIFIED: drop reason is not specified */ 96*5b8285ccSJohannes Berg SKB_DROP_REASON_NOT_SPECIFIED, 97*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NO_SOCKET: socket not found */ 98*5b8285ccSJohannes Berg SKB_DROP_REASON_NO_SOCKET, 99*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */ 100*5b8285ccSJohannes Berg SKB_DROP_REASON_PKT_TOO_SMALL, 101*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */ 102*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_CSUM, 103*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_SOCKET_FILTER: dropped by socket filter */ 104*5b8285ccSJohannes Berg SKB_DROP_REASON_SOCKET_FILTER, 105*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_UDP_CSUM: UDP checksum error */ 106*5b8285ccSJohannes Berg SKB_DROP_REASON_UDP_CSUM, 107*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NETFILTER_DROP: dropped by netfilter */ 108*5b8285ccSJohannes Berg SKB_DROP_REASON_NETFILTER_DROP, 109*5b8285ccSJohannes Berg /** 110*5b8285ccSJohannes Berg * @SKB_DROP_REASON_OTHERHOST: packet don't belong to current host 111*5b8285ccSJohannes Berg * (interface is in promisc mode) 112*5b8285ccSJohannes Berg */ 113*5b8285ccSJohannes Berg SKB_DROP_REASON_OTHERHOST, 114*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IP_CSUM: IP checksum error */ 115*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_CSUM, 116*5b8285ccSJohannes Berg /** 117*5b8285ccSJohannes Berg * @SKB_DROP_REASON_IP_INHDR: there is something wrong with IP header (see 118*5b8285ccSJohannes Berg * IPSTATS_MIB_INHDRERRORS) 119*5b8285ccSJohannes Berg */ 120*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_INHDR, 121*5b8285ccSJohannes Berg /** 122*5b8285ccSJohannes Berg * @SKB_DROP_REASON_IP_RPFILTER: IP rpfilter validate failed. see the 123*5b8285ccSJohannes Berg * document for rp_filter in ip-sysctl.rst for more information 124*5b8285ccSJohannes Berg */ 125*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_RPFILTER, 126*5b8285ccSJohannes Berg /** 127*5b8285ccSJohannes Berg * @SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST: destination address of L2 is 128*5b8285ccSJohannes Berg * multicast, but L3 is unicast. 129*5b8285ccSJohannes Berg */ 130*5b8285ccSJohannes Berg SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST, 131*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_XFRM_POLICY: xfrm policy check failed */ 132*5b8285ccSJohannes Berg SKB_DROP_REASON_XFRM_POLICY, 133*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IP_NOPROTO: no support for IP protocol */ 134*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_NOPROTO, 135*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_SOCKET_RCVBUFF: socket receive buff is full */ 136*5b8285ccSJohannes Berg SKB_DROP_REASON_SOCKET_RCVBUFF, 137*5b8285ccSJohannes Berg /** 138*5b8285ccSJohannes Berg * @SKB_DROP_REASON_PROTO_MEM: proto memory limition, such as udp packet 139*5b8285ccSJohannes Berg * drop out of udp_memory_allocated. 140*5b8285ccSJohannes Berg */ 141*5b8285ccSJohannes Berg SKB_DROP_REASON_PROTO_MEM, 142*5b8285ccSJohannes Berg /** 143*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_MD5NOTFOUND: no MD5 hash and one expected, 144*5b8285ccSJohannes Berg * corresponding to LINUX_MIB_TCPMD5NOTFOUND 145*5b8285ccSJohannes Berg */ 146*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_MD5NOTFOUND, 147*5b8285ccSJohannes Berg /** 148*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_MD5UNEXPECTED: MD5 hash and we're not expecting 149*5b8285ccSJohannes Berg * one, corresponding to LINUX_MIB_TCPMD5UNEXPECTED 150*5b8285ccSJohannes Berg */ 151*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_MD5UNEXPECTED, 152*5b8285ccSJohannes Berg /** 153*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_MD5FAILURE: MD5 hash and its wrong, corresponding 154*5b8285ccSJohannes Berg * to LINUX_MIB_TCPMD5FAILURE 155*5b8285ccSJohannes Berg */ 156*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_MD5FAILURE, 157*5b8285ccSJohannes Berg /** 158*5b8285ccSJohannes Berg * @SKB_DROP_REASON_SOCKET_BACKLOG: failed to add skb to socket backlog ( 159*5b8285ccSJohannes Berg * see LINUX_MIB_TCPBACKLOGDROP) 160*5b8285ccSJohannes Berg */ 161*5b8285ccSJohannes Berg SKB_DROP_REASON_SOCKET_BACKLOG, 162*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_FLAGS: TCP flags invalid */ 163*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_FLAGS, 164*5b8285ccSJohannes Berg /** 165*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_ZEROWINDOW: TCP receive window size is zero, 166*5b8285ccSJohannes Berg * see LINUX_MIB_TCPZEROWINDOWDROP 167*5b8285ccSJohannes Berg */ 168*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_ZEROWINDOW, 169*5b8285ccSJohannes Berg /** 170*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_OLD_DATA: the TCP data reveived is already 171*5b8285ccSJohannes Berg * received before (spurious retrans may happened), see 172*5b8285ccSJohannes Berg * LINUX_MIB_DELAYEDACKLOST 173*5b8285ccSJohannes Berg */ 174*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OLD_DATA, 175*5b8285ccSJohannes Berg /** 176*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_OVERWINDOW: the TCP data is out of window, 177*5b8285ccSJohannes Berg * the seq of the first byte exceed the right edges of receive 178*5b8285ccSJohannes Berg * window 179*5b8285ccSJohannes Berg */ 180*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OVERWINDOW, 181*5b8285ccSJohannes Berg /** 182*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_OFOMERGE: the data of skb is already in the ofo 183*5b8285ccSJohannes Berg * queue, corresponding to LINUX_MIB_TCPOFOMERGE 184*5b8285ccSJohannes Berg */ 185*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OFOMERGE, 186*5b8285ccSJohannes Berg /** 187*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_RFC7323_PAWS: PAWS check, corresponding to 188*5b8285ccSJohannes Berg * LINUX_MIB_PAWSESTABREJECTED 189*5b8285ccSJohannes Berg */ 190*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_RFC7323_PAWS, 191*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_INVALID_SEQUENCE: Not acceptable SEQ field */ 192*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_INVALID_SEQUENCE, 193*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_RESET: Invalid RST packet */ 194*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_RESET, 195*5b8285ccSJohannes Berg /** 196*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_INVALID_SYN: Incoming packet has unexpected 197*5b8285ccSJohannes Berg * SYN flag 198*5b8285ccSJohannes Berg */ 199*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_INVALID_SYN, 200*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_CLOSE: TCP socket in CLOSE state */ 201*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_CLOSE, 202*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_FASTOPEN: dropped by FASTOPEN request socket */ 203*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_FASTOPEN, 204*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_OLD_ACK: TCP ACK is old, but in window */ 205*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OLD_ACK, 206*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_TOO_OLD_ACK: TCP ACK is too old */ 207*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_TOO_OLD_ACK, 208*5b8285ccSJohannes Berg /** 209*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_ACK_UNSENT_DATA: TCP ACK for data we haven't 210*5b8285ccSJohannes Berg * sent yet 211*5b8285ccSJohannes Berg */ 212*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_ACK_UNSENT_DATA, 213*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE: pruned from TCP OFO queue */ 214*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OFO_QUEUE_PRUNE, 215*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TCP_OFO_DROP: data already in receive queue */ 216*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_OFO_DROP, 217*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IP_OUTNOROUTES: route lookup failed */ 218*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_OUTNOROUTES, 219*5b8285ccSJohannes Berg /** 220*5b8285ccSJohannes Berg * @SKB_DROP_REASON_BPF_CGROUP_EGRESS: dropped by BPF_PROG_TYPE_CGROUP_SKB 221*5b8285ccSJohannes Berg * eBPF program 222*5b8285ccSJohannes Berg */ 223*5b8285ccSJohannes Berg SKB_DROP_REASON_BPF_CGROUP_EGRESS, 224*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6DISABLED: IPv6 is disabled on the device */ 225*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6DISABLED, 226*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NEIGH_CREATEFAIL: failed to create neigh entry */ 227*5b8285ccSJohannes Berg SKB_DROP_REASON_NEIGH_CREATEFAIL, 228*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NEIGH_FAILED: neigh entry in failed state */ 229*5b8285ccSJohannes Berg SKB_DROP_REASON_NEIGH_FAILED, 230*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NEIGH_QUEUEFULL: arp_queue for neigh entry is full */ 231*5b8285ccSJohannes Berg SKB_DROP_REASON_NEIGH_QUEUEFULL, 232*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */ 233*5b8285ccSJohannes Berg SKB_DROP_REASON_NEIGH_DEAD, 234*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */ 235*5b8285ccSJohannes Berg SKB_DROP_REASON_TC_EGRESS, 236*5b8285ccSJohannes Berg /** 237*5b8285ccSJohannes Berg * @SKB_DROP_REASON_QDISC_DROP: dropped by qdisc when packet outputting ( 238*5b8285ccSJohannes Berg * failed to enqueue to current qdisc) 239*5b8285ccSJohannes Berg */ 240*5b8285ccSJohannes Berg SKB_DROP_REASON_QDISC_DROP, 241*5b8285ccSJohannes Berg /** 242*5b8285ccSJohannes Berg * @SKB_DROP_REASON_CPU_BACKLOG: failed to enqueue the skb to the per CPU 243*5b8285ccSJohannes Berg * backlog queue. This can be caused by backlog queue full (see 244*5b8285ccSJohannes Berg * netdev_max_backlog in net.rst) or RPS flow limit 245*5b8285ccSJohannes Berg */ 246*5b8285ccSJohannes Berg SKB_DROP_REASON_CPU_BACKLOG, 247*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_XDP: dropped by XDP in input path */ 248*5b8285ccSJohannes Berg SKB_DROP_REASON_XDP, 249*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_TC_INGRESS: dropped in TC ingress HOOK */ 250*5b8285ccSJohannes Berg SKB_DROP_REASON_TC_INGRESS, 251*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_UNHANDLED_PROTO: protocol not implemented or not supported */ 252*5b8285ccSJohannes Berg SKB_DROP_REASON_UNHANDLED_PROTO, 253*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_SKB_CSUM: sk_buff checksum computation error */ 254*5b8285ccSJohannes Berg SKB_DROP_REASON_SKB_CSUM, 255*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_SKB_GSO_SEG: gso segmentation error */ 256*5b8285ccSJohannes Berg SKB_DROP_REASON_SKB_GSO_SEG, 257*5b8285ccSJohannes Berg /** 258*5b8285ccSJohannes Berg * @SKB_DROP_REASON_SKB_UCOPY_FAULT: failed to copy data from user space, 259*5b8285ccSJohannes Berg * e.g., via zerocopy_sg_from_iter() or skb_orphan_frags_rx() 260*5b8285ccSJohannes Berg */ 261*5b8285ccSJohannes Berg SKB_DROP_REASON_SKB_UCOPY_FAULT, 262*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_DEV_HDR: device driver specific header/metadata is invalid */ 263*5b8285ccSJohannes Berg SKB_DROP_REASON_DEV_HDR, 264*5b8285ccSJohannes Berg /** 265*5b8285ccSJohannes Berg * @SKB_DROP_REASON_DEV_READY: the device is not ready to xmit/recv due to 266*5b8285ccSJohannes Berg * any of its data structure that is not up/ready/initialized, 267*5b8285ccSJohannes Berg * e.g., the IFF_UP is not set, or driver specific tun->tfiles[txq] 268*5b8285ccSJohannes Berg * is not initialized 269*5b8285ccSJohannes Berg */ 270*5b8285ccSJohannes Berg SKB_DROP_REASON_DEV_READY, 271*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_FULL_RING: ring buffer is full */ 272*5b8285ccSJohannes Berg SKB_DROP_REASON_FULL_RING, 273*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_NOMEM: error due to OOM */ 274*5b8285ccSJohannes Berg SKB_DROP_REASON_NOMEM, 275*5b8285ccSJohannes Berg /** 276*5b8285ccSJohannes Berg * @SKB_DROP_REASON_HDR_TRUNC: failed to trunc/extract the header from 277*5b8285ccSJohannes Berg * networking data, e.g., failed to pull the protocol header from 278*5b8285ccSJohannes Berg * frags via pskb_may_pull() 279*5b8285ccSJohannes Berg */ 280*5b8285ccSJohannes Berg SKB_DROP_REASON_HDR_TRUNC, 281*5b8285ccSJohannes Berg /** 282*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TAP_FILTER: dropped by (ebpf) filter directly attached 283*5b8285ccSJohannes Berg * to tun/tap, e.g., via TUNSETFILTEREBPF 284*5b8285ccSJohannes Berg */ 285*5b8285ccSJohannes Berg SKB_DROP_REASON_TAP_FILTER, 286*5b8285ccSJohannes Berg /** 287*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TAP_TXFILTER: dropped by tx filter implemented at 288*5b8285ccSJohannes Berg * tun/tap, e.g., check_filter() 289*5b8285ccSJohannes Berg */ 290*5b8285ccSJohannes Berg SKB_DROP_REASON_TAP_TXFILTER, 291*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_ICMP_CSUM: ICMP checksum error */ 292*5b8285ccSJohannes Berg SKB_DROP_REASON_ICMP_CSUM, 293*5b8285ccSJohannes Berg /** 294*5b8285ccSJohannes Berg * @SKB_DROP_REASON_INVALID_PROTO: the packet doesn't follow RFC 2211, 295*5b8285ccSJohannes Berg * such as a broadcasts ICMP_TIMESTAMP 296*5b8285ccSJohannes Berg */ 297*5b8285ccSJohannes Berg SKB_DROP_REASON_INVALID_PROTO, 298*5b8285ccSJohannes Berg /** 299*5b8285ccSJohannes Berg * @SKB_DROP_REASON_IP_INADDRERRORS: host unreachable, corresponding to 300*5b8285ccSJohannes Berg * IPSTATS_MIB_INADDRERRORS 301*5b8285ccSJohannes Berg */ 302*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_INADDRERRORS, 303*5b8285ccSJohannes Berg /** 304*5b8285ccSJohannes Berg * @SKB_DROP_REASON_IP_INNOROUTES: network unreachable, corresponding to 305*5b8285ccSJohannes Berg * IPSTATS_MIB_INADDRERRORS 306*5b8285ccSJohannes Berg */ 307*5b8285ccSJohannes Berg SKB_DROP_REASON_IP_INNOROUTES, 308*5b8285ccSJohannes Berg /** 309*5b8285ccSJohannes Berg * @SKB_DROP_REASON_PKT_TOO_BIG: packet size is too big (maybe exceed the 310*5b8285ccSJohannes Berg * MTU) 311*5b8285ccSJohannes Berg */ 312*5b8285ccSJohannes Berg SKB_DROP_REASON_PKT_TOO_BIG, 313*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_DUP_FRAG: duplicate fragment */ 314*5b8285ccSJohannes Berg SKB_DROP_REASON_DUP_FRAG, 315*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_FRAG_REASM_TIMEOUT: fragment reassembly timeout */ 316*5b8285ccSJohannes Berg SKB_DROP_REASON_FRAG_REASM_TIMEOUT, 317*5b8285ccSJohannes Berg /** 318*5b8285ccSJohannes Berg * @SKB_DROP_REASON_FRAG_TOO_FAR: ipv4 fragment too far. 319*5b8285ccSJohannes Berg * (/proc/sys/net/ipv4/ipfrag_max_dist) 320*5b8285ccSJohannes Berg */ 321*5b8285ccSJohannes Berg SKB_DROP_REASON_FRAG_TOO_FAR, 322*5b8285ccSJohannes Berg /** 323*5b8285ccSJohannes Berg * @SKB_DROP_REASON_TCP_MINTTL: ipv4 ttl or ipv6 hoplimit below 324*5b8285ccSJohannes Berg * the threshold (IP_MINTTL or IPV6_MINHOPCOUNT). 325*5b8285ccSJohannes Berg */ 326*5b8285ccSJohannes Berg SKB_DROP_REASON_TCP_MINTTL, 327*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6_BAD_EXTHDR: Bad IPv6 extension header. */ 328*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_BAD_EXTHDR, 329*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6_NDISC_FRAG: invalid frag (suppress_frag_ndisc). */ 330*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_NDISC_FRAG, 331*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT: invalid hop limit. */ 332*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_NDISC_HOP_LIMIT, 333*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6_NDISC_BAD_CODE: invalid NDISC icmp6 code. */ 334*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_NDISC_BAD_CODE, 335*5b8285ccSJohannes Berg /** @SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS: invalid NDISC options. */ 336*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_NDISC_BAD_OPTIONS, 337*5b8285ccSJohannes Berg /** 338*5b8285ccSJohannes Berg * @SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST: NEIGHBOUR SOLICITATION 339*5b8285ccSJohannes Berg * for another host. 340*5b8285ccSJohannes Berg */ 341*5b8285ccSJohannes Berg SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST, 342*5b8285ccSJohannes Berg /** 343*5b8285ccSJohannes Berg * @SKB_DROP_REASON_MAX: the maximum of drop reason, which shouldn't be 344*5b8285ccSJohannes Berg * used as a real 'reason' 345*5b8285ccSJohannes Berg */ 346*5b8285ccSJohannes Berg SKB_DROP_REASON_MAX, 347*5b8285ccSJohannes Berg }; 348*5b8285ccSJohannes Berg 349*5b8285ccSJohannes Berg #define SKB_DR_INIT(name, reason) \ 350*5b8285ccSJohannes Berg enum skb_drop_reason name = SKB_DROP_REASON_##reason 351*5b8285ccSJohannes Berg #define SKB_DR(name) \ 352*5b8285ccSJohannes Berg SKB_DR_INIT(name, NOT_SPECIFIED) 353*5b8285ccSJohannes Berg #define SKB_DR_SET(name, reason) \ 354*5b8285ccSJohannes Berg (name = SKB_DROP_REASON_##reason) 355*5b8285ccSJohannes Berg #define SKB_DR_OR(name, reason) \ 356*5b8285ccSJohannes Berg do { \ 357*5b8285ccSJohannes Berg if (name == SKB_DROP_REASON_NOT_SPECIFIED || \ 358*5b8285ccSJohannes Berg name == SKB_NOT_DROPPED_YET) \ 359*5b8285ccSJohannes Berg SKB_DR_SET(name, reason); \ 360*5b8285ccSJohannes Berg } while (0) 361*5b8285ccSJohannes Berg 362*5b8285ccSJohannes Berg extern const char * const drop_reasons[]; 363*5b8285ccSJohannes Berg 364*5b8285ccSJohannes Berg #endif 365