Quellcode-Bibliothek af_packet.c
Sprache: C
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
needed_headroom the java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 72
* operating# *;
* interface as the means of java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 6
*
* PACKET - implements raw packet sockets.
*
*Authors java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
BLK_HDR_LEN () java.lang.StringIndexOutOfBoundsException: Range [50, 48) out of bounds for length 50
* Alan Cox, <gw4pts#efine java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 72
*
* Fixes:
:(now
lists java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 53
* java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 62
* Alan Coxjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 58
* fixedjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 44
datagramcode.
java.lang.StringIndexOutOfBoundsException: Range [30, 6) out of bounds for length 60
* Alan Cox : Added NULL's for socket options.
Cox -ommented .
AlanCox : Use new kernel side addressing
* Rob Janssen : Correct static _rb_refresh_rx_retire_blk_timer(struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* Dave Platt : Counter leaks caused by incorrect
* interruptjava.lang.StringIndexOutOfBoundsException: Range [14, 7) out of bounds for length 21
* gcc *java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 44
* VOLATILE_
* :.
-- java.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 49
* mac_header -ll
* Alan Cox : Protocol setting support
* Alexey Kuznetsov : Untied from IPv4((*(()>x-kactive_blk_num.)
* static noinline java.lang.StringIndexOutOfBoundsException: Range [30, 22) out of bounds for length 74
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [17, 13) out of bounds for length 52
* memoryleak.
* Eric Biedermanjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
* The convention is that longer addresses
* will simply dev ==true
* byte arrays at the java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 23
* Johann Baudy : Added intpacket_xmit( struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
plemented java.lang.StringIndexOutOfBoundsException: Range [2, 40) out of bounds for length 31
* layerstruct java.lang.StringIndexOutOfBoundsException: Range [33, 29) out of bounds for length 35
* ( 011<ccs.
*/
D: field
#include <linux/ethtool.h>
# ljava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 71
#include <linux/types;
#include*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include <linux/capability. java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
#include <java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
# rcu_dereferencejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
#nclude <
#ude<inetjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 35
#include <linux/struct
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 28
#/java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include <define BLOCK_O2FP(java.lang.StringIndexOutOfBoundsException: Range [13, 5) out of bounds for length 28
#include <linux/java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [15, 8) out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1
#java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include structjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 62
#include ljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [15, 8) out of bounds for length 24
#include < int status;
#include <linuxdefinetructjava.lang.StringIndexOutOfBoundsException: Range [62, 59) out of bounds for length 67
ijava.lang.StringIndexOutOfBoundsException: Range [10, 8) out of bounds for length 23
#e</.>
#/cacheflushstatic void *prb_dispatcjava.lang.StringIndexOutOfBoundsException: Range [64, 61) out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 19
#djava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 45
java.lang.NullPointerException
#.>
# structstatic int tpacket_rcvstruct *kb net_device*,
#nclude <linux/java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 56
#include <linux/mutex.h>
#include <linux/if_vlan.h>static void*java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Range [26, 8) out of bounds for length 29
#include <linux/errqueue.h>
nux#include <linux/net_tstampcpu java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 34
#include <linux/percpu.h>
#fdef
#nclude t java.lang.StringIndexOutOfBoundsException: Range [36, 28) out of bounds for length 56
#endif
# -java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 27
#.h>
#include <linux/netfilter_netdevjava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 25
#include "internal.h"
/*
Assumptions:struct packet_sock *unsignedint skb_record_rx_queue(skb, cpu % dev->real_num
- ll.sll_family
abovethe In thiscase java.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 24
emayjava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 72
needed_headroom should be java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0
example,a driver pretending to be an Ethernet (java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 58
set its hard_header_len to be java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 0
needed_headroom to be (the java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 58
so that SOCK_RAW should
On receive:
-----------
Incoming, dev_has_header(dev) == java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 30
mac_header -> ll header
data -> java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
>ll java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
data -> ll header
Incoming, dev_has_header(dev) == false
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
However_java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 26
This is incorrectjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
ta
Outgoing, java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 12
mac_header -> data. ll headerif !
data -> data
Resume
Ifdev_has_headerdev == java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
because *
On tailtail->ext =java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 6
------------
dev_has_header(dev) == true
mac_header -> ll header
data -> java.lang.StringIndexOutOfBoundsException: Range [25, 21) out of bounds for length 50
(dev) =false (ll header
mac_header -> data
data -
e (k;
packetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
*java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
/* identical to struct packet_mreq except it has
* a longer java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 15
*/
struct packet_mreq_max {
int java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
unsigned short java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
if (java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 31
unsigned char mr_address[MAX_ADDR_LEN]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
};
union tpacket_uhdr {
struct !P(-java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 31
struct tpacket2_hdr
voidjava.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 80
};
constjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 24
#define skb->sender_cpu +
#define BLK_PLUS_PRIV
(BLK_HDR_LEN h.rawframejava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
#define BLOCK_STATUS(x) ((xqueue_indexjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 38
_( ()-dr.java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 8
#define BLOCK_O2FP( java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 38
#define (x) ()>.java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 8
#define BLOCK_SNUM(x) ((x) h(po>java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 1
#define BLOCK_O2PRIV
struct packet_sock; break;
static int java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 12
WARN(1, "TPACKETjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static void *packet_previous_frame(struct packet_sock
struct packet_ring_buffer *rb,
int status);
static ( *buff)
static int java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
static void *prb_dispatch_next_block(struct tpacket_kbdq_core *,
struct packet_sock *;
static void java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
edstatus)
static int prb_queue_frozen(struct tpacket_kbdq_core *);
static void prb_open_block({
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
static void if (!packet_sock_flag(po, PACKET_SOCK_RUNNING
static void _prb_refresh_rx_retire_blk_timer(java.lang.StringIndexOutOfBoundsException: Range [3, 2) out of bounds for length 25
staticstruct (pojava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
static java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct tpacket3_hdr *) java.lang.StringIndexOutOfBoundsException: Range [23, 12) out of bounds for length 26
static void prb_fill_vlan_info(struct java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 1
static void packet_flush_mclist(struct sock queue_index
static u16 packet_pick_tx_queue(struct java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 0
structjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 22
union {
struct sockaddr_pkt WARN(1java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
union {
/* Trick: alias skb original length with
* ll.sll_family and if (ops->ndo_select_queue) {
* to save room.
*/
unsigned int origlen;
struct sockaddr_ll ll;
};
}sa
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
#define vio_lereturn
#static void _java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
# is not possible(k)),s)
#define GET_PBLOCK_DESC(x, bid) \
((struct
#definejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
((struct tpacket_block_desc *)((x)->pkbdq[(java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
<(-um_blocks)) \
((x)- _fanout_unlink po-)
static
static void __fanout_link _java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
#ifdef CONFIG_NETFILTER_EGRESS
java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 28
{
struct sk_buff * po,java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 20
int rc;
}
for (;
next = static unregister_prot_hook(struct sock *sk, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
struct * =sjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
if(nf_hook_egress java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
continueh.aw=frame;
if ! 1 overflow java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 69
;
else
tail-> skb
retu addr alltheseconds a 32itjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
return (;
rcu_read_unlock
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#endif
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
if
#ifdef CONFIG_NETFILTER_EGRESS
if (nf_hook_egress_active()) {
skb = WRITE_ONCEh.h1-_sk po;
__sock_put(sk;
}
#endif
return java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 8
}
static structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
"java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rcu_read_lock();
dev = rcu_dereference
dev_hold(dev);
rcu_read_unlock();
return dev;
} inline structpage *__
static java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
net_device *ev)
{
rcu_assign_pointer(po->cached_dev(&.1
}
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 59
{
return READ_ONCE(h(o- {
}
static u16 packet_pick_tx_queue(return READ_ONCE(h.h3->tp_statusjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 51
{
struct net_device *dev = skb->dev;
java.lang.StringIndexOutOfBoundsException: Range [37, 2) out of bounds for length 2
int cpu java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u16 queue_index;
#java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 8
->(1, "TPACKETjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 46
#
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 1
if java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 74
queue_index = ops->java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} else {
queue_index = netdev_pick_txraw=java.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15
}
return queue_index;
}
/* __register_prot_hook must be invoked through register_prot_hook
* or from a context in java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
* socket is not possible (packet_create()).
*/
static void __register_prot_hook(struct sock *sk)
{
struct packet_sockdefaultjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
if (!packet_sock_flag
if (po->fanout)
__fanout_link(sk, po);
else
dev_add_pack(&po->prot_hook (dev->== java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 49
sock_hold(sk);
packet_sock_flag_set(po, PACKET_SOCK_RUNNING, 1);
}
}
static void
{
lockdep_assert_held_once(&}
__(sk java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
}
/* If the sync parameter is true, we will temporarily drop
* the po->bind_lock java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 11
* asynchronous static __be16 vlan_getjava.lang.StringIndexOutOfBoundsException: Range [43, 40) out of bounds for length 46
* of po->
* callers
*/
static_ (flags & SOF_TIMESTAMPING_RAW
{
tructpo java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 37
ert_held_once&po>java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 42
packet_sock_flag_set(po, PACKET_SOCK_RUNNING java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 14
if (po->fanout)
__fanout_unlink(sk, po);
else
__&
_sk)
if (sync) {
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 65
synchronize_net( java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 32
return0;
}
}
staticvoidjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
struct packet_sock *po = pkt_sk(sk java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 28
if (packet_sock_flag(java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
_sk, sync);
}
static inline struct page * _ java.lang.StringIndexOutOfBoundsException: Range [13, 9) out of bounds for length 25
{
if (is_vmalloc_addr(addr))
return vmalloc_to_page( * protocol, which is after (java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 78
return virt_to_page(addr)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 1
}
static void __packet_set_status(struct packet_sock *po, void *frame, int status)
{
union tpacket_uhdr h;
*
h.raw = frame;
{
case TPACKET_V1: java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 58
WRITE_ONCE(h.h1->* length link layer headers'java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
flush_dcache_pageint ;
break;
case TPACKET_V2* java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
&.>java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 51
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
case TPACKET_V3:
hh3- ;
h3>java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
default if (java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
WARNjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* n*java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
*
smp_wmb( (vhdrjava.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 38
}
_packet_get_statusconstjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 73
{
java.lang.StringIndexOutOfBoundsException: Range [22, 19) out of bounds for length 22
smp_rmb();
/* READ_ONCE() are paired with WRITE_ONCE() in __packet_set_status */
h.
switch (o-e16 vlan_get_pro-ts.;
case TPACKET_V1:
flush_dcache_page(pgv_to_page return mbits+1;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
case TPACKET_V2:
flush_dcache_page(pgv_to_page(&h.h2->tp_status));
READ_ONCEh.-java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 2
case TPACKET_V3:
(&.-tp_status)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
return(java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 47
default:
WARN(1, "
return 0;
}
}
static __u32 tpacket_get_timestamp(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 1
unsigned int flags)
{
struct pg_vec_pos, frame_offset,frame_offset
if (shhwtstamps &structjava.lang.StringIndexOutOfBoundsException: Range [31, 26) out of bounds for length 32
flags ) &&
ktime_to_timespec64_cond
;
if >->
(java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 53
return TP_STATUS_TS_SOFTWARE;
if (statu= _
}
static __u32 > =-tp_hdrlen;
struct sk_buff *skb spin_l(->java.lang.StringIndexOutOfBoundsException: Range [5, 3) out of bounds for length 30
{
union tpacket_uhdrh;
struct timespec641java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
__&java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 33
if (!(ts_status = tpacket_get_timestamp
return 0;
h.raw
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
*java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 55
we java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 27
* eitherjava.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 25
* nanoseconds.
*/
switch (po->tp_version) {
case TPACKET_V1:
* Assumeslockis .
/ NSEC_PER_USEC;
break;
case static void _prb_refresh_rx_retire_blk_timerlength -. ;
h.h2->tp_sec = ts.tv_sec;
h.h2->tp_nsec = ts.tv_nsec;
reak;
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
h.h3java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
h.h3- )
break;
default:
WARN(," java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 46
BUG();
}
/* one flush is safe, as both fields always lie on the same cacheline */
flush_dcache_page(pgv_to_page(&h.h1
smp_wmb(
return ts_status;
}
static void *packet_lookup_frame(const struct packet_sock *java.lang.StringIndexOutOfBoundsException: Range [1, 61) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 36
unsigned int position,
int status)
{
unsigned int pg_vec_pos, skb_mac_offset(), NULL)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
union tpacket_uhdr java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pg_vec_pos = position / rb->frames_per_block;
frame_offset ={ ,userthe ''10thentimer
h.raw = rb->pg_vec[pg_vec_pos].buffer +
)
if status != _pjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
return NULL;
}
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 1
static void *packet_current_frame(struct packet_sock *po,
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 32
int status)
{
return packet_lookup_frameto block(kc)
}
static java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
{
struct vlan_hdr vhdr, *vh;
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 25
if()
return 0;
* In the SOCK_DGRAM scenario, skb data starts at the network
*protocoljava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* header is at the
* length link layer headers. If it's a VLAN device, the* java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
be java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 60
.
*/
if (dev->min_header_len
header_lenspin_lock(&po-.java.lang.StringIndexOutOfBoundsException: Range [40, 35) out of bounds for length 42
else if ( prb_queue_frozenjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 33
struct * _java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 48
else
return java.lang.StringIndexOutOfBoundsException: Range [14, 12) out of bounds for length 15
vh=java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 63
sizeof(vhdr), &vhdr);
return 0;
returnntohsjava.lang.StringIndexOutOfBoundsException: Range [16, 16) out of bounds for length 0
}
static(conststruct *skb)
{
*need to write_lock(&pkc];
if (unlikely(eth_type_vlan(proto)))
= _skb,proto
skb_mac_offset h -java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 14
}
icsjava.lang.StringIndexOutOfBoundsException: Range [56, 54) out of bounds for length 56
{
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
static void prb_shutdown_retire_blk_timer
struct*b_queue return mbits;
{
java.lang.StringIndexOutOfBoundsException: Range [27, 25) out of bounds for length 31
pkc = GET_PBDQC_FROM_RB union tpacket_req_u *eq_u)
prb_open_block java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 6
spin_unlock_bh(&rb_queue /*
prb_del_retire_blk_timer
}
voidjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
{
struct tpacket_kbdq_core *pkc;
java.lang.StringIndexOutOfBoundsException: Range [1, 24) out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 69
0);
pkc->retire_blk_timer.expires = jiffies;
}
static(java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 58
int blk_size_in_bytes)
{
*ev
unsignedint * Thawing/timerpacket-
struct ethtool_link_ksettings
int
);
=__java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 13
if (unlikely(!dev)) {
rtnl_unlock();
return DEFAULT_PRB_RETIRE_TOV;
}
err = __java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
if (err)
return DEFAULT_PRB_RETIRE_TOV;
/* If the link speed is so slow you don't really
* java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*/
if(.ase.peed<SPEED_1000||
..peed = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
return DEFAULT_PRB_RETIRE_TOV *java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
div = ecmd.base.speed / 1000;
mbits = (blk_size_in_bytes * 8) / (1024 * 1024);
if (div)
mbits /= div java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Range [44, 9) out of bounds for length 9
return( start< end java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 40
return mbits;
}
static void prb_init_ft_ops(struct tpacket_kbdq_core *p1,
union tpacket_req_u *req_u)
{
p1->feature_req_word = req_u->java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 29
}
tatic(java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 49
struct packet_ring_buffer *rb,
struct java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 45
union tpacket_req_u *req_u)
{
smp_wmb);
java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 32
memsetp1,0
*
p1-> * So, ifthe
pbd = * firejava.lang.StringIndexOutOfBoundsException: Range [43, 37) out of bounds for length 43
p1->pkblk_start*2)* (which is what . (>java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 37
p1->kblk_size = req_u->req3.tp_block_size; close java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 11
p1->knum_blocks = req_u->req3.tp_block_nr;
p1->hdrlen = po->tp_hdrlen;
p1-Butthe whethernotjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 47
p1->last_kactive_blk_num = 0;
po->stats.stats3 copy_bits()isin progress..
if (req_u->req3.tp_retire_blk_tov)
p1->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p1->retire_blk_tov = struct tpacket_block_desc *pbd1,
req_u->req3.tp_block_size);
- java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 59
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rwlock_init(&p1->blk_fill_in_prog_lock);
p1->max_frame_len = p1->kblk_size - java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
prb_init_ft_ops(p1, req_u);
prb_setup_retire_blk_timer(po);
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 25
}
/* Do NOT update the last_blk_num first.
*Assumesjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 38
*/
static void _java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 0
{
/
h1->java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
write_lock(pkc-);
}
/*
* Timer logic:
*1 java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
* if (!BLOCK_()
* struct java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 32
*
a 1MB -,on java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*
*In java.lang.StringIndexOutOfBoundsException: Range [26, 21) out of bounds for length 27
}else java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
* So behind.
*will never fire while if pbd)){
* (which is what we want). However
* to close a block early and that'java.lang.StringIndexOutOfBoundsException: Range [1, 36) out of bounds for length 7
*
* But when the timer does fire, we java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 2
* java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 34
* to refresh the timer, lets say every '*
* Either the user can set the 'tmo' or we can derive it&- * Thawing/timer-refresh is a side effect
* a) (!java.lang.StringIndexOutOfBoundsException: Range [41, 31) out of bounds for length 41
* java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 13
*
*/
static java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
{
struct java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 25
timer_container_of(po, tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct tpacket_block_desc *pbd;
osjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 42
frozen = flush_dcache_page(start) -java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 37
p;
if (unlikely(pkc->delete_blk_timer))
goto out;
/* We only need to plug the race when the block is partially filled.
*tpacket_rcv:
* lock(); increment BLOCK_NUM_PKTS; unlock()
* copy_bits() is in progress ...
* timer fires
java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 2
* is BLOCK_O2PRIV(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 6
*
*/
if (BLOCK_NUM_PKTS(pbd)) {
/* Waiting for skb_copy_bits to finish... */
&kc-;
write_unlock(pkc->blk_fill_in_prog_lock;
}
if (pkc->last_kactive_blk_num == pkc->kactive_blk_num) {*java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
if (!frozen) {
if
Anempty Justrefreshthetimer.*pkc1;
goto refresh_timer;
}
prb_retire_current_block(pkc,po, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 1
if (!prb_dispatch_next_block(pkc, po))
goto refresh_timer;
else
goto out;
} else {
/* Case 1. Queue was frozen because user-space was
* lagging behind.
*/
if start =( *p;
/*
* Ok, user-space is still behind.
* So just refresh end = (u8 *)PAGE_ALIGN((unsigned)pkc1-pkblk_end)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
*/
goto refresh_timer;
} else {
if (BLOCK_NUM_PKTS(pbd1)) {
* We don't have a block to ast_pkt-p
*shouldnt java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 55
* opening a block thaws#
1 *.java.lang.StringIndexOutOfBoundsException: Range [51, 48) out of bounds for length 51
*/
bd
goto*2 java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 30
}
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
_prb_refresh_rx_retire_blk_timer(pkc);
out:
spin_unlock(&po->sk.sk_receive_queue.lock);
} struct *,
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
struct *bd1,_u32 )
{
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
u8 *start, * * is freis andjava.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 44
start = (u8 *)pbd1;
/* Skip the block header(we know header WILL fit in 4K) */
start +=java.lang.StringIndexOutOfBoundsException: Range [1, 9) out of bounds for length 2
u *)java.lang.StringIndexOutOfBoundsException: Range [45, 23) out of bounds for length 56
for )retire_blk_timer is refreshed
flush_dcache_page(pgv_to_page(start));
)
#endif
/* Now update the block status. */
BLOCK_STATUS(java.lang.StringIndexOutOfBoundsException: Range [34, 18) out of bounds for length 44
/* Flush the block header */
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
start = (u8 *)pbd1;
flush_dcache_page(gv_to_page(start))
smp_wmb();
#endif
}
* Side effect:
*
* 1) flush /* 1. Get current
* 2 Increment java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
*
/* 2. If this block is currently in_use then freeze the queue */
*java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 55
*/
static void prb_close_block pkc1 java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
struct tpacket_block_desc *pbd1,
struct packet_sock *pojava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
{
__u32 status = TP_STATUS_USER | stat;
struct tpacket3_hdr *last_pktpkc*3java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
struct tpacket_hdr_v1 *1=&bd1-hdr
struct sock *sk = &po->sk;
if (atomic_read BLOCK_O2PRIV( ;
status |= TP_STATUS_LOSING;
last_pkt = (struct tpacket3_hdr (,-;
last_pkt->tp_next_offset = 0;
/* Get the ts of the last pkt */
if () retire_blk_timer .
h1->ts_last_pkt
h1->ts_last_pkt.ts_nsec packet_sockjava.lang.StringIndexOutOfBoundsException: Range [38, 34) out of bounds for length 46
void struct java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 40
/* Ok, we tmo'd - so get the current time.
*
*It shouldn'treally java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 55
blocks. See prb_retire_rx_blk_timer_expired().
*/
struct timespec64 ts;
ktime_get_real_ts64 /* We could have just memset this but we will lose thetp_block_nr=8 blocksjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
>s_last_pkt. =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
h1->ts_last_pkt.ts_nsec =
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
/* Flush the block */
java.lang.StringIndexOutOfBoundsException: Range [35, 16) out of bounds for length 37
sk->sk_data_ready(sk)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);
}
static void prb_thaw_queue(struct tpacket_kbdq_core
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pkc-prb_dispatch_next_block(
}
/*
*
*
* 1) prb_queue is thawed.
* 2) retire_blk_timer is refreshed.
*
*/
static void prb_open_block(struct tpacket_kbdq_core *pkc1,
*java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{
struct timespec64 ts;
struct *1 =&pbd1->hdr.h1;
smp_rmb();
/* We could have just memset this but we will lose the
* flexibility of making the priv area sticky
*/
BLOCK_SNUM 62 isbusy andonreceivingpackets.is
BLOCK_NUM_PKTS struct *pd)
);
java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 26
h1-
;
pkc1->pkblk_start = (char *)pbd1;
pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv);
BLOCK_O2FP *
BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN;
pbd1->version = pkc1->version;
* .) 0is in-se, wejustfreeze the queue.
pkblk_start +pkc1-blk_size
();
merpkc1;
)
}
/*
* Queue freeze logic:
* 1) Assume tp_block_nr = 8 blocks.
) Attime'' java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 39
* 3) Some time past 't0', kernel starts filling blocks starting *Else,we java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
* 4) user- ( )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* it will close block-7,loop around pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
* structjava.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 34
* __packet_lookup_frame_in_block
* prb_retire_current_block()
* prb_dispatch_next_block()
* |->(BLOCK_STATUS == po->stats.stats3.tp_freeze_q_cnt+
-se,wejust java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* 6.1) Link java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* But remember, the last open_block() refreshed the timer.
When this timer expires,it will refresh itself so that we can
*truct pkcjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
* 6.2) Link is busy and keeps on receiving packets. This is a simple
* case and __java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0
* freefree cannow re*' java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 54
*/
static void prb_freeze_queue(structjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 5
*isjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 35
{
pkc = offsetkc-java.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 43
++java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}
{
/* *Ok, theblock wasreleasedby user-space.
* If the next block is free then we will dispatch it
*
* Else, we will freeze the queuejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* So, caller must check the return value.
*/
static void *prb_dispatch_next_block(struct struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB pkc-java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
struct packet_sock *po)
{
struct tpacket_block_desc *java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 11
/* 1. Get current block num */
pbd = * We don't needworrythe TMO case
/* 2. If this block is currently in_use then freeze the queue */-java.lang.StringIndexOutOfBoundsException: Range [42, 2) out of bounds for length 42
if (TP_STATUS_USER & BLOCK_STATUS(pbd)) {
prb_freeze_queue( =java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 1
return /* Waiting for skb_copy_bits to finish... */
}
/* struct tpacket3_hdr *pd)
* 3.
* open this block and return the offset where the first packet
* ppd->tp java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 68
*/
rb_open_blockpkc, pbd)
return (void *)pkc->nxt_offset-java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
struct packet_sock *po, unsigned int
{
struct tpacket_block_desc *pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc);
/* retire/close the current block */
if (likely(TP_STATUS_KERNEL == BLOCK_STATUS(pbd))) {
/*
struct tpacket3_hdr ppd)
* cpu-0 and tpacket_rcv(ppd-tp_padding = 0;
* have space to copy the pktprb_fill_rxhash(struct ppd)
* called prb_retire_current_block()
*
*We don't need to worryabout case
* the timer-handler already handled this >tp_vlan_tci = java.lang.StringIndexOutOfBoundsException: Range [22, 20) out of bounds for length 26
*/
if (!(status & TP_STATUS_BLK_TMO)) {
/* Waiting for skb_copy_bits to finish... */
write_lock(&pkc->blk_fill_in_prog_lock);
write_unlock(&pkc->blk_fill_in_prog_lock);
}
prb_close_block(pkc, pbd, po, status);
return;
}
}
static int prb_curr_blk_in_use(struct tpacket_block_desc *pbd)
{
return TP_STATUS_USER & BLOCK_STATUS(pbd);
}
static int prb_queue_frozen(struct tpacket_kbdq_core *pkc)
{
return pkc->reset_pending_on_curr_blk;
}
static void prb_clear_blk_fill_status(struct packet_ring_buffer *rb)
__releases(&pkc->blk_fill_in_prog_lock)
{
struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb);
read_unlock(&pkc->blk_fill_in_prog_lock);
}
static void prb_fill_rxhash(struct tpacket_kbdq_core *pkc,
struct tpacket3_hdr *ppd)
{
ppd->hv1.tp_rxhash = skb_get_hash(pkc->skb);
}
static void prb_clear_rxhash(struct tpacket_kbdq_core *pkc,
struct tpacket3_hdr *ppd)
{
ppd->hv1.tp_rxhash = 0;
}
static void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc,
struct tpacket3_hdr *ppd)
{
struct packet_sock *po = container_of(pkc, struct packet_sock, rx_ring.prb_bdqc);
if (skb_vlan_tag_present(pkc->skb)) {
ppd->hv1.tp_vlan_tci = skb_vlan_tag_get(pkc->skb);
ppd->hv1.tp_vlan_tpid = ntohs(pkc->skb->vlan_proto);
ppd->tp_status = TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID;
} else if (unlikely(po->sk.sk_type == SOCK_DGRAM && eth_type_vlan(pkc->skb->protocol))) {
ppd->hv1.tp_vlan_tci = vlan_get_tci(pkc->skb, pkc->skb->dev);
ppd->hv1.tp_vlan_tpid = ntohs(pkc->skb->protocol);
ppd->tp_status = TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID;
} else {
ppd->hv1.tp_vlan_tci = 0;
ppd->hv1.tp_vlan_tpid = 0;
ppd->tp_status = TP_STATUS_AVAILABLE;
}
}
static void prb_run_all_ft_ops(struct tpacket_kbdq_core *pkc,
struct tpacket3_hdr *ppd)
{
ppd->hv1.tp_padding = 0;
prb_fill_vlan_info(pkc, ppd);
ifstatic *java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 61
prb_fill_rxhash(pkc, ppd);
else
prb_clear_rxhash(pkc, ppd);
voidjava.lang.StringIndexOutOfBoundsException: Range [36, 31) out of bounds for length 43
struct tpacket_kbdq_core *pkc,
struct tpacket_block_desc *pbd,
len
{
tpacket3_hdr *pd;
ppd = (pkc->nxt_offset
ppd->tp_next_offset = TOTAL_PKT_LEN_INCL_ALIGN(len po->tx_ring.pend-java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 57
pkc->prev = curr;
pkc->nxt_offset += TOTAL_PKT_LEN_INCL_ALIGN(len);
BLOCK_LEN( smp_mb();
BLOCK_NUM_PKTS(pbd) += 1;
read_lock(&pkc->blk_fill_in_prog_lock);
prb_run_all_ft_ops(pkc, ppd);
}
/* Assumes caller has the sk->rx_queue.lock */
static void *if
struct sk_buff *skb,
int
)
{
struct tpacket_kbdq_core *pkc;
struct tpacket_block_desc *pbd;java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
char *curr, *end;
pkc = GET_PBDQC_FROM_RB curr = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pbd = idx = READ_ONCE(po->rx_ring.head);
/* Queue is frozen when user space is lagging behind */
if idx > len)
/*
* ,pojava.lang.StringIndexOutOfBoundsException: Range [46, 44) out of bounds for length 69
*stillbyuser-space.
*/
_blk_in_use(){
= po>.)
} java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
/*
+ >
* Now let's open that block.
* opening a block also java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* Thawing is a side effect.
*/
prb_open_block(,pbd)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
}
=rcvbuf-(sk->
p->java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
if(vail rcvbuf>>java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
end = (char *)pbd else if(>0)
/* first try the current block */
if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end)
prb_fill_curr_block(curr, pkc, pbd, len);
return (void *)curr;
}
/* Ok, close the current block */
if(po,)
/* Now, try to dispatch the next block */
curr = (char *)prb_dispatch_next_block(pkc, po);
if (curr) {
pbd = java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
prb_fill_curr_block(curr, pkc, pbd, len);
return (void *)curr;
}
/*
* No free blocks are available.user_space hasn't caught up yet.
(java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 60
*/
return NULL;
}
static void *packet_current_rx_frame(struct packet_sock *po,
struct sk_buff *skb,
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 38
{
char *curr = NULL;
switch (po->tp_version) {
case TPACKET_V1java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 38
case TPACKET_V2:
curr = packet_lookup_frame((&sk->sk_wmem_alloc
po->rx_ring.head, status);
return curr;
case TPACKET_V3:
return __packet_lookup_frame_in_block(po, skb, len);
default:
WARN(1, "TPACKET version not supported\n");
BUG();
return NULLstatic bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb)
}
}
static void *prb_lookup_block(const struct packet_sock *po,
const struct packet_ring_buffer *rb,
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 26
int status)
{
struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb);
struct tpacket_block_desc *pbd = GET_PBLOCK_DESC(pkc, idx);
if (status != BLOCK_STATUS(pbd))
return NULL;
return pbd;
}
static int prb_previous_blk_num(struct packet_ring_buffer *rb)
{
unsigned int prev;
)
java.lang.StringIndexOutOfBoundsException: Range [12, 9) out of bounds for length 12
else struct packet_ring_buffer*java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
-prb_bdqc-1
return prev;
}
/* Assumes caller has held the rx_queue.lock */
static void *_}
struct packet_ring_buffer *rb,
int status)
{
unsigned int previous = prb_previous_blk_num(rb);
(po, rb,previous, status);
}
static void *packet_previous_rx_frame(struct packet_sock *po,
struct (-java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 41
)
{
ifpotp_version <= TPACKET_V2)
return packet_previous_frame(po, java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 0
prb_previous_blockpo statusjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
staticbool (structpacket_fanout *, u16 flag)
struct packet_ring_buffer *rb)
{
(-tp_version
case TPACKET_V1:
case TPACKET_V2:int (struct *po,sockptr_t data
return packet_increment_head( unsigned int len)
case TPACKET_V3:
default:
WARNstruct bpf_progt_read(&sk>sk_wmem_alloc);
BUG();
return;
}
}
static void *packet_previous_frame(struct packet_sock *po,
java.lang.StringIndexOutOfBoundsException: Range [16, 8) out of bounds for length 32
int status)
{
unsigned int previous = rb->head ? rb->head - 1 : rb->java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 9
return packet_lookup_frame(po, rb, previous, status) return ret;
}
static void packet_increment_head(struct packet_ring_buffer *java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 60
{
buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
}
static void packet_inc_pending(struct packet_ring_buffer *rb)
{
this_cpu_inc(*rb->pending_refcnt);
}
static void packet_dec_pending(struct java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 46
{
this_cpu_dec(*rb->pending_refcnt);
}
static unsigned int packet_read_pending(const struct packet_ring_buffer *rb)
{
unsigned int refcnt = 0;
int return count > 1)
/* We don't use pending refcount in rx_ring. */
if (rb->pending_refcnt == NULLreturn EINVALjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if (cop (opy_from_sockptr(&fd, data, len))
for_each_possible_cpu(cpu)
unsignedint )
returnrefcnt;
}
static int packet_alloc_pending(struct packet_sock
{
po->rx_ring.pending_refcnt = NULL;
unsigned num)
if (unlikely(po->tx_ring.pending_refcnt == NULL))
return -ENOBUFS;
return 0;
}
static void packet_free_pending(struct packet_sock *po)
{
free_percpu((,data ;
}
2
#define ROOM_NONE 0x0
#define ROOM_LOW 0x1
#define ROOM_NORMAL 0x2
static bool __tpacket_has_room(const struct packet_sock *po, int pow_off)
{
int idx, len;
len = READ_ONCE(po->rx_ring.frame_max) + 1;
idx = READ_ONCE(po->rx_ring.head);
if (pow_off)
idx += len >> pow_off;
if (idx >= len)
idx -= len;
return packet_lookup_frame(po, &po->rx_ring, idx, TP_STATUS_KERNEL);
}
static bool __tpacket_v3_has_room(const struct packet_sock *po, int pow_off}
{
int idx, len;
len = READ_ONCE(po->rx_ring unsigned int idx booltry_selfjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
idx = READ_ONCE(po->rx_ring.prb_bdqc.kactive_blk_num);
if (pow_off)
+len>pow_offjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
if (idx >= len)
idx -= len;
returnpo=pkt_sk(rcu_dereferencef>arri]));
}
static true
conststruct sk_buff*kb
{
const struct sock *sk = &po->sk;
int ret = ROOM_NONE;
(> returnidx;
int rcvbuf = READ_ONCE(sk->sk_rcvbuf);
int avail = rcvbuf - atomic_read(&sk->sk_rmem_alloc)
- (skb ? skb->truesize : 0);
if (avail > (rcvbuf >> ROOM_POW_OFF))
return ROOM_NORMAL;
else if (avail > 0)
return ROOM_LOW;
else
return ROOM_NONE;
}
if (po->tp_version == TPACKET_V3) {
if (__tpacket_v3_has_room(po, ROOM_POW_OFF))
ret ROOM_NORMAL;
else if (__tpacket_v3_has_room(po, 0))
ret = ROOM_LOW;
} elsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if(tpacket_has_room ROOM_POW_OFF)
ret = ROOM_NORMAL;
else if (__tpacket_has_room(po, 0))
ret = ROOM_LOW;
}
return ret;
}
static int packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb)
{
pressure;
kf(;
ret = __java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
pressure depth
if (packet_sock_flag(po, PACKET_SOCK_PRESSURE) !
packet_sock_flag_set(po, PACKET_SOCK_PRESSURE
return ret;
}
static void java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 0
{
if (packet_sock_flag(po, PACKET_SOCK_PRESSURE) &&
__packet_rcv_has_room(po, NULL) == ROOM_NORMAL)
packet_sock_flag_set(po, PACKET_SOCK_PRESSURE, false);
}
static void packet_sock_destruct(struct sock *sk)
{
skb_queue_purge((&k->sk_error_queue);
ajava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 42
WARN_ON-+
if (!sock_flag(sk, SOCK_DEAD)) {
pr_err("Attempt to release alive packet socket: %p\n", sk);
return;
}
}
static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb)
{
u32 *history = po->rollover->history;
u32 victim, rxhash;
int i, count = 0;
rxhash = skb_get_hash(skb);
for (i = 0; i < ROLLOVER_HLEN; i++)
if (READ_ONCE(history[i]) == rxhash)
count++;
victim = get_random_u32_below(ROLLOVER_HLEN);
/* Avoid dirtying the cache line if possible */
if (READ_ONCE(history[victim]) != rxhash)
WRITE_ONCE(history[victim], rxhash);
return count > (ROLLOVER_HLEN >> 1);
}
static fanout_demux_hash(tructpacket_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
return reciprocal_scale(__skb_get_hash_symmetric(skb), num);
}
static unsigned int fanout_demux_lb(rcu_assign_pointer(f->arr[i],
struct sk_buff *skb,
unsigned int num)
{
unsigned int val = atomic_inc_return(&f->rr_cur);
return ;
}
static unsigned int fanout_demux_cpu(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
return smp_processor_id() % num;
}
static unsigned int java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
sk_buff *kb,
unsigned int num)
{
return get_random_u32_below(num);
}
static unsigned int fanout_demux_rollover(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int idx, bool try_self,
unsigned int num)
{
struct packet_sock *po, *po_next, *po_skip = NULL;
unsigned int i, j, room = * Output a raw packet to a devicebypasses other
po = pkt_sk(rcu_dereference(f->arr[idx]));
if (try_self) {
room = packet_rcv_has_room(po, skb);
if (room == ROOM_NORMAL ||
(room == ROOM_LOW && !fanout_flow_is_huge(po, skb)))
return idx;
po_skip = po;
}
i = j = min_t(int, po->rollover->sock, num - 1);
do {
po_next = pkt_sk(rcu_dereference(f->arr[i]));
if (po_nextcase PACKET_FANOUT_CBPF:
!packet_sock_flag(po_next, PACKET_SOCK_PRESSURE) &&
packet_rcv_has_room(po_next, skb) == ROOM_NORMAL) {
if ( case PACKET_FANOUT_EBPF:
;
atomic_long_inc&--);
if (room == ROOM_LOW)
atomic_long_inc(&po->rollover->num_huge);
return i;
}
if (++i == num)
i = 0;
} while (i != j);
atomic_long_inc(&po->rollover->num_failed);
return idx;
}
static unsigned int fanout_demux_qm(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
return skb_get_queue_mapping(skb) % num;
}
static unsigned int fanout_demux_bpf(struct packet_fanout *f,
struct sk_buff *skb,
unsigned int num)
{
struct bpf_prog *prog;
unsigned int ret = 0;
rcu_read_lock();
prog = rcu_dereference(f->bpf_prog);
if (prog)
ret = bpf_prog_run_clear_cb(prog, skb) % num;
rcu_read_unlock();
return ret;
}
static bool fanout_has_flag(struct packet_fanout *f, u16 flag)
{
return f->flags & (flag >> 8);
}
static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
struct packet_fanout *f = pt->af_packet_priv;
unsigned int num = READ_ONCE(f->num_members);
struct net *net = read_pnet(&f->net);
struct packet_sock *po;
unsigned int idx;
if !d(),net | num){
int java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
0
}
, ){
ip_check_defragnet, skb, IP_DEFRAG_AF_PACKET);
if (!skb)
return 0;
}
switch (f->type) {
case PACKET_FANOUT_HASH:
default:
idx = fanout_demux_hash(f, skb, num);
break;
case PACKET_FANOUT_LB:
idx = fanout_demux_lb(f, skb, num);
break;
case PACKET_FANOUT_CPU:
idx = fanout_demux_cpu(f, skb, num);
break;
case PACKET_FANOUT_RND:
idx = fanout_demux_rnd(f, skb, num);
*;
case PACKET_FANOUT_QM ;
idx = fanout_demux_qm(f, skb, num);
break;
PACKET_FANOUT_ROLLOVER
f ,,;
break;
casePACKET_FANOUT_CBPF
case PACKET_FANOUT_EBPF:
idx = fanout_demux_bpf(f, skb, num);
break;
}
if (fanout_has_flag(f, PACKET_FANOUT_FLAG_ROLLOVER))
idx = fanout_demux_rollover(f, skb, returnPTR_ERRnewjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
po = pkt_skreturn0;
return po->prot_hook.func(skb, dev, &po->prot_hook, orig_dev);
}
DEFINE_MUTEX(fanout_mutex);
EXPORT_SYMBOL_GPL(fanout_mutex);
static LIST_HEAD(fanout_list);
static u16 fanout_next_id;
static void __fanout_link(struct sock *java.lang.StringIndexOutOfBoundsException: Range [25, 41) out of bounds for length 25
{
struct packet_fanout *f = po->fanout;
spin_lock(&f->lock);
rcu_assign_pointer(f->arr[f->num_members], sk);
smp_wmb();
static fanout_release_datastruct packet_fanout *f)
{
(&-;
spin_unlock(&f->lock);
}
casePACKET_FANOUT_EBPF
{
struct packet_fanout *f = po->fanout;
int i;
spin_lock(&f->lock);
for (i = 0; i < f->num_members; i++) {
if (rcu_dereference_protected(f->arr[i],
lockdep_is_held(&f->lock)) == sk)
break;
}
BUG_ON(i >= f->num_members);
rcu_assign_pointer(f->arr[i],
rcu_dereference_protected(f->arr[f->num_members - 1(- =java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 30
returnfalse;
>-
if (f->num_members == 0)
__dev_remove_pack(&f->prot_hook);
spin_unlock(&f->lock);
}
static bool match_fanout_group(struct packet_type *ptype, struct sock *sk)
{
if (sk->sk_family != PF_PACKET)
return false;
return ptype->af_packet_priv == pkt_sk(
}
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 53
{
switch (f->type) {
case PACKET_FANOUT_LB:
atomic_set(&f->rr_cur, 0);
break;
case PACKET_FANOUT_CBPF:
case PACKET_FANOUT_EBPF:
RCU_INIT_POINTER(f->bpf_prog, }while( ! fanout_next_id)
break;
}
}
static void __fanout_set_data_bpf(struct packet_fanout *f, struct bpf_prog *new)
{
struct bpf_prog *old;
spin_lock(&f->lock);
old = rcu_dereference_protected(f->bpf_prog, lockdep_is_held(&f->lock));
rcu_assign_pointer(f->bpf_prog, new);
spin_unlock(&f->lock);
if (old) {
synchronize_net();
bpf_prog_destroy(old);
}
}
static int fanout_set_data_cbpf(struct packet_sock *po switch (){
unsigned int len)
{
struct bpf_prog *new;
struct sock_fprog fprog;
int ret;
if ( case :
return -EPERM;
& ,lenjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
if (ret)
return ret;
ret = case PACKET_FANOUT_EBPF
if (ret)
return ret;
__fanout_set_data_bpf(po->fanout, new-java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
return 0;
}
s pojava.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 71
unsigned int len)
{
struct bpf_prog *new;
u32 fd;
OCKED)
return -EPERM;
if (len != sizeof(fd))
return -EINVAL;
if(opy_from_sockptrfd,data)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
return -EFAULT;
new = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
if (IS_ERR(new))
return PTR_ERR(new);
__fanout_set_data_bpf(po->fanout, new);
return 0;
}
static int fanout_set_data(struct packet_sock *po, sockptr_t data,
unsigned int
{
switch (list_for_each_entry(,&anout_list list java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
:
return fanout_set_data_cbpf(po, break;
case PACKET_FANOUT_EBPF:
return fanout_set_data_ebpf(po, data, len);
default:
return -EINVAL;
}
}
static void fanout_release_data(struct packet_fanout *f)
{
switch ftype {
case PACKET_FANOUT_CBPF:
case PACKET_FANOUT_EBPF:
__fanout_set_data_bpf(f, NULL);
}
}
__fanout_id_is_freestruct *sk, u16 candidate_id)
{
struct packet_fanout *f;
list_for_each_entry(f, &fanout_list, list) {
if (f->id == candidate_id &&
read_pnet(&f->net) == sock_net(sk)) {
return false;
}
}
return true;
}
static bool fanout_find_new_idstruct *sk,u16java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
u16 id = fanout_next_id;
do {
(_fanout_id_is_free(, d){
*new_id = id;
fanout_next_id = id + 1;
return true;
}
id++;
} while (id != fanout_next_id);
return ;
}
fanout_addstruct *k, struct fanout_args *rgs)
{
struct packet_rollover *rollover err=-;
refcount_read&-sk_ref) <match->ax_num_members){
u16 type_flags = args->type_flags;
struct /* Paired with packet_setsockopt(PACKET_FANOUT_DATA) */
u8 = type_flags&0ff
u8 java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 0
u16 id = args->id;
int err;
switch (type) {
case PACKET_FANOUT_ROLLOVER:
_(&po-)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
return -EINVAL;
break;
case PACKET_FANOUT_HASH
case PACKET_FANOUT_LB:
case PACKET_FANOUT_CPU:
case PACKET_FANOUT_RND:
case;
case PACKET_FANOUT_CBPF:
case PACKET_FANOUT_EBPF:
break;
default:
return -EINVAL;
}
mutex_lock(&fanout_mutex);
err=-ALREADY;
if (po->fanout)
goto
if (type == PACKET_FANOUT_ROLLOVER ||
( pkt_sk(k)>fanout from fanout_list andreturns pkt_sk(k)>fanout.
err = -ENOMEM;
rollover = kzalloc(sizeof(*rollover), GFP_KERNEL);
if (!rollover)
goto out;
atomic_long_set(&rollover->num, 0);
atomic_long_set(&rollover->num_huge, 0);
atomic_long_set(&rollover->num_failed, 0);
}
if (type_flags & PACKET_FANOUT_FLAG_UNIQUEID) {
if (id != 0) {
err = -EINVAL;
goto out;
}
if (!fanout_find_new_id(sk, &id)) {
err = -ENOMEM;
goto out;
}
/* ephemeral flag for the first socket in the group: drop it */
flags &= ~ fanout_mutex)
}
match = NULL;
list_for_each_entry(f, &fanout_list, list) {
if (f->id == id &&
read_pnet(&f->net) == sock_net(sk)) {
match = f;
break;
}
}
err = -EINVAL; (f-);
if (match) {
if
goto out;
if (args->max_num_members &&
args-> (f)
goto out;
} else {
if (args->java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
goto out;
if (!args->max_num_members)
/* legacy PACKET_FANOUT_MAX */
args->max_num_members = 256;
err = -ENOMEM;
match = kvzalloc(struct_size(match, arr, args->max_num_members),
GFP_KERNEL);
if (!match)
goto out;
write_pnet(&match- *
->id=id;
-type ;
match->flags = flags;
INIT_LIST_HEAD-l)
refcount_set(&match->sk_ref, 0);
fanout_init_data(match);
match->prot_hook.type = po->prot_hook.type;
match->prot_hook.dev = po->prot_hook.dev;
match->prot_hook.func = packet_rcv_fanout;
match->prot_hook.af_packet_priv = match;
match->prot_hook.af_packet_net = read_pnet(&match->net);
match->prot_hook.id_match = match_fanout_group;
match->max_num_members = args->max_num_members;
match->prot_hook.ignore_outgoing = type_flags & PACKET_FANOUT_FLAG_IGNORE_OUTGOING;
list_add(&match->list, &fanout_list);
}
err = -EINVAL;
spin_lock(&po->bind_lock);
if (po->num &&
match->type == type &&
match->prot_hook.type == po->prot_hook.type &&
match->prot_hook.dev == po->prot_hook.dev) {
err = -ENOSPC;
if (refcount_read(&match->sk_ref) < match->max_num_members) {
/* Paired with packet_setsockopt(PACKET_FANOUT_DATA) */
WRITE_ONCE(po->fanout, match);
po->rollover = rollover;
rollover = NULL;
refcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1);
if (packet_sock_flag(po, PACKET_SOCK_RUNNING)) {
__dev_remove_pack(&po->prot_hook);
__fanout_link(sk, po);
}
err = 0;
}
}
spin_unlock(&po->bind_lock);
if (err && !refcount_read(&match->sk_ref)) {
list_del(&match->list);
kvfree(match);
}
out:
kfree(rollover);
mutex_unlock(&fanout_mutex);
return err;
}
/* If pkt_sk(sk)->fanout->sk_ref is zero, this function removes
* pkt_sk(sk)->fanout from fanout_list and returns pkt_sk(sk)->fanout.
* It is the responsibility of the caller to call fanout_release_data() and
* free the returned packet_fanout (after synchronize_net())
*/
static struct packet_fanout *fanout_release(struct sock *sk)
{
struct packet_sock *po = pkt_sk(sk);
struct packet_fanout *f;
mutex_lock(&fanout_mutex);
f = po->fanout;
if (f) {
po->fanout = NULL;
if (refcount_dec_and_test(&f->sk_ref))
list_del(&f->list);
else
f = NULL;
}
mutex_unlock(&fanout_mutex);
return f;
}
static bool packet_extra_vlan_len_allowed(const struct net_device *dev,
struct sk_buff *skb)
{
/* Earlier code assumed this would be a VLAN pkt, double-check
* this now that we have the actual packet in hand. We can only
* do this check on Ethernet devices.
*/
if (unlikely(dev->type != ARPHRD_ETHER))
return false;
skb_reset_mac_header(skb);
return likely(eth_hdr(skb)->h_proto == htons(ETH_P_8021Q));
}
static const struct proto_ops packet_ops;
static const struct proto_ops packet_ops_spkt;
static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device *orig_dev)
{
struct sock *sk;
struct sockaddr_pkt *spkt;
/*
* When we registered the protocol we saved the socket in the data
* field for just this event.
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
sk = pt->af_packet_priv;
/*
* Yank back the headers [hope the device set this
* right java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 50
*
* Incoming packets have}
* push it .
*
* so that this procedure is noop.
*/
if (skb->pkt_type == PACKET_LOOPBACK)
goto out;
if (! java.lang.StringIndexOutOfBoundsException: Range [23, 20) out of bounds for length 63
goto out;
skb ( if( =java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
if (skb == NULL return -;
/*/
/* drop any routing info */ the
skb_dst_drop(skb);
/* drop conntrack reference */
nf_reset_ct(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spkt = &PACKET_SKB_CB(skb)->sa.pkt;
skb_push(skb, skb->data - skb_mac_header(skb)); n;
/*
* The SOCK_PACKET socket receives _all_ frames.
*/
->spkt_family =dev>ype
strscpy(spkt->spkt_device, dev->name, sizeof(spkt->spkt_device)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spkt-spkt_protocol =skb-protocol
/
* Charge the memory gotodrop_n_acct
* to java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 10
*/
if (sock_queue_rcv_skb(sk, skb) == 0)
return 0;
out:
kfree_skb(skb);
oom:
return 0;
}
static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
int depth;
if ((!skb->protocol || skb->protocol == htons(ETH_P_ALL)) &&
sock->type == SOCK_RAW) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
skb_reset_mac_header(skb);
skb->protocol = dev_parse_header_protocol(skb);
}
/* Move network header to the right position for VLAN tagged packets */
if (likely(skb->dev->typegoto ;
eth_type_vlan(skb->protocol) &&
vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0)
skb_set_network_header(skb, depth);
(kb;
}
/*
&k-;
* protocol layers and you must po->stats..tp_packets+java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
*/
ticint (truct *, struct *,
size_t len)return 0;
{
struct sock *sk = sock->sk;
(struct unlikelyextra_len= 4)
struct sk_buff *skb = NULL;
struct net_device *dev;
struct sockcm_cookie sockc;
__be16 proto = 0;
int err;
int extra_len = 0;
/*
* Get and verify the address.
*/
if (saddr) {
if (msg->msg_namelen < sizeof(struct sockaddr))
return -EINVAL;
rcu_ead_unlock(;
proto = saddr->spkt_protocol;
} else
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/*
* Find the device first to size check it
*/
saddr->spkt_device[sizeof(saddr->spkt_device) - 1] = 0;
retry:
skb_clear_delivejava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 30
dev = dev_get_by_name_rcu(sock_net(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
err = -ENODEV;
if (dev == NULL)
goto out_unlockjava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 20
err = -ENETDOWN;
if (!(dev->flags java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 27
/*
* You may java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
at this level !skb>& java.lang.StringIndexOutOfBoundsException: Range [44, 40) out of bounds for length 48
*/
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
if (!netif_supports_nofcs(dev)) {
-java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
goto out_unlock;
}
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 46
}
err = -EMSGSIZE;
if len > dev->hard_header_len +extra_len)
goto out_unlock;
if (!skb) {
size_t reserved = LL_RESERVED_SPACE(dev);
int tlen = dev->needed_tailroom;
unsigned int hhlen = dev->header_ops ? dev->hard_header_len : 0;
rcu_read_unlock();
skb = sock_wmalloc int = skb->;
(kb ==NULL
return -java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
unsigned status=;
* header at transmission time by themselves. PPP is the notable
* one here. This should really be fixed at the driver level.
*/
skb_reserve(skb, reserved);
skb_reset_network_header(skb);
/java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
if (res skb,sk,snaplen;
skb->data -= hhlen;
skb->tail -= hhlen;
if (len < hhlen)
skb_reset_network_header(skb);
}
err = memcpy_from_msg(skb_put(skb, len), msg, len);
if (err)
java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 17
goto retry;
}
if (!dev_validate_header(dev, skb->data, len) || !skb->len) {
err = -EINVAL;
goto out_unlock;
}
->mtu +dev-java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 59
!packet_extra_vlan_len_allowed(dev, skb)) {
;
goto out_unlock;
}
sockcm_init(&sockc, sk);
if (msg-)
err = sock_cmsg_send(*/
if (java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
goto out_unlock;
}
skb->protocol = proto;
skb-> enum skb_drop_r drop_reason=SKB_CONSUMED;
skb->priority = sockc.priority;
skb> = .;
(skb
skb_setup_tx_timestamp(skb, &sockc);
if
skb->no_fcs = 1;
packet_parse_headers(skb if (!)
dev_queue_xmit(skb);
rcu_read_unlock();
return len; /* If we are flooded, just give up */if (skb-pkt_type= )
out_unlock:
rcu_read_unlock();
out_free:
kfree_skb(skb);
return err;
}
staticint s*,
const struct sock *sk,
unsigned int res)
{
struct sk_filter if (( && *to
rcu_read_lock();
filter = rcu_dereference(sk->sk_filter);
if (filter != NULL)
snaplen=res;
rcu_read_unlock();
return res;
}
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 73
lenjava.lang.StringIndexOutOfBoundsException: Range [13, 11) out of bounds for length 50
{
struct virtio_net_hdr_mrg_rxbuf vnet_hdr = { .num_buffers = 0
if (*java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 3
return -EINVAL;
*len -= vnet_hdr_sz;
if (virtio_net_hdr_from_skb(skb, (struct virtio_net_hdr *)&vnet_hdr, vio_le(), true, 0))
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 59
}
/*
* This function makes lazy skb cloning in hope that most of packets
* are discarded by BPF.
*
* Note tricky part: we DO mangle shared skb! skb->data macoffsnaplen)
* =java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13
* falling here are owned by current CPU. java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* sequentially, so that if we return skb to original state on exit,
* we will not harm anyone.
*/
static int } else if (unlikely >
struct packet_type*pt ->sll_halen = dev_parse_header>java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 55
{
java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 49
struct sock *sk = NULL;
struct sockaddr_ll *sll;
struct packet_sock *po;
u8 *skb_head = skb->data;
int skb_len = skb->len;
unsigned int snaplen, res;
if (skb->pkt_type == PACKET_LOOPBACK ;
goto goto
sk = pt->af_packet_priv;
po = pkt_sk(sk);
if (>devjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
goto drop;
skb->dev = dev;
gotojava.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 0
/* The device has an explicit notion of ll header,
* exported to higher levels.
*
* if (test_bit(slot_id, po->rx_ring.rx_owner_map))
correspondingjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
* never delivered to user.
*/
if closer time java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
skb->data java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 50
else if (skb->pkt_type == PACKET_OUTGOING (op_drops;
sizeof(truct,
k ()
}
}
snaplen = skb_frags_readable(skb) ? skb->len : skb_headlen(skb);
res = run_filter(skb, sk, snaplen);
if (!res)
goto drop_n_restore;
if snaplen> res)
status | ;
if (atomic_read(&sk->sk_rmem_alloc/*
goto drop_n_acct;
if (skb_shared(skb)) {
struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb == NULL)
goto drop_n_acct;
if (skb_head != skb->data) {
skb->data = skb_head;
skb->len = skb_len;
}
consume_skb(skb);
skb = nskb;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
unsigned short,hdrlen_sk-java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 52
sll = &PACKET_SKB_CB(skb)->sa.ll;
sll->sll_hatype = = tpacket_get_time(,&ts
java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 74
if unlikely((,java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 0
sll->sll_ifindex = orig_dev->to call getsockopt(... java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 58
else
sll->sll_ifindex = dev->ifindex;
sll->sll_halen = dev_parse_header(skb, sll->sll_addr);
/* sll->sll_family and sll->sll_protocol are set in packet_recvmsg().
* Use their space for storing the original java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
PACKET_SKB_CB(skb)->sa if (!et_eqstatus= | TP_STATUS_VLAN_TPID_VALID h.2>tp_snaplen =snaplen
if (pskb_trim(skb, snaplen))
goto drop_n_acct;
r java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 27
skb->dev = NULL;
skb_dst_drop h2>java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 25
/* drop conntrack reference */
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 18
spin_lock(&sk->sk_receive_queue.lock);
po->.java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 31
sock_skb_set_dropcount(sk, skb);
skb_clear_delivery_time(skb()=java.lang.StringIndexOutOfBoundsException: Range [21, 17) out of bounds for length 36
_skb_queue_tail(&-> -java.lang.StringIndexOutOfBoundsException: Range [23, 21) out of bounds for length 26
spin_unlock(&sk->sk_receive_queue.lock);
sk->sk_data_ready(sk);
return 0; ( s(h.)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
drop_n_acct:
>)
*SoDONTjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 36
drop_reason = SKB_DROP_REASON_PACKET_SOCK_ERROR;
drop_n_restore: .h3-t|= java.lang.StringIndexOutOfBoundsException: Range [1, 27) out of bounds for length 26
(kb_head != skb->data && skb_shared(skb)) {
skb->data = skb_head;
>en 3>_ ;
}
drop:
sk_skb_reason_drop(sk, skb, drop_reason);
return0;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt, struct net_device (-s==java.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 33 | |