Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_blackhole_dev.c Create Date:2022-07-28 06:37:26
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:test_blackholedev_init

Proto:static int __init test_blackholedev_init(void)

Type:int

Parameter:Nothing

37  skb = allocate a network buffer
38  If Not skb Then Return -ENOMEM
42  skb_reserve - adjust headroom*@skb: buffer to alter*@len: bytes to move* Increase the headroom of an empty &sk_buff by reducing the tail* room. This is only allowed for an empty buffer.
45  data_len = SKB_SIZE - Ether + IPv6 + UDP + andom tail-room
46  memset(__skb_put(skb, data_len), 0xf, data_len)
50  uh = add data to the start of a buffer
51  skb_set_transport_header(skb, 0)
52  source = dest = htons(UDP_PORT)
53  len = htons(data_len)
54  check = 0
56  ip6h = add data to the start of a buffer
57  skb_set_network_header(skb, 0)
58  hop_limit = 32
59  payload_len = data_len + sizeof(structudphdr)
60  nexthdr = IPPROTO_UDP
61  saddr = in6addr_loopback
62  daddr = in6addr_loopback
64  ethh = add data to the start of a buffer
65  skb_set_mac_header(skb, 0)
67  protocol = htons(IPv6 over bluebook )
68  pkt_type = To us
69  dev = blackhole_netdev
72  ret = transmit a buffer
75  Case ret == qdisc ->enqueue() return codes.
76  pr_warn("dev_queue_xmit() returned NET_XMIT_SUCCESS\n")
77  Break
78  Case ret == skb dropped
79  pr_warn("dev_queue_xmit() returned NET_XMIT_DROP\n")
80  Break
81  Case ret == congestion notification
82  pr_warn("dev_queue_xmit() returned NET_XMIT_CN\n")
83  Break
84  Default
85  pr_err("dev_queue_xmit() returned UNKNOWN(%d)\n", ret)
88  Return 0