Network functionality

From Wikibooks, open books for an open world
Jump to navigation Jump to search


networking
sockets access
address families: inet, unix, ...
network storage
protocols
network interfaces
network drivers

Linux kernel network functionality spans from sockets interface through protocols to network cards.


⚲ Shell interfaces:

  • man 8 netstat prints network connections, routing tables, interface statistics and other details
  • man 8 ip shows and configures routing, network devices, interfaces and tunnels
  • man 8 ss - socket statistics utility


Sockets[edit | edit source]

⚲ API:

sys/socket.h — main user mode sockets header


Basic common and client side interface:


Additional server side interface:


⚙️ Internals




📚 References

Network storage[edit | edit source]

🚀 advanced topic

🔧 TODO


⚲ API:


See also Zero-copy between file descriptors


Logistics[edit | edit source]

Names[edit | edit source]

⚲ API: man 2 uname, man 2 sethostname, man 2 gethostname, man 2 setdomainname man 2 getdomainname


⚙️ Details


📚 References:


Address families[edit | edit source]

⚲ API:


Common AF: AF_UNIX id, AF_INET id, AF_NETLINK id.


PF - Protocol Family index (PF_MAX id) actually is the same as Address Family index (AF).


⚙️ Internals of some AF:

Totally there are more than 40 AFs (see AF_MAX id)


⚙️ Internals:


📚 References:


Protocols[edit | edit source]

Each Protocol Family (PF, same index as Address Family AF) consists of several protocol implementations.

Directory /proc/net contains various files and subdirectories containing information about the networking layer. File /proc/net/protocols lists available and used protocols.

In each PF protocols are classified to different types sock_type id, for example stream, datagram and raw socket. TCP is type of stream, UDP is type of datagram, raw and ping are type of raw.


📚 References:


RDMA[edit | edit source]

🚀 advanced topic


🗝️ Acronyms:


⚲ Interfaces:


⚙️ Internals:


📚 References:

Netfilter[edit | edit source]

🚀 advanced topic

⚲ Interface:


⚙️ Internals:


📚 References:


Network device interfaces[edit | edit source]

👁 Example: drivers/net/loopback.c src - the most famous and simple interface lo

⚙️ function loopback_xmit id receives skb and passes it back with netif_rx id


📚 References:

Network drivers[edit | edit source]


⚙️ Internals:


📚 References:


💾 Historical: