示例#1
0
文件: bridge_linux.go 项目: drptbl/oz
// AddSlaveIfc adds network interface to network bridge.
// It is equivalent of running: ip link set ${ifc name} master ${bridge name}
// It returns error if the network interface could not be added to the bridge.
func (br *Bridge) AddSlaveIfc(ifc *net.Interface) error {
	if err := netlink.NetworkSetMaster(ifc, br.ifc); err != nil {
		return err
	}

	br.slaveIfcs = append(br.slaveIfcs, *ifc)

	return nil
}
示例#2
0
文件: bridge_linux.go 项目: drptbl/oz
// AddToBridge adds network interfaces to network bridge.
// It is equivalent of running: ip link set ${netIfc name} master ${netBridge name}
// It returns error when it fails to add the network interface to bridge.
func AddToBridge(netIfc, netBridge *net.Interface) error {
	return netlink.NetworkSetMaster(netIfc, netBridge)
}