mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-28 17:11:20 +02:00
Update App version to 0.1.3
Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
13
network.go
13
network.go
@@ -167,3 +167,16 @@ func rpcRenewDHCPLease() error {
|
||||
func rpcRequestDHCPAddress(ip string) error {
|
||||
return networkState.RpcRequestDHCPAddress(ip)
|
||||
}
|
||||
|
||||
const ethernetMacAddressPath = "/userdata/ethaddr.txt"
|
||||
|
||||
func rpcSetEthernetMacAddress(macAddress string) (interface{}, error) {
|
||||
normalized, err := networkState.SetMACAddress(macAddress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.WriteFile(ethernetMacAddressPath, []byte(normalized+"\n"), 0644); err != nil {
|
||||
return nil, fmt.Errorf("failed to write %s: %w", ethernetMacAddressPath, err)
|
||||
}
|
||||
return networkState.RpcGetNetworkState(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user