- Eth p all linux
- Address Types
- Socket Options
- Ioctls
- Error Handling
- ERRORS
- VERSIONS
- NOTES
- Compatibility
- SEE ALSO
- Eth p all linux
- ТИПЫ АДРЕСОВ
- ОПЦИИ СОКЕТОВ
- СИСТЕМНЫЕ ВЫЗОВЫ
- ОБРАБОТКА ОШИБОК
- СОВМЕСТИМОСТЬ
- ЗАМЕЧАНИЯ
- НАЙДЕННЫЕ ОШИБКИ
- ВЕРСИИ
- НАЙДЕННЫЕ ОШИБКИ
- БЛАГОДАРНОСТИ
- СМ. ТАКЖЕ
- ETHlargementPill (r2, r3) : Download, Settings (1080, 1080 ti, etc)
- Download for Windows/Linux
- What is OhGodAnETHlargementPill
- Relevance and alternatives
- How to use OhGodAnETHlargementPill
- Step 1 — Download the program
- Step 2 — Run the program
- Step 3 — Leave the Program Running
- Packet MMAPВ¶
- AbstractВ¶
- Why use PACKET_MMAPВ¶
- How to use mmap() to improve capture processВ¶
- How to use mmap() directly to improve capture processВ¶
- How to use mmap() directly to improve transmission processВ¶
- PACKET_MMAP settingsВ¶
- PACKET_MMAP setting constraintsВ¶
- Block size limitВ¶
- Block number limitВ¶
Eth p all linux
The socket_type is either SOCK_RAW for raw packets including the link level header or SOCK_DGRAM for cooked packets with the link level header removed. The link level header information is available in a common format in a sockaddr_ll . protocol is the IEEE 802.3 protocol number in network order. See the include file for a list of allowed protocols. When protocol is set to htons(ETH_P_ALL) then all protocols are received. All incoming packets of that protocol type will be passed to the packet socket before they are passed to the protocols implemented in the kernel.
Only processes with effective UID 0 or the CAP_NET_RAW capability may open packet sockets.
SOCK_RAW packets are passed to and from the device driver without any changes in the packet data. When receiving a packet, the address is still parsed and passed in a standard sockaddr_ll address structure. When transmitting a packet, the user supplied buffer should contain the physical layer header. That packet is then queued unmodified to the network driver of the interface defined by the destination address. Some device drivers always add other headers. SOCK_RAW is similar to but not compatible with the obsolete AF_INET/SOCK_PACKET of Linux 2.0.
SOCK_DGRAM operates on a slightly higher level. The physical header is removed before the packet is passed to the user. Packets sent through a SOCK_DGRAM packet socket get a suitable physical layer header based on the information in the sockaddr_ll destination address before they are queued.
By default all packets of the specified protocol type are passed to a packet socket. To only get packets from a specific interface use bind (2) specifying an address in a struct sockaddr_ll to bind the packet socket to an interface. Only the sll_protocol and the sll_ifindex address fields are used for purposes of binding.
The connect (2) operation is not supported on packet sockets.
When the MSG_TRUNC flag is passed to recvmsg (2), recv (2), recvfrom (2) the real length of the packet on the wire is always returned, even when it is longer than the buffer.
Address Types
sll_protocol is the standard ethernet protocol type in network order as defined in the include file. It defaults to the socket’s protocol. sll_ifindex is the interface index of the interface (see netdevice (7)); 0 matches any interface (only permitted for binding). sll_hatype is a ARP type as defined in the include file. sll_pkttype contains the packet type. Valid types are PACKET_HOST for a packet addressed to the local host, PACKET_BROADCAST for a physical layer broadcast packet, PACKET_MULTICAST for a packet sent to a physical layer multicast address, PACKET_OTHERHOST for a packet to some other host that has been caught by a device driver in promiscuous mode, and PACKET_OUTGOING for a packet originated from the local host that is looped back to a packet socket. These types make only sense for receiving. sll_addr and sll_halen contain the physical layer (e.g., IEEE 802.3) address and its length. The exact interpretation depends on the device.
When you send packets it is enough to specify sll_family , sll_addr , sll_halen , sll_ifindex . The other fields should be 0. sll_hatype and sll_pkttype are set on received packets for your information. For bind only sll_protocol and sll_ifindex are used.
Socket Options
mr_ifindex contains the interface index for the interface whose status should be changed. The mr_type parameter specifies which action to perform. PACKET_MR_PROMISC enables receiving all packets on a shared medium (often known as «promiscuous mode»), PACKET_MR_MULTICAST binds the socket to the physical layer multicast group specified in mr_address and mr_alen , and PACKET_MR_ALLMULTI sets the socket up to receive all multicast packets arriving at the interface.
In addition the traditional ioctls SIOCSIFFLAGS , SIOCADDMULTI , SIOCDELMULTI can be used for the same purpose.
Ioctls
In addition all standard ioctls defined in netdevice (7) and socket (7) are valid on packet sockets.
Error Handling
ERRORS
In addition other errors may be generated by the low-level driver.
VERSIONS
The include file is present since glibc 2.1. Older systems need:
NOTES
The SOCK_DGRAM packet sockets make no attempt to create or parse the IEEE 802.2 LLC header for a IEEE 802.3 frame. When ETH_P_802_3 is specified as protocol for sending the kernel creates the 802.3 frame and fills out the length field; the user has to supply the LLC header to get a fully conforming packet. Incoming 802.3 packets are not multiplexed on the DSAP/SSAP protocol fields; instead they are supplied to the user as protocol ETH_P_802_2 with the LLC header prepended. It is thus not possible to bind to ETH_P_802_3 ; bind to ETH_P_802_2 instead and do the protocol multiplex yourself. The default for sending is the standard Ethernet DIX encapsulation with the protocol filled in.
Packet sockets are not subject to the input or output firewall chains.
Compatibility
spkt_family contains the device type, spkt_protocol is the IEEE 802.3 protocol type as defined in and spkt_device is the device name as a null-terminated string, for example, eth0.
This structure is obsolete and should not be used in new code.
The IEEE 802.2/803.3 LLC handling could be considered as a bug.
Socket filters are not documented.
The MSG_TRUNC recvmsg (2) extension is an ugly hack and should be replaced by a control message. There is currently no way to get the original destination address of packets via SOCK_DGRAM .
SEE ALSO
RFC 894 for the standard IP Ethernet encapsulation.
RFC 1700 for the IEEE 802.3 IP encapsulation.
The include file for physical layer protocols.
Источник
Eth p all linux
socket_type равен либо SOCK_RAW для raw-пакетов (включая заголовок установки соединения), либо SOCK_DGRAM для подготовленных пакетов без заголовка уровня соединения. Информация заголовка уровня соединения в общем формате предоставлена в sockaddr_ll . protocol — номер протокола в соответствии с IEEE 802.3 в сетевом порядке байтов. Список возможных протоколов приведен в файле Если protocol содержит значение htons(ETH_P_ALL) , то программой будут приниматься все протоколы. Все входящие пакеты этого типа протокола будут передаваться пакетному сокету до того, как они будут переданы протоколам, реализованным в ядре.
Открывать пакетные сокеты могут лишь процессы с идентификатором эффективного пользователя, равным нулю, или имеющие возможность CAP_NET_RAW .
Пакеты SOCK_RAW передаются драйверу устройства и принимаются от него без всяких изменений данных пакета. При получении пакета адрес обрабатывается и передается в стандартной структуре адреса sockaddr_ll . При передаче пакета буфер пользователя должен содержать заголовок физического уровня. Пакет передается без изменений драйверу сетевого интерфейса, указанному в адресе назначения. Hекоторые драйверы устройств всегда добавляют к заголовку и другие заголовки. SOCK_RAW похож, но не совместим с устаревшим SOCK_PACKET для Linux 2.0.
SOCK_DGRAM работает на несколько более высоком уровне. Физический заголовок удаляется перед тем, как пакет отправляется пользователю. Пакеты, посылаемые через пакетный сокет SOCK_DGRAM , получают перед постановкой в очередь подходящий заголовок физического уровня в соответствии с информацией об адресе назначения из sockaddr_ll .
По умолчанию, все пакеты указанного типа протокола передаются пакетному сокету. Для получения пакетов только определенного интерфейса используйте bind (2) : это соединит пакетный сокет с интерфейсом, адрес которого указывается в структуре struct sockaddr_ll . Для соединения используются только поля адреса sll_protocol и sll_ifindex .
Операция connect (2) с пакетными сокетами не поддерживается.
Когда флаг MSG_TRUNC передается recvmsg (2), recv (2), recvfrom (2), то всегда возвращается действительная текущая длина пакета, даже если она больше, чем буфер.
ТИПЫ АДРЕСОВ
ОПЦИИ СОКЕТОВ
В дополнение ко всему, для этих целей могут быть использованы традиционные ioctl-вызовы: SIOCSIFFLAGS , SIOCADDMULTI , SIOCDELMULTI .
СИСТЕМНЫЕ ВЫЗОВЫ
Кроме того, возможно использование всех стандартынх вызовов ioctl, определенных в netdevice (7) и socket (7).
ОБРАБОТКА ОШИБОК
СОВМЕСТИМОСТЬ
Эта структура устарела и не должна быть указана в новом коде.
ЗАМЕЧАНИЯ
Пакетные сокеты SOCK_DGRAM не пытаются создать или обработать заголовок IEEE 802.2 LLC для кадров IEEE 802.3. Если в качестве протокола для отправки указан ETH_P_802_3 , ядро создает кадр 802.3 и заполняет поле длины; пользователь должен указать заголовок LLC для того, чтобы получить полностью соответствующий стандарту пакет. Входящие пакеты 802.3 не мультиплексируются по полям DSAP/SSAP; вместо этого они предоставляются пользователю как протокол ETH_P_802_2 с заголовком LLC. Поэтому подключиться (to bind) к ETH_P_802_3 невозможно; вместо этого подключайтесь к ETH_P_802_2 и выполняйте мультиплексирование протокола сами. По умолчанию для отправки используется стандартная инкапсуляция Ethernet DIX со вставленным протоколом.
Пакетные сокеты не обрабатываются входящими и исходящими правилами сетевого экрана.
НАЙДЕННЫЕ ОШИБКИ
Дополнительные ошибки могут генерироваться низкоуровенвым драйвером.
ВЕРСИИ
НАЙДЕННЫЕ ОШИБКИ
Обработка IEEE 802.2/803.3 LLC должна считаться ошибкой.
Фильтры сокетов не описаны. Расширение MSG_TRUNC для recvmsg является очень плохо сделанной правкой и должна быть заменена на управляющее сообщение. На данный момент нет иного выхода, кроме как определение настоящего адреса назначения пакета по SOCK_DGRAM.
БЛАГОДАРНОСТИ
СМ. ТАКЖЕ
RFC 894 создана для стандарта инкапсуляции IP Ethernet.
RFC 1700 создана для инкапсуляци IEEE 802.3 IP.
Файл linux/if_ether.h создан для протоколов физического уровня.
Источник
ETHlargementPill (r2, r3) : Download, Settings (1080, 1080 ti, etc)
In this tutorial, you will learn how to set up and use OhGodAnETHlargementPill r2, r3 and newer.
Download for Windows/Linux
What is OhGodAnETHlargementPill
OhGodAnETHlargementPill — is a mining pill designed for users of Nvidia graphics cards based on GDDR5X video memory (GTX 1080 and GTX 1080 Ti). It significantly increases the hash rate when mining cryptocurrencies using the Ethash algorithm (Dagger Hashimoto). The program is available for both Linux and Windows.
ETHlargementPill was released for GDDR5X memory only. All you need to do to increase the hashrate of Ethereum (ETH) or another Ethash based cryptocurrency to 50 MH/S on a GTX 1080 Ti (up to 40 MH/s on a GTX 1080) is to run it along with your miner.
Relevance and alternatives
NiceHash QuickMiner already includes the same functionality and is 100% safe to use. Use QuickMiner instead.
In 2021, OhGodAnETHlargementPill is no longer needed if you are using PhoenixMiner. You should use the command -straps 2 for the same effect.
In another mining program — NBMiner, use the command -mt . It does the same thing as a pill. This setting is enabled when mining on 1080 and 1080ti GPUs.
If you still need a “tablet”, then it comes with the NiceHash client.
If you nevertheless decide to use this software separately.
How to use OhGodAnETHlargementPill
Step 1 — Download the program
Download the file. Or download from release R2/R3.
Step 2 — Run the program
Leave the program window open and start setting up mining for maximum profit. I had to raise PL from standard settings from 55 to 80, and the memory frequency was increased by 50 MHz.
Step 3 — Leave the Program Running
After completing these procedures, you will see an increase in the hash rate on video cards with GDDR5X memory.
Источник
Packet MMAPВ¶
AbstractВ¶
This file documents the mmap() facility available with the PACKET socket interface. This type of sockets is used for
capture network traffic with utilities like tcpdump,
transmit network traffic, or any other that needs raw access to network interface.
Howto can be found at:
Why use PACKET_MMAPВ¶
Non PACKET_MMAP capture process (plain AF_PACKET) is very inefficient. It uses very limited buffers and requires one system call to capture each packet, it requires two if you want to get packet’s timestamp (like libpcap always does).
On the other hand PACKET_MMAP is very efficient. PACKET_MMAP provides a size configurable circular buffer mapped in user space that can be used to either send or receive packets. This way reading packets just needs to wait for them, most of the time there is no need to issue a single system call. Concerning transmission, multiple packets can be sent through one system call to get the highest bandwidth. By using a shared buffer between the kernel and the user also has the benefit of minimizing packet copies.
It’s fine to use PACKET_MMAP to improve the performance of the capture and transmission process, but it isn’t everything. At least, if you are capturing at high speeds (this is relative to the cpu speed), you should check if the device driver of your network interface card supports some sort of interrupt load mitigation or (even better) if it supports NAPI, also make sure it is enabled. For transmission, check the MTU (Maximum Transmission Unit) used and supported by devices of your network. CPU IRQ pinning of your network interface card can also be an advantage.
How to use mmap() to improve capture processВ¶
From the user standpoint, you should use the higher level libpcap library, which is a de facto standard, portable across nearly all operating systems including Win32.
Packet MMAP support was integrated into libpcap around the time of version 1.3.0; TPACKET_V3 support was added in version 1.5.0
How to use mmap() directly to improve capture processВ¶
From the system calls stand point, the use of PACKET_MMAP involves the following process:
socket creation and destruction is straight forward, and is done the same way with or without PACKET_MMAP:
where mode is SOCK_RAW for the raw interface were link level information can be captured or SOCK_DGRAM for the cooked interface where link level information capture is not supported and a link level pseudo-header is provided by the kernel.
The destruction of the socket and all associated resources is done by a simple call to close(fd).
Similarly as without PACKET_MMAP, it is possible to use one socket for capture and transmission. This can be done by mapping the allocated RX and TX buffer ring with a single mmap() call. See “Mapping and use of the circular buffer (ring)”.
Next I will describe PACKET_MMAP settings and its constraints, also the mapping of the circular buffer in the user process and the use of this buffer.
How to use mmap() directly to improve transmission processВ¶
Transmission process is similar to capture as shown below:
Socket creation and destruction is also straight forward, and is done the same way as in capturing described in the previous paragraph:
The protocol can optionally be 0 in case we only want to transmit via this socket, which avoids an expensive call to packet_rcv(). In this case, you also need to bind(2) the TX_RING with sll_protocol = 0 set. Otherwise, htons(ETH_P_ALL) or any other protocol, for example.
Binding the socket to your network interface is mandatory (with zero copy) to know the header size of frames used in the circular buffer.
As capture, each frame contains two parts:
By default, the user should put data at:
So, whatever you choose for the socket mode (SOCK_DGRAM or SOCK_RAW), the beginning of the user data will be at:
If you wish to put user data at a custom offset from the beginning of the frame (for payload alignment with SOCK_RAW mode for instance) you can set tp_net (with SOCK_DGRAM) or tp_mac (with SOCK_RAW). In order to make this work it must be enabled previously with setsockopt() and the PACKET_TX_HAS_OFF option.
PACKET_MMAP settingsВ¶
To setup PACKET_MMAP from user level code is done with a call like
The most significant argument in the previous call is the req parameter, this parameter must to have the following structure:
This structure is defined in /usr/include/linux/if_packet.h and establishes a circular buffer (ring) of unswappable memory. Being mapped in the capture process allows reading the captured frames and related meta-information like timestamps without requiring a system call.
Frames are grouped in blocks. Each block is a physically contiguous region of memory and holds tp_block_size/tp_frame_size frames. The total number of blocks is tp_block_nr. Note that tp_frame_nr is a redundant parameter because:
indeed, packet_set_ring checks that the following condition is true:
Lets see an example, with the following values:
we will get the following buffer structure:
A frame can be of any size with the only condition it can fit in a block. A block can only hold an integer number of frames, or in other words, a frame cannot be spawned across two blocks, so there are some details you have to take into account when choosing the frame_size. See “Mapping and use of the circular buffer (ring)”.
PACKET_MMAP setting constraintsВ¶
In kernel versions prior to 2.4.26 (for the 2.4 branch) and 2.6.5 (2.6 branch), the PACKET_MMAP buffer could hold only 32768 frames in a 32 bit architecture or 16384 in a 64 bit architecture.
Block size limitВ¶
As stated earlier, each block is a contiguous physical region of memory. These memory regions are allocated with calls to the __get_free_pages() function. As the name indicates, this function allocates pages of memory, and the second argument is “order” or a power of two number of pages, that is (for PAGE_SIZE == 4096) order=0 ==> 4096 bytes, order=1 ==> 8192 bytes, order=2 ==> 16384 bytes, etc. The maximum size of a region allocated by __get_free_pages is determined by the MAX_ORDER macro. More precisely the limit can be calculated as:
So get_free_pages can allocate as much as 4MB or 8MB in a 2.4/2.6 kernel respectively, with an i386 architecture.
User space programs can include /usr/include/sys/user.h and /usr/include/linux/mmzone.h to get PAGE_SIZE MAX_ORDER declarations.
The pagesize can also be determined dynamically with the getpagesize (2) system call.
Block number limitВ¶
To understand the constraints of PACKET_MMAP, we have to see the structure used to hold the pointers to each block.
Currently, this structure is a dynamically allocated vector with kmalloc called pg_vec, its size limits the number of blocks that can be allocated:
kmalloc allocates any number of bytes of physically contiguous memory from a pool of pre-determined sizes. This pool of memory is maintained by the slab allocator which is at the end the responsible for doing the allocation and hence which imposes the maximum memory that kmalloc can allocate.
In a 2.4/2.6 kernel and the i386 architecture, the limit is 131072 bytes. The predetermined sizes that kmalloc uses can be checked in the “size- ” entries of /proc/slabinfo
In a 32 bit architecture, pointers are 4 bytes long, so the total number of pointers to blocks is:
Источник