feat: 配置板子网络时,更新动态mac
This commit is contained in:
@@ -51,7 +51,7 @@ public class DataController : ControllerBase
|
||||
public DateTime? BoardExpireTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 获取本机IP地址(优先选择与实验板同网段的IP)
|
||||
/// </summary>
|
||||
/// <returns>本机IP地址</returns>
|
||||
@@ -60,7 +60,7 @@ public class DataController : ControllerBase
|
||||
try
|
||||
{
|
||||
var boardIpSegments = BOARD_IP.Split('.').Take(3).ToArray();
|
||||
|
||||
|
||||
// 优先选择与实验板IP前三段相同的IP
|
||||
var sameSegmentIP = System.Net.NetworkInformation.NetworkInterface
|
||||
.GetAllNetworkInterfaces()
|
||||
@@ -278,7 +278,7 @@ public class DataController : ControllerBase
|
||||
return NotFound("没有可用的实验板");
|
||||
|
||||
var boardInfo = boardOpt.Value;
|
||||
if (!(await Arp.CheckOrAddAsync(boardInfo.IpAddr, boardInfo.MacAddr, GetLocalIPAddress().ToString())))
|
||||
if (!(await ArpClient.CheckOrAddAsync(boardInfo.IpAddr, boardInfo.MacAddr, GetLocalIPAddress().ToString())))
|
||||
{
|
||||
logger.Error($"无法配置ARP,实验板可能会无法连接");
|
||||
}
|
||||
@@ -346,7 +346,7 @@ public class DataController : ControllerBase
|
||||
return NotFound("未找到对应的实验板");
|
||||
|
||||
var boardInfo = ret.Value.Value;
|
||||
if (!(await Arp.CheckOrAddAsync(boardInfo.IpAddr, boardInfo.MacAddr, GetLocalIPAddress().ToString())))
|
||||
if (!(await ArpClient.CheckOrAddAsync(boardInfo.IpAddr, boardInfo.MacAddr, GetLocalIPAddress().ToString())))
|
||||
{
|
||||
logger.Error($"无法配置ARP,实验板可能会无法连接");
|
||||
}
|
||||
@@ -490,4 +490,3 @@ public class DataController : ControllerBase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user