// 更新网桥配置信息
// 函数主要任务:
// 1.重新选择根端口
// 2.重新选择根网桥
1.1 void br_configuration_update(struct net_bridge *br)
{
br_root_selection(br);//选择根端口,根网桥
br_designated_port_selection(br);//选择指定端口
}
// 选择根端口
// 调用路径:br_configuration_update->br_root_selection
// 函数主要任务:
// 1.遍历所有端口,选择具备成为根端口的端口
// 2.没有选择出根端口,则更新网桥成为根网桥
// 3.否则更新可到达的根网桥,根路径开销
// 注:
// 1.网桥的根路径开销 = 根端口的指定开销+端口的根路径开销
1.2 static void br_root_selection(struct net_bridge *br)
{
struct net_bridge_port *p;
u16 root_port = 0;
list_for_each_entry(p, &br->port_list, list) {//遍历所有端口
if (br_should_become_root_port(p, root_port))//判断端口是否应该成为根端口
root_port = p->port_no;//根端口id
}
br->root_port = root_port;//网桥的根端口
if (!root_port) {//没有选出合适的根端口
br->designated_root = br->bridge_id;//设置自己为根网桥,开始新一轮的网络拓扑检测
br->root_path_cost = 0;
} else {//成功选出根端口
p = br_get_port(br, root_po
网络子系统33_网桥设备的配置更新
最新推荐文章于 2022-04-16 21:56:56 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)