Allocate an Ethernet net_device with alloc_etherdev
alloc_etherdev() allocates a net_device with Ethernet defaults and your private struct behind it; fetch that struct with netdev_priv() (Linux 6.12).
Short posts that solve one thing: the code, the output we got, and why it works.
alloc_etherdev() allocates a net_device with Ethernet defaults and your private struct behind it; fetch that struct with netdev_priv() (Linux 6.12).
Read an RTSP camera over TCP with ffmpeg 7.1 -rtsp_transport tcp, which avoids the packet loss and blocked ports UDP runs into.
Send a byte range of a file to a socket with sendfile(2) and an in/out offset pointer, which leaves the file's own position alone. Linux 5.x.
Convert a 16-bit port or length to network byte order with htons before it goes on the wire, and back with ntohs. Both come from arpa/inet.h on POSIX.
Open a live capture in one call with pcap_open_live: device, snaplen, promiscuous flag, read timeout and an error buffer. libpcap 1.10.
An XDP program ends with a verdict: XDP_PASS hands the frame to the stack, XDP_DROP discards it, XDP_TX bounces it out the same port. Linux 5.x, libbpf.
Queue an asynchronous file read with io_uring_prep_read in liburing 2.5 on Linux 6.8, submit it, and read the byte count from cqe->res.
Create an io_uring instance with io_uring_queue_init in liburing 2.5 on Linux 6.8, check the negative errno return, and release it with io_uring_queue_exit.
Always call epoll_ctl(EPOLL_CTL_DEL) before close() on Linux 6.8, because a dup()ed descriptor keeps a closed socket registered and sending events.
Register a socket with an epoll instance using epoll_ctl(EPOLL_CTL_ADD) and an epoll_event holding EPOLLIN on Linux 6.8 with glibc 2.39.
Test whether a descriptor is a listening socket with getsockopt(SO_ACCEPTCONN) on Linux, for example to tell an inherited listener from a client socket.
Read a socket option back with getsockopt() in C on POSIX, and set the socklen_t length argument first because the kernel treats it as value-result.
We send one email when a new post is published. No spam.