Creating a New Bridge Device
Even though bridge devices are virtual, the discussion about how a device is enabled, disabled, registered, and unregistered in Chapter 8 still applies. You are encouraged to use that chapter as a reference when reading this section.
The creation and registration of a bridge device follows the model described in Chapter 8. The only difference is that because it
is a virtual device, a bridge needs extra initializations in its private area (i.e., the
net_bridge data structure at the bottom of Figure 16-6). This last task is taken care
of by new_bridge_dev, which:
Allocates and initializes a
net_devicedata structure usingbr_dev_setupas the setup routine. See the section "Bridge Device Setup Routine."Initializes the private structure, as shown in Figure 16-6.
Initializes the bridge priority to the default value, 32,768 (0x8000).
Initializes the designated bridge ID with its identifier, the root path cost to 0, and the root port to 0 (i.e., no root port). This is because when a bridge is first enabled, it believes itself to be the root bridge. See the section "Root Bridge Selection" in Chapter 15.
Initializes the aging time to the default of 5 minutes.
Initializes the per-bridge timers with
br_stp_timer_init.
Note that the initialization of spanning tree parameters is done regardless of whether the STP is enabled for the bridge.
Bridge devices can be assigned any name. Common ones are brN and stpN, when the Spanning Tree Protocol is disabled and enabled, respectively. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access