Home > Articles > Networking

  • Print
  • + Share This
This chapter is from the book

3.10 Loopback Initialization

Finally, we show the initialization for the single loopback interface. The loopback interface places any outgoing packets back on an appropriate input queue. There is no hardware device associated with the interface. The loopback pseudo-device is initialized when main calls loopattach indirectly through the pdev_attach pointer in the loopback's pdevinit structure. Figure 3.31 shows the loopattach function.

03fig31.gifFigure 3.31. Loopback interface initialization.


The loopback if_mtu is set to 1536 bytes (LOMTU). In if_flags, IFF_LOOPBACK and IFF_MULTICAST are set. A loopback interface has no link header or hardware address, so if_hdrlen and if_addrlen are set to 0. if_attach finishes the initialization of the ifnet structure and bpfattach registers the loopback interface with BPF.

The loopback MTU should be at least 1576 (40 + 3 × 512) to leave room for a standard TCP/IP header. Solaris 2.3, for example, sets the loopback MTU to 8232 (40 + 8 × 1024). These calculations are biased toward the Internet protocols; other protocols may have default headers larger than 40 bytes.

  • + Share This
  • 🔖 Save To Your Account